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;
}
}
}

View File

@@ -0,0 +1,111 @@
#define D_AlwAct_StructureDefine
/*----------------------------------------------------------------------
* Includes
*--------------------------------------------------------------------*/
#include "ToolsCPA.h"
#include "macros.h"
#include "GameEng.h"
#include "AlwAct.h"
#include "Actions/AllActs.h"
#include "Structur/GameScpt.h"
#include "Structur/ErrGame.h"
#include "Structur/MemGame.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "Structur/Objects.h"
#include "Zemem.h"
/* --------------------------------
- Get Set accessors
----------------------------------*/
/*--------------------------------------------------------------------*/
void fn_vSetCharacterInAlwaysActiveCharacterNode(tdxHandleToAlwaysActiveCharacterNode hCharNode,HIE_tdxHandleToSuperObject hCharacter)
{
tdstAlwaysActiveCharacter *p_stCharNode;
p_stCharNode = (tdstAlwaysActiveCharacter *)hCharNode;
p_stCharNode->hAlwActSuperObject = hCharacter;
}
/*--------------------------------------------------------------------*/
HIE_tdxHandleToSuperObject fn_hGetCharacterInAlwaysActiveCharacterNode(tdxHandleToAlwaysActiveCharacterNode hCharNode)
{
tdstAlwaysActiveCharacter *p_stCharNode;
p_stCharNode = (tdstAlwaysActiveCharacter *)hCharNode;
return (p_stCharNode->hAlwActSuperObject);
}
/*---------------------------------------
- Functions for the lists
-----------------------------------------*/
void fn_vAddCharacterInAlwaysActiveCharacterList(HIE_tdxHandleToSuperObject hCharacter)
{
tdxHandleToAlwaysActiveCharacterNode hCharNode;
tdstAlwaysActiveCharacter *p_stCharNode;
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeAlwaysActiveChar , 0);
p_stCharNode=(tdstAlwaysActiveCharacter *)M_p_GameMallocInHLM(sizeof(tdstAlwaysActiveCharacter));
LST2_M_DynamicInitElement(p_stCharNode);
hCharNode = (tdxHandleToAlwaysActiveCharacterNode )p_stCharNode;
fn_vSetCharacterInAlwaysActiveCharacterNode(hCharNode,hCharacter);
LST2_M_DynamicAddTail(&g_stEngineStructure.hAlwaysActiveCharactersList,hCharNode);
/*
* Update Misc Flags
*/
/* ANNECY MT - 12/10/98 {*/
fn_vStandardGameSetAlwaysActive(M_GetMSHandle(hCharacter,StandardGame),TRUE);
/* END ANNECY MT }*/
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vRemoveCharacterFromAlwaysActiveCharacterList(HIE_tdxHandleToSuperObject hCharacter)
{
tdxHandleToAlwaysActiveCharacterNode hCharNode;
short i;
M_ForEachAlwaysActiveCharacterNode(hCharNode,i)
{
if(fn_hGetCharacterInAlwaysActiveCharacterNode(hCharNode) == hCharacter)
{
LST2_M_DynamicIsolate(hCharNode);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeAlwaysActiveChar , 0);
M_GameFreeInHLM((tdstAlwaysActiveCharacter *)hCharNode);
break;
}
}
/*
* Update Misc Flags
*/
/* ANNECY MT - 12/10/98 {*/
fn_vStandardGameSetAlwaysActive(M_GetMSHandle(hCharacter,StandardGame),FALSE);
/* END ANNECY MT }*/
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
ACP_tdxBool fn_bGetIfCharacterIsInAlwaysActiveCharacterList(HIE_tdxHandleToSuperObject hCharacter)
{
/* ANNECY MT - 12/10/98 {*/
return (fn_bStandardGameIsAlwaysActive(M_GetMSHandle(hCharacter,StandardGame)));
/* END ANNECY MT }*/
}
tdxHandleToAlwaysActiveCharacterNode fn_hGetFirstAlwaysActiveCharNode()
{
return( LST2_M_DynamicGetFirstElement(&g_stEngineStructure.hAlwaysActiveCharactersList));
}
tdxHandleToAlwaysActiveCharacterNode fn_hGetNextAlwaysActiveCharNode(tdxHandleToAlwaysActiveCharacterNode hCharNode)
{
return( LST2_M_DynamicGetNextElement(hCharNode) );
}
#undef D_AlwAct_StructureDefine

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,73 @@
/*=========================================================================
* Caps.c : Capabilities.
* This is a part of the Game project.
*
* Version 1.0
* Creation date 29/01/98
* Author Fred "Bart" Compagnon
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1998
*=======================================================================*/
#include "ToolsCPA.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/Objects.h"
#include "Caps.h"
#include "InitEng.h"
#include "GameEng.h"
#include "ObjInit.h"
/**************************************************************************/
void fn_vSetCapabilities(struct tdstEngineObject_ *_p_stObject, unsigned long _ubf32Capabilities)
{
fn_vStandardGameSetCapabilities(_p_stObject->h_StandardGame, _ubf32Capabilities);
}
unsigned long fn_ulGetCapabilities(struct tdstEngineObject_ *_p_stObject)
{
return (fn_ulStandardGameGetCapabilities(_p_stObject->h_StandardGame));
}
void fn_vAddCapabilities(struct tdstEngineObject_ *_p_stObject, unsigned long _ubf32Capabilities)
{
fn_vStandardGameAddCapabilities(_p_stObject->h_StandardGame, _ubf32Capabilities);
}
void fn_vSubCapabilities(struct tdstEngineObject_ *_p_stObject, unsigned long _ubf32Capabilities)
{
fn_vStandardGameSubCapabilities(_p_stObject->h_StandardGame, _ubf32Capabilities);
}
void fn_vChangeCapabilities(struct tdstEngineObject_ *_p_stObject, unsigned long _ubf32Capabilities, long lValue)
{
switch (lValue)
{
case 0: /*add*/
case 2:
fn_vStandardGameAddCapabilities(_p_stObject->h_StandardGame, _ubf32Capabilities);
break;
case 1: /* set*/
case 3:
fn_vStandardGameSetCapabilities(_p_stObject->h_StandardGame, _ubf32Capabilities);
break;
case 4: /* sub*/
fn_vStandardGameSubCapabilities(_p_stObject->h_StandardGame, _ubf32Capabilities);
break;
case 5: /* erase*/
fn_vStandardGameSetCapabilities(_p_stObject->h_StandardGame, (unsigned long)0);
break;
}
}
/**************************************************************************/

View File

@@ -0,0 +1,33 @@
#ifndef D_THROW_ANIM_EFFECT
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vDoAnimEffect(
MS_tdxHandleToAnimEffect _hAnimEffect,
HIE_tdxHandleToSuperObject _p_stActorSuperObject,
unsigned long _ulChannelId,
HIE_tdxHandleToSuperObject _hModuleSuperObject
)
{
{
MTH3D_tdstVector stShift, stPosition, stShiftPhase, stShiftPlus, stShiftMax;
MTH_tdxReal xCurrentTime = (MTH_tdxReal) (g_stEngineStructure.stEngineTimer.ulCurrentTimerCount / 1000.0);
GEO_tdxHandleToMatrix hModuleLocalMatrix = HIE_fn_hGetSuperObjectMatrix(_hModuleSuperObject);
/*get the sinus phase: a phase for the time, plus an offset for each channel in the anim, all ponderated by the user coefs*/
stShiftPhase = fn_stAnimEffectGetShiftPhase(_hAnimEffect);
stShiftPlus = fn_stAnimEffectGetShiftPlus(_hAnimEffect);
MTH3D_M_vSetXofVector(&stShift, MTH_C_2Pi * (xCurrentTime / MTH3D_M_xGetXofVector(&stShiftPhase) + _ulChannelId / MTH3D_M_xGetXofVector(&stShiftPlus)));
MTH3D_M_vSetYofVector(&stShift, MTH_C_2Pi * (xCurrentTime / MTH3D_M_xGetYofVector(&stShiftPhase) + _ulChannelId / MTH3D_M_xGetYofVector(&stShiftPlus)));
MTH3D_M_vSetZofVector(&stShift, MTH_C_2Pi * (xCurrentTime / MTH3D_M_xGetZofVector(&stShiftPhase) + _ulChannelId / MTH3D_M_xGetZofVector(&stShiftPlus)));
/*now compute the displacement, ponderated by the user coefs. It is expressed in the actor's local coordinates*/
stShiftMax = fn_stAnimEffectGetShiftMax(_hAnimEffect);
MTH3D_M_vSetXofVector(&stShift, MTH_M_xSin(MTH3D_M_xGetXofVector(&stShift)) * MTH3D_M_xGetXofVector(&stShiftMax));
MTH3D_M_vSetYofVector(&stShift, MTH_M_xSin(MTH3D_M_xGetYofVector(&stShift)) * MTH3D_M_xGetYofVector(&stShiftMax));
MTH3D_M_vSetZofVector(&stShift, MTH_M_xSin(MTH3D_M_xGetZofVector(&stShift)) * MTH3D_M_xGetZofVector(&stShiftMax));
/*now move the object: modify the global translation matrix of the module*/
POS_fn_vGetTranslationVector(hModuleLocalMatrix, &stPosition);
MTH3D_M_vAddVector(&stPosition, &stPosition, &stShift);
POS_fn_vSetTranslationVector(hModuleLocalMatrix, &stPosition);
}
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#endif /* D_THROW_ANIM_EFFECT */

View File

@@ -0,0 +1,702 @@
#define PO_FRIEND
#define HieFriend
#define ENV_FRIEND
#define D_State_Define
#include "ToolsCPA.h"
#include "Mor.h" /* AR980213*/
#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 "Structur/State.h"
#include "Basic.h"
#include "GameEng.h"
#include "ObjInit.h"
#include "ZeMem.h"
#include "ToolMatr.h"
/* anim interpolated*/
#include "ChanList.h"
#include "PlayAnim/Interpol/a3x_intn.h"
#include "playanim\playanim.h"
#include "prf.h"
#if defined (ACTIVE_EDITOR) || defined (RETAIL)
#define ENGassert(param)
#else
#define ENGassert(param) assert(param)
#endif
/*-----------------------------------------------------------------------------
* Description : Return the channel which contains a SO
*-----------------------------------------------------------------------------
* Input : Handle to the list
Handle to the SO
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 25/03/97 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
unsigned short fn_uwGetChannelOfSuperObject(CHN_tdxHandleToChannelArray hChannelArray, HIE_tdxHandleToSuperObject hSO, unsigned long ulNumberOfChannels)
{
unsigned short i;
for (i=0; i < ulNumberOfChannels; i++)
{
if (hChannelArray[i].hSupObject == hSO)
return i;
}
/* The SO isn't found*/
return C_ucUnknownChannel;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*-----------------------------------------------------------------------------
* Description : Init a CHN_tdxHandleToCSOList list.
*-----------------------------------------------------------------------------
* Input : Pointer on the handle to the list
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 25/03/97 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vInitCSOList(CHN_tdxHandleToChannelArray *p_hChannelArray, unsigned long ulNumberOfChannels)
{
unsigned long ulI;
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeCSO , 0 );
*p_hChannelArray = (CHN_tdxHandleToChannelArray)TMP_M_p_Malloc(sizeof(tdstAChannel) * ulNumberOfChannels);
/* memset(*p_hChannelArray,0,sizeof(tdstAChannel) * ulNumberOfChannels); AR9904 Already done in the alloc function */
for ( ulI = 0 ; ulI < ulNumberOfChannels ; ulI ++ )
( * p_hChannelArray ) [ ulI ] . bActiveChannel = TRUE ;
#if defined(USE_PROFILER) && !defined(PRESS_DEMO)
if (PRF_fn_lIncIndependantVariable(PRF_C_ulIdpNbAllocCHA,ulNumberOfChannels) > PRF_fn_lGetIndependantVariable(PRF_C_ulIdpNbMaxAllocCHA))
{
PRF_fn_vSetIndependantVariable(PRF_C_ulIdpNbMaxAllocCHA,PRF_fn_lGetIndependantVariable(PRF_C_ulIdpNbAllocCHA));
}
#endif
}
/*-----------------------------------------------------------------------------
* Description : Free a CHN_tdxHandleToCSOList list.
*-----------------------------------------------------------------------------
* Input : Pointer on the handle to the list
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 16/08/97 Author : Sebastien DAVID (Gizmo)
*---------------------------------------------------------------------------*/
void fn_vFreeCSOList(CHN_tdxHandleToChannelArray *p_hChannelArray/*, unsigned long ulNumberOfChannels*/)
{
/* unsigned long i;*/
CHN_tdxHandleToChannelArray hArray;
#ifndef RETAIL
long lSize;
#endif
hArray = *p_hChannelArray;
if (hArray == NULL)
return;
#ifndef RETAIL
lSize = *(((long*)hArray)-1);
lSize *= 4;
lSize /= sizeof(tdstAChannel);
#endif RETAIL
/* if(hArray == NULL) return; AR9903 Already done ! */
/* for (i=0; i<ulNumberOfChannels; i++)
{
// clean the channels control matrix
if (hArray[i].hControlMatrix)
{
TMP_M_Free(hArray[i].hControlMatrix);
hArray[i].hControlMatrix = NULL;
}
}
*/ /* and delete the array*/
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeCSO , 0 );
TMP_M_Free(hArray);
hArray = NULL;
PRF_fn_lIncIndependantVariable(PRF_C_ulIdpNbAllocCHA,-lSize);
}
/*-----------------------------------------------------------------------------
* Description : Take the control of a channel. There are 2 types of controls:
* The modifications could added to the local matrix, or they could overloaded it
*-----------------------------------------------------------------------------
* Input : The SO of the character
* The channel number
* The type of control
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 27/03/97 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : 02 Apr 98 Modification Author : B. Bermain ANNECY BBB
* Modifications : the UCCList no longer exists: a channel is controlled when the CSO element has a valid handle on an additional matrix
*---------------------------------------------------------------------------*/
void fn_vTakeControlOfChannel(struct tdstEngineObject_ *_hActor, unsigned short _uwChannel, ACP_tdxBool _bControlled)
{
/* Recover the CSO list of the character*/
unsigned long ulNbChannels ;
MS_tdxHandleTo3dData hCurrent3dData = _hActor->h_3dData;
CHN_tdxHandleToChannelArray hChannelArray = fn_h3dDataGetChannelSOList(hCurrent3dData);
if (hChannelArray == NULL)
{
return;
}
ulNbChannels = fn_ul3dDataGetNumberOfChannels(hCurrent3dData) ;
if (_uwChannel != 0xffff)
{
ENGassert(_uwChannel >= 0 && _uwChannel < ulNbChannels );
/* loose control of one channel*/
hChannelArray[_uwChannel].bControlledChannel = _bControlled;
}
else
{
/* loose control of all channels*/
tdstAChannel *p_stChannel ;
unsigned long ulI ;
for ( ulI = 0 , p_stChannel = hChannelArray ; ulI < ulNbChannels ; ulI ++ , p_stChannel ++ )
{
p_stChannel->bControlledChannel = _bControlled;
}
}
}
/*-----------------------------------------------------------------------------
* Description : activate a channel
*-----------------------------------------------------------------------------
* Input : The SO of the character
* The channel number
* Output : None
*---------------------------------------------------------------------------*/
void fn_vUpdateSPOFlagsOfChannelForActivation(HIE_tdxHandleToSuperObject _hSOChannel, ACP_tdxBool _bActivate)
{
unsigned long ulSpoFlags ;
if ( _hSOChannel )
{
ulSpoFlags = HIE_M_xGetSuperObjectMember(_hSOChannel , ulFlags);
if ( _bActivate )
{
/* it becomes pickable, visible and shadowable */
HIE_M_vSetSuperObjectMember(_hSOChannel , ulFlags, ulSpoFlags & ~ ( HIE_C_Flag_ulNotPickable | HIE_C_Flag_ulHidden | HIE_C_Flag_ulNoShadowOnMe ) ) ;
}
else
{
/* it becomes not pickable, visible or shadowable */
HIE_M_vSetSuperObjectMember(_hSOChannel , ulFlags, ulSpoFlags | HIE_C_Flag_ulNotPickable | HIE_C_Flag_ulHidden | HIE_C_Flag_ulNoShadowOnMe ) ;
}
}
}
void fn_vActivateChannel(HIE_tdxHandleToSuperObject _hPerso , unsigned short _uwChannel , ACP_tdxBool _bActivate )
{
MS_tdxHandleTo3dData h_3dData = M_GetMSHandle(_hPerso,3dData);
tdstAChannel *p_stChannel ;
HIE_tdxHandleToSuperObject hModule ;
/* Recover the CSO list of the character*/
unsigned long ulNbChannels ;
CHN_tdxHandleToChannelArray hChannelArray = fn_h3dDataGetChannelSOList(h_3dData);
if (hChannelArray == NULL)
{
return;
}
ulNbChannels = fn_ul3dDataGetNumberOfChannels(h_3dData) ;
if (_uwChannel != 0xffff)
{
ENGassert(_uwChannel >= 0 && _uwChannel < ulNbChannels );
/* loose control of one channel*/
p_stChannel = & hChannelArray [ _uwChannel ] ;
p_stChannel -> bActiveChannel = _bActivate ;
hModule = p_stChannel -> hZoomSupObject ? p_stChannel -> hZoomSupObject : p_stChannel -> hSupObject ;
fn_vUpdateSPOFlagsOfChannelForActivation ( hModule , _bActivate ) ;
#ifndef U64
#ifndef RETAIL
DEMO_fn_vSaveCanalActivationDesactivation ( _hPerso , ( unsigned char ) _uwChannel , _bActivate ) ;
#endif /* RETAIL */
#endif
}
else
{
/* loose control of all channels*/
unsigned long ulI ;
for ( ulI = 0 , p_stChannel = hChannelArray ; ulI < ulNbChannels ; ulI ++ , p_stChannel ++ )
{
p_stChannel = & hChannelArray [ ulI ] ;
p_stChannel -> bActiveChannel = _bActivate ;
hModule = p_stChannel -> hZoomSupObject ? p_stChannel -> hZoomSupObject : p_stChannel -> hSupObject ;
fn_vUpdateSPOFlagsOfChannelForActivation ( hModule , _bActivate ) ;
#ifndef U64
#ifndef RETAIL
DEMO_fn_vSaveCanalActivationDesactivation ( _hPerso , ( unsigned char ) _uwChannel , _bActivate ) ;
#endif /* RETAIL */
#endif
}
}
}
/*-----------------------------------------------------------------------------
* Description : deactivate a channel
*-----------------------------------------------------------------------------
* Input : The SO of the character
* The channel number
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 27/03/97 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : 02 Apr 98 Modification Author : B. Germain ANNECY BBB
* Modifications : - the UCC list no longer exists, it is replaced by a handle to the control matrix in the CSO element
- if uwChannel == 0xFFF, all controlled channels are released
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC 04/06/99 */
void fn_vDeactivateChannel(struct tdstEngineObject_ *_hActor, unsigned short _uwChannel)
{
/* Recover the CSO list of the character*/
unsigned long ulNbChannels ;
MS_tdxHandleTo3dData hCurrent3dData = _hActor->h_3dData;
CHN_tdxHandleToChannelArray hChannelArray = fn_h3dDataGetChannelSOList(hCurrent3dData);
if (hChannelArray == NULL)
{
return;
}
ulNbChannels = fn_ul3dDataGetNumberOfChannels(hCurrent3dData) ;
if (_uwChannel != 0xffff)
{
ENGassert(_uwChannel >= 0 && _uwChannel < ulNbChannels );
/* loose control of one channel*/
hChannelArray[_uwChannel].bActiveChannel = FALSE;
}
else
{
/* loose control of all channels*/
tdstAChannel *p_stChannel ;
unsigned long ulI ;
for ( ulI = 0 , p_stChannel = hChannelArray ; ulI < ulNbChannels ; ulI ++ , p_stChannel ++ )
{
p_stChannel->bActiveChannel = FALSE;
}
}
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC 04/06/99 */
/*
if (_uwChannel != 0xffff && hChannelArray[_uwChannel].hControlMatrix)
{
// only one channel is requested
// and it is controled, so loose control
if (hChannelArray[_uwChannel].hSupObject)
{
// update the matrix if we release an active channel !!
// if the channel is not active, its matrix is NULL anyway...
// find and give back the animation element matrix to the superobject
// (that would otherwise reference a nonexistent matrix, ARGH!!!
tdstState *p_stCurrentState = fn_h3dDataGetCurrentState(hCurrent3dData);
if ( p_stCurrentState )
{
struct tdstAnim3d_ *p_stCurrentAnim = p_stCurrentState->p_stAnim;
if ( p_stCurrentAnim )
{
struct tdstFrame3d_ *p_stCurrentFrame3d = fn_p_GetFramesAddress(p_stCurrentAnim,fn_uw3dDataGetCurrentFrame(hCurrent3dData),g_stEngineStructure.stEngineTimer.ulTrameNumber,(void*)fn_h_StandardGameGetSuperObject(_hActor->h_StandardGame));
if ( p_stCurrentFrame3d )
{
struct tdstElement3d_ *p_stCurrentElement3d, *p_stStopElt3d;
p_stCurrentElement3d = p_stCurrentFrame3d->p_stArrayOfElts3d;
p_stStopElt3d = p_stCurrentElement3d + p_stCurrentAnim->ucMaxNumberOfElements;
// look for the 3d element that correspond to the channel that must be released
while (p_stCurrentElement3d != p_stStopElt3d)
{
if (p_stCurrentElement3d->ucChannelNumber == _uwChannel)
{
HIE_fn_vSetSuperObjectMatrix(hChannelArray[_uwChannel].hSupObject, p_stCurrentElement3d->stMatrix);
break;
}
p_stCurrentElement3d++;
}
}
}
}
}
//destroy the control matrix
TMP_M_Free(hChannelArray[_uwChannel].hControlMatrix);
//clear the handle in the CSO element
hChannelArray[_uwChannel].hControlMatrix = NULL;
}
else if (_uwChannel == 0xffff)
{
// loose control of all channels
tdstState *p_stCurrentState = fn_h3dDataGetCurrentState(hCurrent3dData);
//and give back the animation element matrix to the superobject (that would otherwise reference a nonexistent matrix, ARGH!!!
if ( p_stCurrentState )
{
struct tdstAnim3d_ *p_stCurrentAnim = p_stCurrentState->p_stAnim;
if ( p_stCurrentAnim )
{
struct tdstFrame3d_ *p_stCurrentFrame3d = fn_p_GetFramesAddress(p_stCurrentAnim,fn_uw3dDataGetCurrentFrame(hCurrent3dData),g_stEngineStructure.stEngineTimer.ulTrameNumber,(void*)fn_h_StandardGameGetSuperObject(_hActor->h_StandardGame));
if ( p_stCurrentFrame3d )
{
struct tdstElement3d_ *p_stCurrentElement3d, *p_stStopElt3d;
p_stCurrentElement3d = p_stCurrentFrame3d->p_stArrayOfElts3d;
p_stStopElt3d = p_stCurrentElement3d + p_stCurrentAnim->ucMaxNumberOfElements;
// look for the 3d element that correspond to the channel that must be released
while (p_stCurrentElement3d != p_stStopElt3d)
{
if (p_stCurrentElement3d->ucChannelNumber != C_ucUnknownChannel)
{
if (hChannelArray[p_stCurrentElement3d->ucChannelNumber].hControlMatrix)
{
if (hChannelArray[p_stCurrentElement3d->ucChannelNumber].hSupObject )
{
HIE_fn_vSetSuperObjectMatrix(hChannelArray[p_stCurrentElement3d->ucChannelNumber].hSupObject, p_stCurrentElement3d->stMatrix);
}
//destroy the control matrix
TMP_M_Free(hChannelArray[p_stCurrentElement3d->ucChannelNumber].hControlMatrix);
//clear the handle in the CSO element
hChannelArray[p_stCurrentElement3d->ucChannelNumber].hControlMatrix = NULL;
}
}
p_stCurrentElement3d++;
}
}
}
}
}
}
*/
#include "ChanLis1.cxx"
/*-----------------------------------------------------------------------------
* Description : Update the matrix of the controled channels of a character
*-----------------------------------------------------------------------------
* Input : The SO of the character
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 27/03/97 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : 08/07/97 Modification Author : CGHT
* Modifications : Bug correction for absolute mode.
*---------------------------------------------------------------------------*/
/*void fn_vUpdateMatrixOfControledChannels(struct tdstEngineObject_ *_hActor)
{
// tdstAChannel *p_stChannel;
// this function is not of any use now, because matrix, controlled or not, are automatically updated...
// Recover the CSO list of the character
MS_tdxHandleTo3dData hCurrent3dData;
CHN_tdxHandleToChannelArray hChannelArray;
// some variables to scan the CSO list
unsigned long i;
POS_tdstCompletePosition *hSource, *hDest;
MS_tdxHandleToAnimEffect hAnimEffect;
hCurrent3dData = _hActor->h_3dData;
hChannelArray = fn_h3dDataGetChannelSOList(hCurrent3dData);
if (!hChannelArray)
return;
hAnimEffect = _hActor->h_AnimEffect;
p_stChannel = fn_h3dDataGetFirstActiveChannel(hCurrent3dData);
i=0;
while (p_stChannel)
{
if (p_stChannel->hControlMatrix)
{
hDest = p_stChannel->hControlMatrix;
hSource = HIE_fn_hGetSuperObjectMatrix(p_stChannel->hSupObject);
if ( hSource != hDest ) //if we did not already do it
{
//copy the current matrix in the control matrix
POS_fn_vCopyMatrix(hDest, hSource);
// and give the control matrix to the superobject
HIE_fn_vSetSuperObjectMatrix(p_stChannel->hSupObject, hDest);
}
// if there is an animeffect structure
if ( hAnimEffect )
{
//perform the effects on the controlled channel
fn_vDoAnimEffect(hAnimEffect, M_GetSuperObject(_hActor), i, p_stChannel->hSupObject);
}
}
i++;
p_stChannel = p_stChannel->p_stNextActiveChannel;
}
}*/
/*-----------------------------------------------------------------------------
* Description : Create a Morph element
*-----------------------------------------------------------------------------
* Input : None
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 12/2/97 Author : alexander
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
tdstMorphChannelList* fn_p_stCreateMorphListElement()
{
tdstMorphChannelList * p_stMorphList;
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeMorphChannelList , 0 );
p_stMorphList= (tdstMorphChannelList *) TMP_M_p_Malloc (sizeof (tdstMorphChannelList));
LST2_M_DynamicInitElement (p_stMorphList);
return p_stMorphList;
}
/*-----------------------------------------------------------------------------
* Description : Free a Morph Channel element
*-----------------------------------------------------------------------------
* Input : None
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 12/1/97 Author : alexander
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vFreeMorphListElement(tdstMorphChannelList * p_stMorphList)
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeMorphChannelList , 0 );
TMP_M_Free(p_stMorphList);
}
/*-----------------------------------------------------------------------------
* Description : Init a CHN_tdxHandleToMorphList list.
*-----------------------------------------------------------------------------
* Input : Pointer on the handle to the list
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 12/2/97 Author : alexander
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vInitMorphList(CHN_tdxHandleToMorphList *p_hMorphList)
{
if( *p_hMorphList != NULL )
return;
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeMorphList , 0 );
* p_hMorphList = (CHN_tdxHandleToMorphList) TMP_M_p_Malloc (sizeof (LST2_M_DynamicAnchorDeclaration(CHN_tdxHandleToMorphElement)));
LST2_M_DynamicInitAnchor(*p_hMorphList);
}
/*-----------------------------------------------------------------------------
* Description : Free a CHN_tdxHandleToMorphList list.
*-----------------------------------------------------------------------------
* Input : Pointer on the handle to the list
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 12/1/97 Author : alexander
*---------------------------------------------------------------------------*/
void fn_vFreeMorphList(CHN_tdxHandleToMorphList *p_hMorphList)
{
if( *p_hMorphList == NULL ) return;
while( LST2_M_DynamicGetNumberOfElements(*p_hMorphList) > 0 )
{
/* get head*/
tdstMorphChannelList *p_hMorphElt = LST2_M_DynamicGetFirstElement(*p_hMorphList);
/* isolate*/
LST2_M_DynamicIsolate(p_hMorphElt);
/* free*/
fn_vFreeMorphListElement(p_hMorphElt);
}
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeMorphList , 0 );
TMP_M_Free(*p_hMorphList);
*p_hMorphList = NULL;
}
/*-----------------------------------------------------------------------------
* Description : Add/change the Morphelement to/of a channel
*-----------------------------------------------------------------------------
* Input : Handle to the list
Channel number
Handle to the physical object
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 12/1/97 Author : Alexander
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vPutMorphElementInChannel(CHN_tdxHandleToMorphList hMorphList,unsigned short uwChannel,ACP_tdxIndex IndexOfMorphList)
{
tdstMorphChannelList *p_stMorph,*p_stMorph2;
unsigned short uwIndex,uwNumOfElts;
/*FB190898 */
if (!hMorphList) return;
/*ENDFB*/
uwNumOfElts=(unsigned short)LST2_M_DynamicGetNumberOfElements(hMorphList);
LST2_M_DynamicForEachElementOf(hMorphList,p_stMorph2,uwIndex)
{
if (p_stMorph2->uwChannelNumber==uwChannel)
/* If the channel is already active*/
{ p_stMorph2->MorphListIndex=IndexOfMorphList;
break;
}
if (p_stMorph2->uwChannelNumber>uwChannel)
/* The channel will be included before the current channel*/
{ break;
}
}
if (!p_stMorph2)
/* If the channel doesn't already active (and end of the list reached)*/
{
p_stMorph=fn_p_stCreateMorphListElement();
p_stMorph->uwChannelNumber=uwChannel;
p_stMorph->MorphListIndex=IndexOfMorphList;
LST2_M_DynamicAddTail(hMorphList,p_stMorph);
}
else
{
if (p_stMorph2->uwChannelNumber!=uwChannel)
/* If the channel doesn't already active*/
{
p_stMorph=fn_p_stCreateMorphListElement();
p_stMorph->uwChannelNumber=uwChannel;
p_stMorph->MorphListIndex=IndexOfMorphList;
LST2_M_DynamicInsertBetween(p_stMorph,LST2_M_DynamicGetPrevElement(p_stMorph2),p_stMorph2);
}
}
}
/*-----------------------------------------------------------------------------
* Description : Remove a channel from the list
*-----------------------------------------------------------------------------
* Input : Handle to the list
Channel number
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 12/2/97 Author : Alexander
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vRemoveChannelFromMorphList(CHN_tdxHandleToMorphList hMorphList,unsigned short uwChannel)
{
tdstMorphChannelList *p_stMorph,*p_stMorph_Next;
unsigned short uwIndex;
/*FB190898 */
if (!hMorphList) return;
/*ENDFB*/
LST2_M_DynamicForEachMovingElementOf(hMorphList,p_stMorph,p_stMorph_Next,uwIndex)
{
if (p_stMorph->uwChannelNumber==uwChannel)
{
if (!LST2_M_DynamicGetNumberOfElements(hMorphList)) break;
LST2_M_DynamicIsolate(p_stMorph);
fn_vFreeMorphListElement(p_stMorph);
break;
}
}
}
/*-----------------------------------------------------------------------------
* Description : Return the MorphListIndex corresponding to a channel
*-----------------------------------------------------------------------------
* Input : Handle to the list
Channel number
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 03/25/97 Author : Alexander
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
ACP_tdxIndex fn_hMorphListIndex(CHN_tdxHandleToMorphList hMorphList,unsigned short uwChannel)
{
tdstMorphChannelList *p_stMorph;
unsigned short uwIndex;
/*FB190898 */
if (!hMorphList) return -1;
/*ENDFB*/
LST2_M_DynamicForEachElementOf(hMorphList,p_stMorph,uwIndex)
{
if (p_stMorph->uwChannelNumber==uwChannel)
/* If the channel is found*/
{ return p_stMorph->MorphListIndex;
}
if (p_stMorph->uwChannelNumber>uwChannel)
/* The channel doesn't exist*/
{ return -1;
}
}
/* The channel doesn't exist*/
return -1;
}
/*-----------------------------------------------------------------------------
* Description : Return the PO currently morphed in a specific channel, NULL if none
*-----------------------------------------------------------------------------
* Input : Handle to the list
Channel number
* Output : PO
*-----------------------------------------------------------------------------
* Creation date : 01/27/98 Author : Alexis Vaisse
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
PO_tdxHandleToPhysicalObject fn_hGetMorphedObjectInChannel (CHN_tdxHandleToMorphList hMorphList,unsigned short uwChannel)
{
ACP_tdxIndex xIndex = fn_hMorphListIndex(hMorphList, uwChannel);
return xIndex != -1 ? MOR_fn_hGetMorphedObject (xIndex) : NULL;
}

View File

@@ -0,0 +1,481 @@
/*=========================================================================
* Clock.c : This module contain all engine clock's functions
* This is a part of the Game project.
*
* Version 1.0
* Creation date 31/10/96
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1996
*=======================================================================*/
//#define DEMO
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Structur/EngMode.h"
#include "Clock.h"
/*HP 051098*/
#ifdef U64
#include "INO.h"
#define FORCE_FRAME_RATE
#define FORCED_FRAME_DURATION 50L
#else
#include "PRF.h"
extern u_long fn_ulTimerTickPerSecond(short wTimerType);
extern unsigned long GLI_g_ulFrameLength;
extern unsigned long fn_ulTimerCpuClock (void);
#endif /* U64 */
/*************** FabPerez Cheat Code *******/
#if defined (WIN32) && defined (_DEBUG)
#ifndef CHEAT_CODE_DELTA_TIME
#define CHEAT_CODE_DELTA_TIME 1
#endif
#ifndef PRF_C_lMaxNbCheatCodeVariable
#define PRF_C_lMaxNbCheatCodeVariable 3
#endif
extern BOOL g_CheatCodeActivate;
extern unsigned long g_ulCurrentCheatCode;
extern BOOL a_lCheatCodeVariable[PRF_C_lMaxNbCheatCodeVariable];
extern void (*a_p_fnCheatCodeFonction[PRF_C_lMaxNbCheatCodeVariable])(BOOL);
void (*p_fn)(BOOL);
#endif //(WIN32) & (DEBUG)
/************ Fin FabPerez Cheat Code **********/
/*-----------------------------------------------------------------------------
* Description : First Initialize the clock structure
*-----------------------------------------------------------------------------
* Input : void
* Output : void
*-----------------------------------------------------------------------------
* Creation date : 31/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vFirstInitEngineClock()
{
/**** Initialize the timer library ****/
fn_wTimerInitLibrary();
/**** Initialize the game timer ****/
#ifdef U64
g_stEngineStructure.stEngineTimer.sTimerHandle = fn_wTimerCreate(C_wTimerFrequencyLow);
#else
g_stEngineStructure.stEngineTimer.sTimerHandle = fn_wTimerCreate(C_wTimerFrequencyMedium);
g_stEngineStructure.stEngineTimer.ulTickPerMS = fn_ulTimerTickPerSecond(C_wTimerFrequencyMedium) / 1000;
#endif
}
/*-----------------------------------------------------------------------------
* Description : Initialize frame length
*-----------------------------------------------------------------------------
* Input : void
* Output : void
*-----------------------------------------------------------------------------
* Creation date : 02/03/99 Author : Jacques Th<54>noz
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vInitFrameLenght (void)
{
#ifdef U64
if (osTvType == 0) /* PAL */
g_stEngineStructure.stEngineTimer.xFrameLength = MTH_M_xDoubleToReal(1./50.);
else /* NTSC OR MPAL */
g_stEngineStructure.stEngineTimer.xFrameLength = MTH_M_xDoubleToReal(1./60.);
#else
/* g_stEngineStructure.stEngineTimer.xFrameLength = MTH_M_xDiv ( MTH_M_xDoubleToReal(GLI_g_ulFrameLength) , MTH_M_xDoubleToReal(fn_ulTimerCpuClock()) ); */
g_stEngineStructure.stEngineTimer.xFrameLength = MTH_M_xDiv( MTH_M_xLongToReal( GLI_g_ulFrameLength ), MTH_M_xLongToReal( fn_ulTimerTickPerSecond( C_wTimerFrequencyMedium ) ) );
#endif
}
/*-----------------------------------------------------------------------------
* Description : Last Desinitialize the clock structure
*-----------------------------------------------------------------------------
* Input : void
* Output : void
*-----------------------------------------------------------------------------
* Creation date : 31/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_
void fn_vLastDesinitEngineClock()
{
/**** Initialize the game timer ****/
fn_wTimerDestroy(g_stEngineStructure.stEngineTimer.sTimerHandle);
/**** desinitialize the timer library ****/
fn_wTimerExitLibrary();
}
#endif /* _FIRE_DEADCODE_U64_ */
/*-----------------------------------------------------------------------------
* Description : Initialize the clock structure (When game start)
*-----------------------------------------------------------------------------
* Input : void
* Output : void
*-----------------------------------------------------------------------------
* Creation date : 31/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vReinitEngineClock()
{
/**** Initialize the game timer ****/
/* g_stEngineStructure.stEngineTimer.sTimerHandle = fn_wTimerCreate(C_wTimerFrequencyLow);*/
}
/*-----------------------------------------------------------------------------
* Description : Desinitialize the clock structure (When game stop)
*-----------------------------------------------------------------------------
* Input : void
* Output : void
*-----------------------------------------------------------------------------
* Creation date : 31/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC 07/06/99 */
void fn_vRedesinitEngineClock()
{
/**** Initialize the game timer ****/
/* fn_wTimerDestroy(g_stEngineStructure.stEngineTimer.sTimerHandle);*/
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC 07/06/99 */
/*-----------------------------------------------------------------------------
* Description : determines the time
* of the current frame
*-----------------------------------------------------------------------------
* Input : void
* Output : Time (in milliseconds)
*-----------------------------------------------------------------------------
* Creation date : 21/04/97 Author : Frederic
*-----------------------------------------------------------------------------
* Modification date : 13/11/98 Modification Author : YLT
* Modifications : Change MaxMilliSecondsPerFrame to 133 (8 frames)
*---------------------------------------------------------------------------*/
#define C_MinMilliSecondsPerFrame (unsigned long)16
#define C_MaxMilliSecondsPerFrame (unsigned long)133
unsigned long fn_ulDetermineUsefulDT()
{
unsigned long ulResult;
ulResult = g_stEngineStructure.stEngineTimer.ulDeltaTimerCount;
if(ulResult < C_MinMilliSecondsPerFrame)
ulResult = C_MinMilliSecondsPerFrame;
else if(ulResult > C_MaxMilliSecondsPerFrame)
ulResult = C_MaxMilliSecondsPerFrame;
return ulResult;
}
/*-----------------------------------------------------------------------------
* Description : Start the clock structure (When level start)
*-----------------------------------------------------------------------------
* Input : void
* Output : void
*-----------------------------------------------------------------------------
* Creation date : 31/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vStartEngineClock()
{
unsigned long i;
struct _stTimerCount stCurrentTimerCount; /**** Current trame timer ****/
#ifdef U64
int iDemoMode;
#endif
/**** Start the timer ****/
fn_wTimerReset(g_stEngineStructure.stEngineTimer.sTimerHandle);
fn_wTimerStart(g_stEngineStructure.stEngineTimer.sTimerHandle);
fn_wTimerRead(g_stEngineStructure.stEngineTimer.sTimerHandle,&stCurrentTimerCount);
#ifdef U64
fn_vSaveEngineClock();
g_stEngineStructure.stEngineTimer.ulCurrentTimerCount = stCurrentTimerCount.m_ulLowPart;
iDemoMode=INO_fn_iU64UseDemoClock();
if(iDemoMode==INO_U64_BeginDemoPlayMode || iDemoMode==INO_U64_BeginDemoRecordMode)
{
g_stEngineStructure.stEngineTimer.ulUsefulDeltaTime=FORCED_FRAME_DURATION;
g_stEngineStructure.stEngineTimer.ulCurrentTimerCount=0;
}
else
g_stEngineStructure.stEngineTimer.ulUsefulDeltaTime = fn_ulDetermineUsefulDT();
#else
g_stEngineStructure.stEngineTimer.stRealTimeCount = stCurrentTimerCount;
g_stEngineStructure.stEngineTimer.ulCurrentTimerCount = stCurrentTimerCount.m_ulLowPart / g_stEngineStructure.stEngineTimer.ulTickPerMS;
g_stEngineStructure.stEngineTimer.ulUsefulDeltaTime = fn_ulDetermineUsefulDT();
#endif
/**** Trame counter ****/
g_stEngineStructure.stEngineTimer.ulTrameNumber = 1;
/**** Clear all clock ****/
g_stEngineStructure.stEngineTimer.a_ulCounter[0] = 1;
for (i=1;i<C_NumberOfCounter;i++)
g_stEngineStructure.stEngineTimer.a_ulCounter[i] = 0;
}
/*-----------------------------------------------------------------------------
* Description : Stop the clock structure (When level start)
*-----------------------------------------------------------------------------
* Input : void
* Output : void
*-----------------------------------------------------------------------------
* Creation date : 31/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vStopEngineClock()
{
/**** Stop the timer ****/
fn_wTimerStop(g_stEngineStructure.stEngineTimer.sTimerHandle);
}
/*-----------------------------------------------------------------------------
* Description : Actualize the clock structure (In game loop)
*-----------------------------------------------------------------------------
* Input : void
* Output : void
*-----------------------------------------------------------------------------
* Creation date : 31/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vActualizeEngineClock()
{
unsigned long i;
struct _stTimerCount stCurrentTimerCount; /**** Current trame timer ****/
#ifdef U64
int iDemoMode;
#else
unsigned long ulDeltaTime;
#endif
/**** Trame counter ****/
g_stEngineStructure.stEngineTimer.ulTrameNumber++;
/**** Time counter (in ms) ****/
#ifdef U64
#ifndef FORCE_FRAME_RATE
fn_wTimerRead(g_stEngineStructure.stEngineTimer.sTimerHandle,&stCurrentTimerCount);
#else /* FORCE_FRAME_RATE*/
iDemoMode=INO_fn_iU64UseDemoClock();
if(iDemoMode==INO_U64_BeginDemoPlayMode || iDemoMode==INO_U64_BeginDemoRecordMode)
{
stCurrentTimerCount.m_ulLowPart=g_stEngineStructure.stEngineTimer.ulCurrentTimerCount + FORCED_FRAME_DURATION;
g_stEngineStructure.stEngineTimer.ulDeltaTimerCount=FORCED_FRAME_DURATION;
}
else if(iDemoMode==INO_U64_DemoPlayMode) {
g_stEngineStructure.stEngineTimer.ulDeltaTimerCount=
INO_fn_ulGetDemoTimeDelta();
stCurrentTimerCount.m_ulLowPart=g_stEngineStructure.stEngineTimer.ulCurrentTimerCount + g_stEngineStructure.stEngineTimer.ulDeltaTimerCount;
}
else
{
fn_wTimerRead(g_stEngineStructure.stEngineTimer.sTimerHandle,&stCurrentTimerCount);
if (stCurrentTimerCount.m_ulLowPart<g_stEngineStructure.stEngineTimer.ulCurrentTimerCount)
g_stEngineStructure.stEngineTimer.ulDeltaTimerCount = (unsigned long)(-(long)(stCurrentTimerCount.m_ulLowPart-g_stEngineStructure.stEngineTimer.ulCurrentTimerCount));
else
g_stEngineStructure.stEngineTimer.ulDeltaTimerCount = (stCurrentTimerCount.m_ulLowPart-g_stEngineStructure.stEngineTimer.ulCurrentTimerCount);
#ifdef DEMO
if(iDemoMode==INO_U64_DemoRecordMode)
{
if(g_stEngineStructure.stEngineTimer.ulDeltaTimerCount>0xFFL)
{
ASM_BREAK;
osSyncPrintf("frame duration doesn't fit on one char \n");
}
INO_fn_vSetDemoTimeDelta((long)g_stEngineStructure.stEngineTimer.ulDeltaTimerCount);
}
#endif
}
#endif /* FORCE_FRAME_RATE*/
g_stEngineStructure.stEngineTimer.ulCurrentTimerCount = stCurrentTimerCount.m_ulLowPart;
#else /* U64*/
/*************** FabPerez Cheat Code *******/
#if defined (WIN32) && defined (_DEBUG)
if(g_CheatCodeActivate)
{
p_fn = a_p_fnCheatCodeFonction[CHEAT_CODE_DELTA_TIME];
(*p_fn)(a_lCheatCodeVariable[CHEAT_CODE_DELTA_TIME]);
if(g_ulCurrentCheatCode == 0) g_CheatCodeActivate = FALSE;
}
#endif //(WIN32) & (DEBUG)
/************ Fin FabPerez Cheat Code **********/
fn_wTimerRead(g_stEngineStructure.stEngineTimer.sTimerHandle,&stCurrentTimerCount);
if ( stCurrentTimerCount.m_ulHighPart == g_stEngineStructure.stEngineTimer.stRealTimeCount.m_ulHighPart )
{
ulDeltaTime = stCurrentTimerCount.m_ulLowPart - g_stEngineStructure.stEngineTimer.stRealTimeCount.m_ulLowPart;
}
else
{
if ( stCurrentTimerCount.m_ulLowPart >= g_stEngineStructure.stEngineTimer.stRealTimeCount.m_ulLowPart )
ulDeltaTime = stCurrentTimerCount.m_ulLowPart - g_stEngineStructure.stEngineTimer.stRealTimeCount.m_ulLowPart;
else
{
ulDeltaTime = stCurrentTimerCount.m_ulLowPart + (0xffffffff - g_stEngineStructure.stEngineTimer.stRealTimeCount.m_ulLowPart + 1);
}
}
g_stEngineStructure.stEngineTimer.ulDeltaTimerCount = ulDeltaTime / g_stEngineStructure.stEngineTimer.ulTickPerMS;
g_stEngineStructure.stEngineTimer.stRealTimeCount = stCurrentTimerCount;
g_stEngineStructure.stEngineTimer.ulCurrentTimerCount += g_stEngineStructure.stEngineTimer.ulDeltaTimerCount;
#endif
/* PRF_fn_vSetIndependantVariable (PRF_C_ulIdpDeltaTime , g_stEngineStructure.stEngineTimer.ulDeltaTimerCount);*/
g_stEngineStructure.stEngineTimer.ulUsefulDeltaTime = fn_ulDetermineUsefulDT();
/* FON_fn_vSetElapsedTime(g_stEngineStructure.stEngineTimer.ulUsefulDeltaTime);*/
/**** All clock ****/
for (i=2;i<C_NumberOfCounter;i++)
{
if (g_stEngineStructure.stEngineTimer.a_ulCounter[i]==i-1)
g_stEngineStructure.stEngineTimer.a_ulCounter[i]=0;
else
g_stEngineStructure.stEngineTimer.a_ulCounter[i]++;
}
}
/*-----------------------------------------------------------------------------*/
/* Description : Save the state of the Engine Clock*/
/*-----------------------------------------------------------------------------*/
/* Creation date : 03/09/98 Author : Carlos Torres*/
/*-----------------------------------------------------------------------------*/
void fn_vSaveEngineClock()
{
struct _stTimerCount stCurrentTimerCount;
/* ANNECY MT - 27/01/99 {*/
#ifdef U64
/* read timer and keep it*/
fn_wTimerRead(g_stEngineStructure.stEngineTimer.sTimerHandle,&stCurrentTimerCount);
//g_stEngineStructure.stEngineTimer.ulPauseTime = stCurrentTimerCount.m_ulLowPart;
g_stEngineStructure.stEngineTimer.ulPauseTime = g_stEngineStructure.stEngineTimer.ulCurrentTimerCount;
#else
unsigned long ulDeltaTime;
/* read timer and keep it*/
fn_wTimerRead(g_stEngineStructure.stEngineTimer.sTimerHandle,&stCurrentTimerCount);
if ( stCurrentTimerCount.m_ulHighPart == g_stEngineStructure.stEngineTimer.stRealTimeCount.m_ulHighPart )
{
ulDeltaTime = stCurrentTimerCount.m_ulLowPart - g_stEngineStructure.stEngineTimer.stRealTimeCount.m_ulLowPart;
}
else
{
if ( stCurrentTimerCount.m_ulLowPart >= g_stEngineStructure.stEngineTimer.stRealTimeCount.m_ulLowPart )
ulDeltaTime = stCurrentTimerCount.m_ulLowPart - g_stEngineStructure.stEngineTimer.stRealTimeCount.m_ulLowPart;
else
{
ulDeltaTime = stCurrentTimerCount.m_ulLowPart + (0xffffffff - g_stEngineStructure.stEngineTimer.stRealTimeCount.m_ulLowPart + 1);
}
}
g_stEngineStructure.stEngineTimer.stPauseTime = stCurrentTimerCount;
g_stEngineStructure.stEngineTimer.ulPauseTime = g_stEngineStructure.stEngineTimer.ulCurrentTimerCount + (ulDeltaTime / g_stEngineStructure.stEngineTimer.ulTickPerMS);
#endif
/* END ANNECY MT }*/
}
/*-----------------------------------------------------------------------------*/
/* Description : reset the state of the Engine Clock previously saved*/
/*-----------------------------------------------------------------------------*/
/* Creation date : 03/09/98 Author : Carlos Torres*/
/*-----------------------------------------------------------------------------*/
void fn_vLoadEngineClock()
{
/* ANNECY MT - 27/01/99 {*/
#ifdef U64
struct _stTimerCount stCurrentTimerCount;
stCurrentTimerCount.m_ulHighPart = 0;
/* Reset timer with saved value, Engine ca ncontinue running so init ulCurrentTimerCount too*/
g_stEngineStructure.stEngineTimer.ulCurrentTimerCount =
stCurrentTimerCount.m_ulLowPart =
g_stEngineStructure.stEngineTimer.ulPauseTime;
TMR_fn_wSetTimerValue(g_stEngineStructure.stEngineTimer.sTimerHandle, &stCurrentTimerCount);
#else
g_stEngineStructure.stEngineTimer.stRealTimeCount = g_stEngineStructure.stEngineTimer.stPauseTime;
g_stEngineStructure.stEngineTimer.ulCurrentTimerCount = g_stEngineStructure.stEngineTimer.ulPauseTime;
TMR_fn_wSetTimerValue(g_stEngineStructure.stEngineTimer.sTimerHandle, &g_stEngineStructure.stEngineTimer.stRealTimeCount);
#endif
/* END ANNECY MT }*/
fn_wTimerStart(g_stEngineStructure.stEngineTimer.sTimerHandle);
}

View File

@@ -0,0 +1,147 @@
/* Toy Fonction for Game moteur*/
/*
#include "ACP_Base.h"
#include "ToolsCPA.h"
#include "CPALib.h"
#include "ColMotor.h"
#include "Structur/MemGame.h"
#include "GameEng.h"
#include "ZeMem.h"
//a few define
#define COL_C_NbMaxObjectInCollision 11
#define COL_C_InSphere 0
#define COL_C_OutSphere 1
#define COL_C_InContact 2
//local prototypes
//char COL_xCollideSphere(HIE_tdxHandleToSuperObject COL_p_stSO1,HIE_tdxHandleToSuperObject COL_p_stSO2);
long fn_lObjectCollideWithCamera
(
HIE_tdxHandleToSuperObject COL_p_stTreeToExplore,
HIE_tdxHandleToSuperObject COL_p_stCameraToCollide,
long COL_lTypeToSearch,
HIE_tdxHandleToSuperObject *COL_d_stArrayOfSOInCollision,
long COL_lPositionOfStart,
long COL_lPositionMax
);
// function COL_xCollideSphere()
/* This function indicates if SO2 is in,out or in contact with SO1. The test of collision uses
the sphereBox.*/
/*char COL_xCollideSphere(HIE_tdxHandleToSuperObject COL_p_stSO1,HIE_tdxHandleToSuperObject COL_p_stSO2)
{
MTH3D_tdstVector COL_stCenter1,COL_stCenter2; // The center of each SphereBox in absolue
MTH_tdxReal COL_xDistanceBetweenCenter; // Distance between the centers
//compute the coordinate of the center of SO1
POS_fn_vGetTranslationVector(HIE_fn_hGetSuperObjectMatrix(COL_p_stSO1),&COL_stCenter1 );
MTH3D_M_vAddVector(&COL_stCenter1,&COL_stCenter1,&(HIE_fn_hGetSuperObjectSphere(COL_p_stSO1)->stCentre));
//compute the coordinate of the center of SO2
POS_fn_vGetTranslationVector(HIE_fn_hGetSuperObjectMatrix(COL_p_stSO2),&COL_stCenter2);
MTH3D_M_vAddVector(&COL_stCenter2,&COL_stCenter2,&(HIE_fn_hGetSuperObjectSphere(COL_p_stSO2)->stCentre));
//calculate the distance between the centers
MTH3D_M_vSubVector(&COL_stCenter1,&COL_stCenter1,&COL_stCenter2); // take the vector
COL_xDistanceBetweenCenter=MTH3D_M_xNormVector(&COL_stCenter1);
// determine the output
if
(
COL_xDistanceBetweenCenter
<
MTH_M_xSub(HIE_fn_hGetSuperObjectSphere(COL_p_stSO1)->xRadius,HIE_fn_hGetSuperObjectSphere(COL_p_stSO2)->xRadius)
)
return COL_C_InSphere; //SO2 in SO1
if
(
COL_xDistanceBetweenCenter
<
MTH_M_xAdd(HIE_fn_hGetSuperObjectSphere(COL_p_stSO1)->xRadius,HIE_fn_hGetSuperObjectSphere(COL_p_stSO2)->xRadius)
)
return COL_C_InContact; // SO2 in contact with SO1
return COL_C_OutSphere; // no contact
}
// end of COL_xCollideSphere
// version temp with exploration of the tree
// function fn_lObjectCollideWithCamera()
long fn_lObjectCollideWithCamera
(
HIE_tdxHandleToSuperObject COL_p_stTreeToExplore,
HIE_tdxHandleToSuperObject COL_p_stCameraToCollide,
long COL_lTypeToSearch,
HIE_tdxHandleToSuperObject *COL_d_stArrayOfSOInCollision,
long COL_lPositionOfStart,
long COL_lPositionMax
)
{
long COL_lCounterCollision,COL_lI;
HIE_tdxHandleToSuperObject COL_p_stpChild;
COL_lCounterCollision=COL_lPositionOfStart;
if(COL_lCounterCollision<COL_lPositionMax-1)
{
HIE_M_ForEachChildOf(COL_p_stTreeToExplore,COL_p_stpChild,COL_lI)
COL_lCounterCollision=
fn_lObjectCollideWithCamera(
COL_p_stpChild,
COL_p_stCameraToCollide,
COL_lTypeToSearch,
COL_d_stArrayOfSOInCollision,
COL_lCounterCollision,
COL_C_NbMaxObjectInCollision
);
if(HIE_fn_lGetSuperObjectType(COL_p_stTreeToExplore)==COL_lTypeToSearch)
if(COL_xCollideSphere(COL_p_stTreeToExplore,COL_p_stCameraToCollide)!=COL_C_OutSphere)
{
COL_d_stArrayOfSOInCollision[COL_lCounterCollision]=COL_p_stTreeToExplore;
COL_lCounterCollision++;
}
}
return COL_lCounterCollision;
}
// End of fn_lObjectCollideWithCamera()
//Warning the followed function is temp
// function fn_lObjectActivateByCamera()
long fn_lObjectActivateByCamera
(
HIE_tdxHandleToSuperObject COL_p_stCameraToCollide,
long COL_lTypeToSearch,
HIE_tdxHandleToSuperObject **COL_d_stArrayOfSOInCollision
)
{
long COL_lCounterCollision;
*COL_d_stArrayOfSOInCollision=
(HIE_tdxHandleToSuperObject *)M_p_GameMalloc(E_ucGameSuperObjectMemory,sizeof(HIE_tdxHandleToSuperObject)*COL_C_NbMaxObjectInCollision); // version temp
COL_lCounterCollision=
fn_lObjectCollideWithCamera(
gp_stActualWorld,
COL_p_stCameraToCollide,
COL_lTypeToSearch,
*COL_d_stArrayOfSOInCollision,
0,
COL_C_NbMaxObjectInCollision
);
(*COL_d_stArrayOfSOInCollision)[COL_lCounterCollision]=NULL;
return COL_lCounterCollision;
}
// End of fn_lObjectActivateByCamera()
*/

View File

@@ -0,0 +1,796 @@
/************************************************************************************************
* *
* Collisio.c *
* *
* High level collision functions *
* *
* *
************************************************************************************************/
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "structur/objects.h"
#include "STRUCTUR/StdObjSt.h"
#include "Structur/EngMode.h"
#include "Collisio.h"
#include "GameEng.h"
#include "ZdxStuff.h"
#include "ToolCam.h"
#include "PhysiCol.h"
#include "Family.h"
#include "PO.h"
#include "ChanList.h"
#include "always.h"
#include "mainchar.h"
#include "PRF.h"
#define C_wStaticObject 0
#define C_wMobileObject 1
/* ANNECY AV {*/
#define C_ulCustomBit_Projectile 0x00000008
/* END ANNECY AV }*/
#define C_xHalfSqr3 MTH_M_xDoubleToReal(.8660254037844)
/* jt 260599 */
long COL_g_lMaxNumberOfCollisions = COL_C_xMaxNumberOfCollisions;
/* anthony */
extern COL_tdstCollisionCase COL_g_stCollisionCase [COL_C_xMaxNumberOfCollisions];
extern COL_tdstCollisionCase *COL_g_stCollisionCaseReal;
extern long COL_g_lNbElementsInTable;
extern ACP_tdxBool HISPEED;
/* end anthony*/
/* end jt 260599 */
/*-----------------------------------------------------------------------------*/
/* fn_eGetLimbTypeFromGameMaterial*/
/*-----------------------------------------------------------------------------*/
/*DNM_tdeLimbType fn_eGetLimbTypeFromGameMaterial (GMT_tdxHandleToGameMaterial _hGMT)
{
if( GMT_fn_xMultipleTestCollideIdentifierFromGameMaterial(_hGMT,GMT_C_uwPieds) ) return DNM_eLTFoot;
else if( GMT_fn_xMultipleTestCollideIdentifierFromGameMaterial(_hGMT,GMT_C_uwCorps) ) return DNM_eLTTrunk;
else if( GMT_fn_xMultipleTestCollideIdentifierFromGameMaterial(_hGMT,GMT_C_uwTete) ) return DNM_eLTHead;
else if( GMT_fn_xMultipleTestCollideIdentifierFromGameMaterial(_hGMT,GMT_C_uwMains) ) return DNM_eLTHand;
else return DNM_eLTError;
}*/
/*-----------------------------------------------------------------------------*/
/* fn_bIsGeometricObjectValidForCollision*/
/*-----------------------------------------------------------------------------*/
ACP_tdxBool fn_bIsGeometricObjectValidForCollision (ACP_tdxHandleOfObject _hGeoObj)
{
/* IMPORTANT : if the geometric objet has no point, it is not necessary to call the collision*/
return (ACP_tdxBool) (GEO_xGetGeometricObjectNumberOfPoints(_hGeoObj) >= 1);
}
/*-----------------------------------------------------------------------------*/
/* COL_lHaveITakeSThgIntoTheMug*/
/**/
/* The main function for the collisions :*/
/* Test the collision between one super object and the rest of the world*/
/*-----------------------------------------------------------------------------*/
/* used*/
long COL_lHaveITakeSThgIntoTheMug(DNM_tdstMecObstacle _a_stResultObstacle [COL_C_xMaxNumberOfCollisions] ,
HIE_tdxHandleToSuperObject _p_stSupObj ,
POS_tdstCompletePosition * _p_stStartPosition ,
POS_tdstCompletePosition * _p_stEndPosition)
{
static MTH_tdxReal xSlideCoef = MTH_C_ZERO;
static MTH_tdxReal xReboundCoef = MTH_C_ZERO;
/* ACP_tdxBool bCollision;*/
ACP_tdxIndex i;
MTH3D_tdstVector * p_stAxis = DNM_M_p_stObstacleGetNorm(& _a_stResultObstacle [0]);
MTH3D_tdstVector stDummy;
long lResult = 0;
long lParameter2 = 0;
/* COL_tdstCollisionCase a_stCollisionCase [COL_C_xMaxNumberOfCollisions];*/
/* COL_tdstCollisionCase * p_stCollisionCase; */
DNM_tdxHandleToMecMatCharacteristics hCollidedMechanicMaterial;
DNM_tdstMecMatCharacteristics *p_stMechanicMaterial;
#if defined(USE_PROFILER) && !defined(PRESS_DEMO)
unsigned char ucDNMRunning , ucIARunning;
void *p_vCurrentAIData = NULL;
void *p_vCurrentDNMData = NULL;
ucDNMRunning = (unsigned char) (( PRF_fn_iGetFunctionNumberOfStart( PRF_C_ulFctDNM, &p_vCurrentDNMData ) > 0 ) ? 1 : 0);
ucIARunning = (unsigned char) (( PRF_fn_iGetFunctionNumberOfStart( PRF_C_ulFctAI, &p_vCurrentAIData ) > 0 ) ? 1 : 0);
if( ucDNMRunning )
PRF_fn_vStopChrono( PRF_C_ulFctDNM, p_vCurrentDNMData );
if( ucIARunning )
PRF_fn_vStopChrono( PRF_C_ulFctAI, p_vCurrentAIData );
PRF_fn_vStartChrono( PRF_C_ulFctCollisions, _p_stSupObj );
#endif
MTH3D_M_vSetVectorElements(&stDummy,MTH_C_ZERO,MTH_C_ZERO,MTH_M_xFloatToReal(0.1f));
/* NOCLIP Ghost Mode*/
if(g_ucIsEdInGhostMode && CAM_fn_bSuperObjectIsACamera(_p_stSupObj))
{
/* DNM_M_eObstacleSetType(& _a_stResultObstacle [0] ,DNM_ObsType_Nothing);*/
DNM_M_eObstacleSetType(& _a_stResultObstacle [0] ,0);
#if defined(USE_PROFILER) && !defined(PRESS_DEMO)
PRF_fn_vStopChrono( PRF_C_ulFctCollisions, _p_stSupObj );
if( ucDNMRunning )
PRF_fn_vStartChrono( PRF_C_ulFctDNM, p_vCurrentDNMData );
if( ucIARunning )
PRF_fn_vStartChrono( PRF_C_ulFctAI, p_vCurrentAIData );
#endif
return 0;
}
/* Dealing whit changes of sectors*/
/*prabaly useless, because the sector in which we are new is most certainly in the collision list of our current sector,*/
/*and will be tested for collisions anyway...*/
/*GAM_fn_vSectInfoTestChangeSectorForCharacter(_p_stSupObj); */
/* If character has a Collision Set and has at least one Zdm*/
if (M_GetMSHandle (_p_stSupObj , CollSet) && CS_fn_hGetZdxList (C_ucTypeZdm , _p_stSupObj))
{
/* Do collision computation*/
/* COL_tdstCollisionCase *p_stCurrentCollisionCase;*/
DNM_tdstMecObstacle *p_stCurrentResultObstacle;
/* Warning anthony */
COL_g_stCollisionCaseReal = (COL_tdstCollisionCase *)_a_stResultObstacle; /* replace bcollision = COL_fn_bGetMultipleResultCollision (& p_stCollisionCase);*/
/* Test the collisions with all zones (hand and no hand)*/
/*if (!HISPEED)*/ COL_fn_vInitCollisionTable();
COL_fn_vNewStaticCollisionForCharacter (_p_stSupObj, fn_h_SectInfoGetCurrentSector(M_GetMSHandle(_p_stSupObj,SectInfo)), _p_stStartPosition, _p_stEndPosition);
/*bCollision = COL_fn_bGetMultipleResultCollision (& p_stCollisionCase);*/
for
(
i = 0, /*p_stCurrentCollisionCase = p_stCollisionCase, */ p_stCurrentResultObstacle = _a_stResultObstacle;
i < COL_g_lNbElementsInTable; /*COL_g_lMaxNumberOfCollisions;*/
i ++, /*p_stCurrentCollisionCase ++,*/ p_stCurrentResultObstacle ++
)
/* if (p_stCurrentCollisionCase->bCollisionState) */
{
/* comment by jt 071098*/
/* DNM_M_p_stObstacleSetDNMObject(p_stCurrentResultObstacle, NULL);*/
lParameter2 = ((COL_tdstCollisionCase *)p_stCurrentResultObstacle)->sParameter2;
/* In case of collision between two characters*/
// if( (((COL_tdstCollisionCase *)p_stCurrentResultObstacle)->sParameter2 & 0x1) == C_wMobileObject )
if( (lParameter2 & 0x1) == C_wMobileObject )
{
HIE_tdxHandleToSuperObject hSOInCollision;
hSOInCollision = (HIE_tdxHandleToSuperObject)((COL_tdstCollisionCase *)p_stCurrentResultObstacle)->p_vParameter1;
DNM_M_eObstacleSetType(p_stCurrentResultObstacle, DNM_ObsType_Mobile);
/* Add this test in case of global ZDR*/
/* comment by jt 071098*/
/* if( HIE_fn_ulGetSuperObjectType(hSOInCollision)==HIE_C_ulActor )
{
if((h_Dynam = M_GetMSHandle(hSOInCollision,Dynam)) != NULL )
if((p_stDynamics = fn_p_stDynamGetDynamics(h_Dynam)) != NULL)
DNM_M_p_stObstacleSetDNMObject(p_stCurrentResultObstacle, p_stDynamics);
}
else
{
hFather = HIE_fn_hGetSuperObjectFather(hSOInCollision);
if(HIE_fn_bIsSuperObjectValid(hFather))
if(HIE_fn_ulGetSuperObjectType(hFather) == HIE_C_ulActor)
if((h_Dynam = M_GetMSHandle(hFather,Dynam)) != NULL )
if((p_stDynamics = fn_p_stDynamGetDynamics(h_Dynam)) != NULL)
DNM_M_p_stObstacleSetDNMObject(p_stCurrentResultObstacle, p_stDynamics);
}*/
}
else DNM_M_eObstacleSetType(p_stCurrentResultObstacle, DNM_ObsType_Scenery);
/* jt 060199*/
/* double edge report */
// if ( ((COL_tdstCollisionCase *)p_stCurrentResultObstacle)->sParameter2 & 0x2 )
if ( lParameter2 & 0x2 )
DNM_M_eObstacleSetType ( p_stCurrentResultObstacle, DNM_M_eObstacleGetType(p_stCurrentResultObstacle) | DNM_ObsType_DoubleEdge );
/* end jt*/
/* Partie collisionn<6E>e */
if(((COL_tdstCollisionCase *)p_stCurrentResultObstacle)->hStaticMaterial != NULL)
{
hCollidedMechanicMaterial = GMT_fn_hGetMechanicsMaterial( ((COL_tdstCollisionCase *)p_stCurrentResultObstacle)->hStaticMaterial );
if(DNM_fn_bIsMatCharacteristicsValid(hCollidedMechanicMaterial))
{
p_stMechanicMaterial = DNM_fn_p_stMecMatCharacteristicsGiveBackSemantic(hCollidedMechanicMaterial);
DNM_M_xObstacleSetSlide(p_stCurrentResultObstacle, DNM_M_xMatCharacteristicsGetSlide(p_stMechanicMaterial));
DNM_M_xObstacleSetRebound(p_stCurrentResultObstacle, DNM_M_xMatCharacteristicsGetRebound(p_stMechanicMaterial));
}
else
{
DNM_M_xObstacleSetSlide(p_stCurrentResultObstacle, xSlideCoef);
DNM_M_xObstacleSetRebound(p_stCurrentResultObstacle, xReboundCoef);
}
}
else
{
DNM_M_xObstacleSetSlide(p_stCurrentResultObstacle, xSlideCoef);
DNM_M_xObstacleSetRebound(p_stCurrentResultObstacle, xReboundCoef);
}
/* anthony */
/*DNM_M_p_stObstacleSetObject(p_stCurrentResultObstacle, (HIE_tdxHandleToSuperObject)((COL_tdstCollisionCase *)p_stCurrentResultObstacle)->p_vParameter1);
DNM_M_vObstacleSetCollidedMaterial(p_stCurrentResultObstacle, ((COL_tdstCollisionCase *)p_stCurrentResultObstacle)->hStaticMaterial);
DNM_M_vObstacleSetMyMaterial(p_stCurrentResultObstacle, ((COL_tdstCollisionCase *)p_stCurrentResultObstacle)->hDynamicMaterial);
DNM_M_xObstacleSetMyEntity(p_stCurrentResultObstacle, ((COL_tdstCollisionCase *)p_stCurrentResultObstacle)->xDynamicGeomEntity);
DNM_M_xObstacleSetCollidedEntity(p_stCurrentResultObstacle, ((COL_tdstCollisionCase *)p_stCurrentResultObstacle)->xStaticGeomEntity);*/
/*anthony end */
/* if( p_stCurrentCollisionCase->hDynamicMaterial )*/
/* DNM_M_eObstacleSetLimbType(p_stCurrentResultObstacle, fn_eGetLimbTypeFromGameMaterial(p_stCurrentCollisionCase->hDynamicMaterial));*/
/* else DNM_M_eObstacleSetLimbType(p_stCurrentResultObstacle, DNM_eLTDefault);*/
/* anthony */
/* p_stAxis = DNM_M_p_stObstacleGetNorm(p_stCurrentResultObstacle);
*p_stAxis = ((COL_tdstCollisionCase *)p_stCurrentResultObstacle)->stCollisionNormal;
p_stAxis = DNM_M_p_stObstacleGetContact(p_stCurrentResultObstacle);
*p_stAxis = ((COL_tdstCollisionCase *)p_stCurrentResultObstacle)->stCollisionPoint;
DNM_M_xObstacleSetRate(p_stCurrentResultObstacle,((COL_tdstCollisionCase *)p_stCurrentResultObstacle)->xCollisionTime);
DNM_M_xObstacleSetTranslation (p_stCurrentResultObstacle, & ((COL_tdstCollisionCase *)p_stCurrentResultObstacle)->stTranslation);
DNM_M_xObstacleSetZoneMove (p_stCurrentResultObstacle, & ((COL_tdstCollisionCase *)p_stCurrentResultObstacle)->stMovement);
DNM_M_xObstacleSetZoneRadius (p_stCurrentResultObstacle, ((COL_tdstCollisionCase *)p_stCurrentResultObstacle)->xSphereRadius);
DNM_M_xObstacleSetZonePosition (p_stCurrentResultObstacle, & ((COL_tdstCollisionCase *)p_stCurrentResultObstacle)->stEndPosition);*/
lResult = i + 1;
} /* End if (p_stCurrentCollisionCase->bCollisionState)*/
/* else break; /* No collision : it is not necessary to test the next elements of the array*/
} /* End if M_GetMSHandle(_p_stSupObj,CollSet) : if the character has a Collision Set*/
#if defined(USE_PROFILER) && !defined(PRESS_DEMO)
PRF_fn_vStopChrono( PRF_C_ulFctCollisions, _p_stSupObj );
if( ucDNMRunning )
PRF_fn_vStartChrono( PRF_C_ulFctDNM, p_vCurrentDNMData );
if( ucIARunning )
PRF_fn_vStartChrono( PRF_C_ulFctAI, p_vCurrentAIData );
#endif
return lResult;
}
/*-----------------------------------------------------------------------------*/
/* fn_vCollideStaticCharacterWithStaticPhysicals*/
/* test static collisions between a character and a static physical object*/
/*-----------------------------------------------------------------------------*/
/* used*/
void fn_vCollideStaticCharacterWithStaticPhysicals
(
HIE_tdxHandleToSuperObject _hDynamicCharacter ,
ACP_tdxHandleOfObject _hDynamicGeoCol ,
HIE_tdxHandleToSuperObject _hModule ,
POS_tdstCompletePosition * p_stStartMatrix ,
POS_tdstCompletePosition * p_stEndMatrix
)
{
PCS_tdxHandleToPhysicalCollSet hStaticCollSet = PO_fn_hGetCollideSet ( ( PO_tdxHandleToPhysicalObject ) HIE_fn_hGetSuperObjectObject ( _hModule ) ) ;
/* Down with module ZDR*/
if ( hStaticCollSet )
{
GEO_tdstGeometricObject * p_stStaticGeoColl = PCS_fn_hGetGeoObjOfPhysicalCollSet ( C_ucTypeZdr , hStaticCollSet ) ;
if ( p_stStaticGeoColl )
{
COL_fn_vCollideStaticGeomObj1WithStaticGeomObj2 (
_hDynamicGeoCol , p_stStartMatrix , p_stEndMatrix , p_stStaticGeoColl ,
HIE_fn_hGetSuperObjectGlobalMatrix ( _hModule ) ,
( void * ) _hModule , C_wMobileObject ,
( ACP_tdxBool ) HIE_fn_SO_bHasNoTransformationMatrix ( _hModule ) ,
( ACP_tdxBool ) HIE_fn_SO_bHasZoomInsteadOfScale ( _hDynamicCharacter )
);
}
}
}
/*--------------------------------------------------------------------
* Test static collisions between 2 characters, taking in account Zdr,
* modules and priority.
*--------------------------------------------------------------------*/
/* used*/
void fn_vNewTestStaticCollideFor2Characters (HIE_tdxHandleToSuperObject hCharacter ,
ACP_tdxHandleOfObject _hDynamicZdm ,
HIE_tdxHandleToSuperObject hStaticCharacter ,
POS_tdstCompletePosition * p_stStartMatrix ,
POS_tdstCompletePosition * p_stEndMatrix)
{
GEO_tdxHandleToBoundingSphere hBoundingVolumeCharacter = NULL;
GEO_tdxHandleToBoundingSphere hBoundingVolumeStaticCharacter = NULL;
CHN_tdxHandleToChannel hChannel;
MS_tdxHandleToCollSet hStaticCollSet;
MS_tdxHandleToCollSet hDynamicCollSet;
HIE_tdxHandleToSuperObject hMainChar ;
/* ACP_tdxIndex xIndex;*/
/* ANNECY AV {*/
/* Is static character active ?*/
if (! M_ObjectIsActive ((struct tdstEngineObject_ *) HIE_fn_hGetSuperObjectObject (hStaticCharacter)))
/* END ANNECY AV }*/
{
return;
}
/* Is static character collidable ?*/
if ( HIE_fn_SO_bIsNotPickable ( hStaticCharacter ) )
{
return;
}
hDynamicCollSet = M_GetMSHandle (hCharacter, CollSet);
hStaticCollSet = M_GetMSHandle (hStaticCharacter, CollSet);
/* Test the priority : the dynamic priority must be >= than the static priority*/
if ( CS_fn_ucGetCharacterPriority ( hDynamicCollSet ) < ( hStaticCollSet ? CS_fn_ucGetCharacterPriority( hStaticCollSet ) : 0 ) )
{
return;
}
hMainChar = MC_fn_hGetCharacterInMainCharacterNode ( MC_fn_hGetFirstMainCharNode ( ) ) ;
if ( hDynamicCollSet )
{
/* Test if the dynamic character can collide projectiles*/
if
(
fn_bCollSetGetCharacterNoCollisionWithProjectile (hDynamicCollSet) &&
(fn_ulStandardGameGetCustomBitsSO (hStaticCharacter) & C_ulCustomBit_Projectile)
)
{
return;
}
if ( hStaticCharacter == hMainChar )
{
/* Test if the dynamic character can collide the main character*/
if ( fn_bCollSetGetCharacterNoCollisionWithMainCharacter ( hDynamicCollSet ) )
return ;
}
else
{
/* Test if the dynamic character can collide the secondary characters*/
if
(
fn_bCollSetGetCharacterNoCollisionWithSecondaryCharacter ( hDynamicCollSet )
&& ! fn_ucIsAnAlwaysObject ( ( tdstEngineObject *) HIE_fn_hGetSuperObjectObject ( hStaticCharacter ) )
)
return ;
}
}
if ( hStaticCollSet )
{
/* Test if the static character can collide projectiles*/
if
(
fn_bCollSetGetCharacterNoCollisionWithProjectile (hStaticCollSet) &&
(fn_ulStandardGameGetCustomBitsSO (hCharacter) & C_ulCustomBit_Projectile)
)
{
return;
}
if ( hMainChar == hCharacter )
{
/* Test if the dynamic character can collide the main character*/
if ( fn_bCollSetGetCharacterNoCollisionWithMainCharacter ( hStaticCollSet ) )
return ;
}
else
{
/* Test if the dynamic character can collide the secondary characters */
if
(
fn_bCollSetGetCharacterNoCollisionWithSecondaryCharacter ( hStaticCollSet )
&& ! fn_ucIsAnAlwaysObject ( ( tdstEngineObject * ) HIE_fn_hGetSuperObjectObject ( hCharacter ) )
)
return ;
}
}
/* Testing bounding volumes*/
hBoundingVolumeCharacter = ( GEO_tdxHandleToBoundingSphere ) HIE_fn_hGetSuperObjectBoundingVolume( hCharacter ) ;
hBoundingVolumeStaticCharacter = ( GEO_tdxHandleToBoundingSphere ) HIE_fn_hGetSuperObjectBoundingVolume ( hStaticCharacter ) ;
if ( hBoundingVolumeCharacter && hBoundingVolumeStaticCharacter )
if
(
! COL_fn_bDetectCollisionStaticGeomObjWithStaticGeomObj (
hBoundingVolumeCharacter, p_stEndMatrix,
(void *) hBoundingVolumeStaticCharacter ,
HIE_fn_hGetSuperObjectGlobalMatrix ( hStaticCharacter ) ,
( ACP_tdxBool ) HIE_fn_SO_bHasNoTransformationMatrix ( hStaticCharacter ) ,
( ACP_tdxBool ) HIE_fn_SO_bHasZoomInsteadOfScale ( hCharacter ) ,
FALSE /* The Static Character Has NOT a Box Bounding Volume*/
)
)
{
return;
}
/* Here, we have to test the collisions*/
PRF_fn_vIncreaseVariable( PRF_C_ulVarDynColl, hCharacter, 1 );
/* Dynamic global Zdm Vs Static global Zdr*/
if ( hStaticCollSet )
{
GEO_tdstGeometricObject * hStaticZdr = fn_hStaticMakeOneObjectFromManyZdx ( C_ucTypeZdr , hStaticCharacter ) ;
if ( fn_bIsGeometricObjectValidForCollision (hStaticZdr) )
{
COL_fn_vCollideStaticGeomObj1WithStaticGeomObj2(
_hDynamicZdm, p_stStartMatrix, p_stEndMatrix,
hStaticZdr, HIE_fn_hGetSuperObjectGlobalMatrix (hStaticCharacter),
(void *) hStaticCharacter, C_wMobileObject,
(ACP_tdxBool) HIE_fn_SO_bHasNoTransformationMatrix(hStaticCharacter),
(ACP_tdxBool) HIE_fn_SO_bHasZoomInsteadOfScale(hCharacter)
);
}
}
/* Dynamic global Zdm Vs static modular Zdr */
hChannel = fn_h3dDataGetFirstActiveChannel (M_GetMSHandle (hStaticCharacter , 3dData));
while ( hChannel )
{
HIE_tdxHandleToSuperObject hModule = hChannel->hZoomSupObject ? hChannel->hZoomSupObject : hChannel->hSupObject ;
/* check if module position is up to date*/
/* check if there is a zdr */
if
(
( HIE_fn_ulGetSuperObjectType (hModule) == HIE_C_ulPO )
&& ( ! ( HIE_M_xGetSuperObjectMember(hModule, ulFlags) & HIE_C_Flag_ulHidden ) ) /* don't use a zone when its channel is deactivated */
)
{
#ifdef ACTIVE_EDITOR
unsigned char ucChannelNumber;
GEO_tdstGeometricObject * p_stStaticGeoColl;
MTH_tdxReal xScaleX,xScaleY,xScaleZ;
static BOOL s_bColBox = FALSE;
if ( PO_fn_hGetCollideSet ((PO_tdxHandleToPhysicalObject) HIE_fn_hGetSuperObjectObject (hModule)))
{
p_stStaticGeoColl = PCS_fn_hGetGeoObjOfPhysicalCollSet (C_ucTypeZdr , PO_fn_hGetCollideSet ((PO_tdxHandleToPhysicalObject) HIE_fn_hGetSuperObjectObject (hModule)));
if ( p_stStaticGeoColl )
{
/* ok, zdr found, check that position is up to date*/
ucChannelNumber = (unsigned char) (hChannel - fn_h3dDataGetChannelSOList(M_GetMSHandle(hStaticCharacter, 3dData)));
fn_vCheckModuleAccessGam(hStaticCharacter, ucChannelNumber);
/* now, check if the module global matrix has a scale or a zoom*/
if ( ! s_bColBox )
{
/* if it is a scale, error because scale is not compatible with zdr-itself!*/
MTH3D_tdstVector stI,stJ,stK;
POS_fn_vGetScaleMatrix(HIE_fn_hGetSuperObjectGlobalMatrix(hModule),&stI,&stJ,&stK);
xScaleX = stI.xX;
xScaleY = stJ.xY;
xScaleZ = stK.xZ;
if ( ! s_bColBox && ! ( MTH_M_bEqualWithEpsilon ( xScaleX , xScaleY , 0.1f ) && MTH_M_bEqualWithEpsilon( xScaleX , xScaleZ , 0.1f ) ) )
{
/* error !*/
char cText[1000];
sprintf(cText,
"a ZDR_itself module has a scale !! This is forbidden!\n"
"this module belongs to : %s\n"
"who is currently in state : %s\n"
"The number of the channel you try to access is : %i\n"
"ScaleX = %f, scaleY = %f, scaleZ = %f\n",
M_GetMSHandle(hStaticCharacter,Brain)
? (M_pstGetMindOfBrain(M_GetMSHandle(hStaticCharacter,Brain)))->szPersoName
: "**unknown**",
fn_p_szGetStateName(fn_h3dDataGetCurrentState(M_GetMSHandle(hStaticCharacter,3dData))),
(unsigned char) (hChannel - fn_h3dDataGetChannelSOList(M_GetMSHandle(hStaticCharacter, 3dData))),
xScaleX,xScaleY,xScaleZ
);
if (hChannel->hZoomSupObject)
{
strcat(cText,"\nThis module is a symetric module\n");
}
MessageBox(NULL,cText,"Module collision error",MB_OK|MB_ICONWARNING);
s_bColBox = TRUE;
}
}
}
}
#endif /* ! ACTIVE_EDITOR */
fn_vCollideStaticCharacterWithStaticPhysicals (
hCharacter ,
_hDynamicZdm ,
hModule ,
p_stStartMatrix , p_stEndMatrix
) ;
}
hChannel = hChannel -> p_stNextActiveChannel ;
}
}
/*-----------------------------------------------------------------------------*/
/* New function of collision for a character.*/
/*-----------------------------------------------------------------------------*/
/*used*/
void COL_fn_vNewStaticCollisionForCharacter (HIE_tdxHandleToSuperObject _hCharacter,
HIE_tdxHandleToSuperObject _hSector,
POS_tdstCompletePosition *_p_stStartMatrix,
POS_tdstCompletePosition *_p_stEndMatrix)
{
MS_tdxHandleToCollSet hCollSet;
SECT_tdxHandleOfElementLstCharacter hCharacterList;
SECT_tdxHandleOfElementLstCollisionInteraction hCollisionList;
ACP_tdxHandleOfObject hDynamicZDM;
HIE_tdxHandleToSuperObject hStaticCharacter ;
GEO_tdxHandleToParallelBox hParallelBoxStatic = NULL;
GEO_tdxHandleToBoundingSphere hBoundingSphereStatic = NULL;
MTH3D_tdstVector stMove;
GEO_tdstParallelBox stBackupParallelBox;
MTH_tdxReal xBackupSphereRadius;
long i , j;
hDynamicZDM = fn_hMakeOneObjectFromManyZdx (C_ucTypeZdm , _hCharacter);
PRF_fn_vStartChrono( PRF_C_ulFctCollisionsChar, _hCharacter );
hCollSet = M_GetMSHandle (_hCharacter, CollSet);
/* jt 270599 */
/* Enlarge bounding volume */
/* compute move */
MTH3D_M_vSubVector ( &stMove, POS_fn_p_stGetTranslationVector(_p_stEndMatrix), POS_fn_p_stGetTranslationVector(_p_stStartMatrix) );
if(HIE_fn_SO_bHasABoxBoundingVolume (_hCharacter))
{
hParallelBoxStatic = (GEO_tdxHandleToParallelBox)HIE_fn_hGetSuperObjectBoundingVolume(_hCharacter);
memcpy(&stBackupParallelBox,hParallelBoxStatic,sizeof(GEO_tdstParallelBox));
if (MTH_M_bGreaterZero(MTH3D_M_xGetXofVector(&stMove)))
MTH3D_M_vSetXofVector ( &(hParallelBoxStatic->stMaxPoint), MTH_M_xAdd ( MTH3D_M_xGetXofVector(&(hParallelBoxStatic->stMaxPoint)), MTH3D_M_xGetXofVector(&stMove) ) )
else
MTH3D_M_vSetXofVector ( &(hParallelBoxStatic->stMinPoint), MTH_M_xAdd ( MTH3D_M_xGetXofVector(&(hParallelBoxStatic->stMinPoint)), MTH3D_M_xGetXofVector(&stMove) ) )
if (MTH_M_bGreaterZero(MTH3D_M_xGetYofVector(&stMove)))
MTH3D_M_vSetYofVector ( &(hParallelBoxStatic->stMaxPoint), MTH_M_xAdd ( MTH3D_M_xGetYofVector(&(hParallelBoxStatic->stMaxPoint)), MTH3D_M_xGetYofVector(&stMove) ) )
else
MTH3D_M_vSetYofVector ( &(hParallelBoxStatic->stMinPoint), MTH_M_xAdd ( MTH3D_M_xGetYofVector(&(hParallelBoxStatic->stMinPoint)), MTH3D_M_xGetYofVector(&stMove) ) )
if (MTH_M_bGreaterZero(MTH3D_M_xGetZofVector(&stMove)))
MTH3D_M_vSetZofVector ( &(hParallelBoxStatic->stMaxPoint), MTH_M_xAdd ( MTH3D_M_xGetZofVector(&(hParallelBoxStatic->stMaxPoint)), MTH3D_M_xGetZofVector(&stMove) ) )
else
MTH3D_M_vSetZofVector ( &(hParallelBoxStatic->stMinPoint), MTH_M_xAdd ( MTH3D_M_xGetZofVector(&(hParallelBoxStatic->stMinPoint)), MTH3D_M_xGetZofVector(&stMove) ) )
}
else
{
hBoundingSphereStatic = (GEO_tdxHandleToBoundingSphere)HIE_fn_hGetSuperObjectBoundingVolume(_hCharacter);
xBackupSphereRadius = hBoundingSphereStatic->xRadius;
hBoundingSphereStatic->xRadius = MTH_M_xAdd ( hBoundingSphereStatic->xRadius, MTH3D_M_xNormVector(&stMove) );
}
/* end jt 270599 */
/* The collisions with the other characters*/
if (! fn_bCollSetGetCharacterNoCollisionWithProjectile (hCollSet) ||
! fn_bCollSetGetCharacterNoCollisionWithSecondaryCharacter (hCollSet) ||
! fn_bCollSetGetCharacterNoCollisionWithMainCharacter (hCollSet))
{
/* Deal with interactions between characters*/
/* First, the Active Sector*/
SECT_M_ForEachCharListInSector ( _hSector, hCharacterList, i )
{
hStaticCharacter = SECT_GetCharacterInList ( hCharacterList ) ;
if ( _hCharacter != hStaticCharacter )
{
fn_vNewTestStaticCollideFor2Characters (
_hCharacter , hDynamicZDM , hStaticCharacter ,
_p_stStartMatrix , _p_stEndMatrix
) ;
}
}
/* And now, the collision list*/
if (! fn_bCollSetGetCharacterNoCollisionWithOtherSectors (hCollSet))
{
SECT_M_ForEachCollisionNodeInCollisionInteractionList ( _hSector , hCollisionList , i )
{
SECT_M_ForEachCharListInSector ( SECT_GetSectorInCollisionList ( hCollisionList ) , hCharacterList, j )
{
hStaticCharacter = SECT_GetCharacterInList ( hCharacterList ) ;
/* Coz hCharacter may have changed of sector*/
if ( _hCharacter != hStaticCharacter )
{
fn_vNewTestStaticCollideFor2Characters (
_hCharacter , hDynamicZDM , hStaticCharacter ,
_p_stStartMatrix , _p_stEndMatrix
) ;
}
}
}
}
}
PRF_fn_vStopChrono( PRF_C_ulFctCollisionsChar, _hCharacter );
/* The collisions with the map*/
if (! fn_bCollSetGetCharacterNoCollisionWithMap (hCollSet) && ! SECT_fn_bIsThisSectorVirtual (_hSector))
{
/* Deal with the static world*/
COL_fn_vStaticCollisionWithPartOfTreeForSector (_hCharacter, _hSector, hDynamicZDM, _p_stStartMatrix, _p_stEndMatrix);
/* Testing sectors in collision interaction*/
if (! fn_bCollSetGetCharacterNoCollisionWithOtherSectors (hCollSet))
{
SECT_M_ForEachCollisionNodeInCollisionInteractionList ( _hSector, hCollisionList, i )
{
HIE_tdxHandleToSuperObject hSectorToCollide = SECT_GetSectorInCollisionList (hCollisionList);
if (! SECT_fn_bIsThisSectorVirtual (hSectorToCollide))
{
COL_fn_vStaticCollisionWithPartOfTreeForSector (_hCharacter, hSectorToCollide, hDynamicZDM,
_p_stStartMatrix, _p_stEndMatrix);
}
}
}
}
/* restore initial Bounding Volume */
if(HIE_fn_SO_bHasABoxBoundingVolume (_hCharacter))
{
hParallelBoxStatic = (GEO_tdxHandleToParallelBox)HIE_fn_hGetSuperObjectBoundingVolume(_hCharacter);
memcpy(hParallelBoxStatic,&stBackupParallelBox,sizeof(GEO_tdstParallelBox));
}
else
{
hBoundingSphereStatic = (GEO_tdxHandleToBoundingSphere)HIE_fn_hGetSuperObjectBoundingVolume(_hCharacter);
hBoundingSphereStatic->xRadius = xBackupSphereRadius;
}
return;
}
/*-----------------------------------------------------------------------------*/
/* COL_fn_vStaticCollisionWithPartOfTreeForSector*/
/* New exploration of the static tree with use of sectors*/
/*-----------------------------------------------------------------------------*/
/* used*/
void COL_fn_vStaticCollisionWithPartOfTreeForSector (HIE_tdxHandleToSuperObject _p_stEngineObj,
HIE_tdxHandleToSuperObject _p_stSuperObj,
GEO_tdstGeometricObject * _p_stDynamicGeoColl,
POS_tdstCompletePosition * _p_stStartMatrix,
POS_tdstCompletePosition * _p_stEndMatrix)
{
unsigned long p;
HIE_tdxHandleToSuperObject pChild;
GEO_tdstGeometricObject * p_stStaticGeoColl;
PO_tdxHandleToPhysicalObject hPhysicalObject;
PCS_tdxHandleToPhysicalCollSet hPhyCollSet;
GEO_tdxHandleToBoundingSphere hBoundingVolumeCharacter = NULL;
GEO_tdxHandleToParallelBox hParallelBoxStatic = NULL;
GEO_tdxHandleToBoundingSphere hBoundingSphereStatic = NULL;
void * hBoundingVolumeStatic;
long lType;
if (HIE_fn_SO_bIsNotPickable( _p_stSuperObj ) )
{
return;
}
hBoundingVolumeCharacter = HIE_fn_hGetSuperObjectBoundingVolume (_p_stEngineObj);
if(HIE_fn_SO_bHasABoxBoundingVolume (_p_stSuperObj))
{
hParallelBoxStatic = (GEO_tdxHandleToParallelBox)HIE_fn_hGetSuperObjectBoundingVolume(_p_stSuperObj);
hBoundingVolumeStatic = (void *)hParallelBoxStatic;
}
else
{
hBoundingSphereStatic = (GEO_tdxHandleToBoundingSphere)HIE_fn_hGetSuperObjectBoundingVolume(_p_stSuperObj);
hBoundingVolumeStatic = (void *)hBoundingSphereStatic;
}
if (hBoundingVolumeCharacter && hBoundingVolumeStatic)
{
if (! COL_fn_bDetectCollisionStaticGeomObjWithStaticGeomObj (hBoundingVolumeCharacter , _p_stEndMatrix ,
hBoundingVolumeStatic, HIE_fn_hGetSuperObjectGlobalMatrix (_p_stSuperObj),
(ACP_tdxBool) HIE_fn_SO_bHasNoTransformationMatrix (_p_stSuperObj),
(ACP_tdxBool) HIE_fn_SO_bHasZoomInsteadOfScale (_p_stEngineObj),
(ACP_tdxBool) HIE_fn_SO_bHasABoxBoundingVolume (_p_stSuperObj)))
{
if(HIE_fn_SO_bCheckChildren(_p_stSuperObj))
{
HIE_M_ForEachChildOf ( _p_stSuperObj, pChild, p )
{
COL_fn_vStaticCollisionWithPartOfTreeForSector (_p_stEngineObj, pChild, _p_stDynamicGeoColl, _p_stStartMatrix, _p_stEndMatrix);
}
return;
}
else
return;
}
}
PRF_fn_vSetIndependantVariable( PRF_C_ulIdpCollComputed, 0 );
lType = HIE_fn_ulGetSuperObjectType(_p_stSuperObj);
#ifdef D_THROW_IPO
if( lType & (HIE_C_ulPO | HIE_C_ulPO_Mirror ))
{
hPhysicalObject = (PO_tdxHandleToPhysicalObject)HIE_fn_hGetSuperObjectObject(_p_stSuperObj);
hPhyCollSet = PO_fn_hGetCollideSet(hPhysicalObject);
if ( hPhyCollSet ) /* GIZMO 070897*/
{
p_stStaticGeoColl = PCS_fn_hGetZdrGeoObjOfPhysicalCollSet(hPhyCollSet);
COL_fn_vCollideStaticGeomObj1WithStaticGeomObj2 (_p_stDynamicGeoColl, _p_stStartMatrix, _p_stEndMatrix, p_stStaticGeoColl, HIE_fn_hGetSuperObjectGlobalMatrix(_p_stSuperObj),
(void *) _p_stSuperObj , C_wStaticObject ,
(ACP_tdxBool) HIE_fn_SO_bHasNoTransformationMatrix(_p_stSuperObj),
(ACP_tdxBool) HIE_fn_SO_bHasZoomInsteadOfScale(_p_stEngineObj));
}
}
#else /*D_THROW_IPO*/
if (lType & ( HIE_C_ulIPO | HIE_C_ulIPO_Mirror))
{
hPhysicalObject = IPO_fn_hGetPhysicalObject((IPO_tdxHandleToInstanciatedPhysicalObject)HIE_fn_hGetSuperObjectObject(_p_stSuperObj));
hPhyCollSet = PO_fn_hGetCollideSet(hPhysicalObject);
if ( hPhyCollSet ) /* GIZMO 070897*/
{
p_stStaticGeoColl = PCS_fn_hGetZdrGeoObjOfPhysicalCollSet(hPhyCollSet);
COL_fn_vCollideStaticGeomObj1WithStaticGeomObj2 (_p_stDynamicGeoColl, _p_stStartMatrix, _p_stEndMatrix, p_stStaticGeoColl, HIE_fn_hGetSuperObjectGlobalMatrix(_p_stSuperObj),
(void *) _p_stSuperObj , C_wStaticObject ,
(ACP_tdxBool) HIE_fn_SO_bHasNoTransformationMatrix(_p_stSuperObj),
(ACP_tdxBool) HIE_fn_SO_bHasZoomInsteadOfScale(_p_stEngineObj));
}
}
#endif /* D_THROW_IPO */
/*End XB*/
#ifdef USE_PROFILER
if( PRF_fn_lGetIndependantVariable( PRF_C_ulIdpCollComputed ) )
PRF_fn_vIncreaseVariable( PRF_C_ulVarStaColl, _p_stEngineObj, 1 );
#endif /* USE_PROFILER */
/* test all objects in sector*/
HIE_M_ForEachChildOf ( _p_stSuperObj, pChild, p )
{
COL_fn_vStaticCollisionWithPartOfTreeForSector (_p_stEngineObj, pChild, _p_stDynamicGeoColl, _p_stStartMatrix, _p_stEndMatrix);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,234 @@
/*=========================================================================
* Model.c : This module contain all models functions
* This is a part of the Game project.
*
* Version 1.0
* Creation date 16/10/96
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1996
*=======================================================================*/
/*
*=======================================================================
Modifications: New LST2_M_??? Macros / Micha<68>l / 070297
*=======================================================================*/
/*ANNECY BBB 10/03/98 {*/
#define D_ObjsTbls_Define
/*ENDANNECY BBB 10/03/98 }*/
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/EngMode.h"
#include "Structur/ErrGame.h"
#include "Structur/MemGame.h"
#include "Structur/Objects.h"
#include "Structur/StdObjSt.h"
#include "Family.h"
#include "LoadFml.h"
#include "ZeMem.h"
#include "Structur/ObjsTbls.h"
/*-----------------------------------------------------------------------------
* Description : Desinitialize the family's structure (when the map is finish)
*-----------------------------------------------------------------------------
* Input : void
* Output : void
*-----------------------------------------------------------------------------
* Creation date : 16/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC 04/06/99 */
void fn_vLastDesinitFamilyStructure()
{
struct tdstFamilyList_ *p_stThisFamily,*p_stNextFamily;
long i;
LST2_M_DynamicForEachMovingElementOf(&g_stEngineStructure.hFamilyList,p_stThisFamily,p_stNextFamily,i)
{
LST2_M_DynamicIsolate(p_stThisFamily);
}
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC 04/06/99 */
void fn_vDesinitFamilyStructureForPriority(unsigned char ucPriority)
{
struct tdstFamilyList_ *p_stThisFamily,*p_stNextFamily;
long i;
LST2_M_DynamicForEachMovingElementOf(&g_stEngineStructure.hFamilyList,p_stThisFamily,p_stNextFamily,i)
{
if(p_stThisFamily->ucPriority==GAM_g_ucHLMMemoryBlock)
LST2_M_DynamicIsolate(p_stThisFamily);
}
}
/*-----------------------------------------------------------------------------
* Description : find or add a model
*-----------------------------------------------------------------------------
* Input : Family type
* Output : Family's pointer
*-----------------------------------------------------------------------------
* Creation date : 16/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
tdxHandleToFamilyList fn_hFindOrAddFAmily(tdObjectType otFamilyType)
{
struct tdstFamilyList_ *p_stFamily = NULL;
p_stFamily = fn_hFindFamily(otFamilyType);
/*#ifndef BIN_LoadBin // In binary mode all the families are loaded with another method*/
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_vAllocateOneMoreObjectsTablesInList(p_stFamily,100);// tmp SD Gizmo 14/04/97*/
fn_vLoadFamily(p_stFamily);
LST2_M_DynamicAddTail(&g_stEngineStructure.hFamilyList,p_stFamily);
p_stFamily->ucPriority = GAM_g_ucHLMMemoryBlock;
}
/*#endif /*BIN_LoadBin */
return(p_stFamily);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*-----------------------------------------------------------------------------
* Description : find a family
*-----------------------------------------------------------------------------
* Input : Family type
* Output : Family's pointer (NULL if not found)
*-----------------------------------------------------------------------------
* Creation date : 16/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
tdxHandleToFamilyList fn_hFindFamily(tdObjectType otFamilyType)
{
struct tdstFamilyList_ *p_stThisFamily;
long i;
LST2_M_DynamicForEachElementOf(&g_stEngineStructure.hFamilyList,p_stThisFamily,i)
{
if (p_stThisFamily->otObjectFamilyType==otFamilyType)
return(p_stThisFamily);
}
return(NULL);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
GEO_tdxHandleToBoundingSphere fn_vGetBoundingVolumeOfFamily(tdxHandleToFamilyList h_Family)
{
return(h_Family->hBoundingSphere);
}
void fn_vSetBoundingVolumeOfFamily(tdxHandleToFamilyList h_Family,GEO_tdxHandleToBoundingSphere hBV)
{
h_Family->hBoundingSphere = hBV;
}
#if defined (ACTIVE_EDITOR)
ACP_tdxHandleOfObject fn_vGetGeometricSphereOfFamily(tdxHandleToFamilyList h_Family)
{
return(h_Family->hGeometricSphere);
}
void fn_vSetGeometricSphereOfFamily(tdxHandleToFamilyList h_Family, ACP_tdxHandleOfObject hGS)
{
h_Family->hGeometricSphere = hGS;
}
#endif /*ACTIVE_EDITOR*/
/* debut GIZMO NEW 07/06/97*/
tdxHandleToObjectsTablesList fn_vGetDefaultObjectsTableOfFamily(tdxHandleToFamilyList h_Family)
{
return(h_Family->h_DefaultObjectsTable);
}
void fn_vSetDefaultObjectsTableOfFamily(tdxHandleToFamilyList h_Family,tdxHandleToObjectsTablesList h_DefaultObjectsTable)
{
h_Family->h_DefaultObjectsTable = h_DefaultObjectsTable;
}
/* fin GIZMO NEW 07/06/97*/
/*ANNECY BBB {*/
tdxHandleToObjectsTablesList fn_hGetObjectsTableOfFamilyByIndex(tdxHandleToFamilyList _hFamily, ACP_tdxIndex _xIndex)
{
ACP_tdxIndex xForMacro = 0;
tdxHandleToObjectsTablesList hTable;
LST2_M_StaticGetElementNumber(&(_hFamily->hForObjectsTablesList), hTable, _xIndex, xForMacro);
return hTable;
}
/*ANNECY BBB }*/
#ifdef _TMP_FAMILY_HANDLE_
/*-----------------------------------------------------------------------------
* Description : Add a New State To StateArray Of a Family
*-----------------------------------------------------------------------------
* Input : Handle to Family, Handle to State
* Output : Nothing
*-----------------------------------------------------------------------------
* Creation date : 27/02/97 Author : Sebastien DAVID (Gizmo)
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vAddNewStateToStateArrayOfFamily(tdxHandleToFamily h_Family, tdxHandleToState h_State)
{
LST2_M_StaticAddTail(&h_Family->hForStateArray, h_State);
}
/*-----------------------------------------------------------------------------
* Description : Remove a State From StateArray Of a Family
*-----------------------------------------------------------------------------
* Input : Handle to Family, Handle to State
* Output : Nothing
*-----------------------------------------------------------------------------
* Creation date : 27/02/97 Author : Sebastien DAVID (Gizmo)
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vRemoveStateFromStateArrayOfFamily(tdxHandleToState h_State)
{
LST2_M_StaticAddTail(&h_Family->hForStateArray, h_State);
}
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,42 @@
/*=========================================================================
* GameMain.c : Main module of the game engine
* It is in this file that the global's variables are initialized
* This is a part of the Game project.
*
* Version 1.0
* Creation date 20/08/96
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1996
*=======================================================================*/
/**** Cpa includes ****/
#define D_GameGlobals
#include "GamVers.h"
#include "ToolsCPA.h"
#include "GAM.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Structur/Input_s.h"
#include "Structur/3DOSLkTb.h"
#include "GameEng.h"
/**** Files follow are specific for each game ***/
#include "DspFix.h"
#include "GamOpt.h"
#include "GamSave.h"
/*#include "GamExtra.h"*/
/**** Gliglou qui fout son bordel dans le code 3D0S ****/
#ifndef _FIRE_DEADCODE_U64_
GLD_tdhDevice hDevice;
#endif /* _FIRE_DEADCODE_U64_ */
#include "Structur/Input_s.h"
#undef D_GameGlobals

View File

@@ -0,0 +1,100 @@
/*=========================================================================
* HitPts.c : Hit points.
* This is a part of the Game project.
*
* Version 1.0
* Creation date 15/05/97
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1997
*=======================================================================*/
#include "ToolsCPA.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/Objects.h"
#include "HitPts.h"
#include "InitEng.h"
#include "GameEng.h"
#include "ObjInit.h"
/**************************************************************************/
unsigned char fn_ucGetHitPoints(struct tdstEngineObject_ *_p_stObject)
{
return(fn_ucStandardGameGetHitPoints(_p_stObject->h_StandardGame));
}
/**************************************************************************/
void fn_vSetHitPointsInit(struct tdstEngineObject_ *_p_stObject,unsigned char _ucValue)
{
fn_vStandardGameSetHitPointsInit ( _p_stObject -> h_StandardGame , _ucValue ) ;
}
/**************************************************************************/
void fn_vSetHitPoints(struct tdstEngineObject_ *_p_stObject,unsigned char _ucValue)
{
fn_vStandardGameSetHitPoints(_p_stObject->h_StandardGame,_ucValue);
}
/**************************************************************************/
void fn_vSetHitPointsToMaxValue(struct tdstEngineObject_ *_p_stObject)
{
fn_vStandardGameSetHitPoints(_p_stObject->h_StandardGame,fn_ucStandardGameGetHitPointsMax(_p_stObject->h_StandardGame));
}
/**************************************************************************/
void fn_vAddHitPoints(struct tdstEngineObject_ *_p_stObject,unsigned char _ucValue)
{
if (fn_ucStandardGameGetHitPoints(_p_stObject->h_StandardGame)+_ucValue<=fn_ucStandardGameGetHitPointsMax(_p_stObject->h_StandardGame))
fn_vStandardGameSetHitPoints(_p_stObject->h_StandardGame,(unsigned char)(fn_ucStandardGameGetHitPoints(_p_stObject->h_StandardGame)+_ucValue));
else
fn_vStandardGameSetHitPoints(_p_stObject->h_StandardGame,fn_ucStandardGameGetHitPointsMax(_p_stObject->h_StandardGame));
}
/**************************************************************************/
unsigned char fn_ucSubHitPoints(struct tdstEngineObject_ *_p_stObject,unsigned char _ucValue)
{
if ((long)fn_ucStandardGameGetHitPoints(_p_stObject->h_StandardGame)-(long)_ucValue>0)
fn_vStandardGameSetHitPoints(_p_stObject->h_StandardGame,(unsigned char)(fn_ucStandardGameGetHitPoints(_p_stObject->h_StandardGame)-_ucValue));
else
{
fn_vStandardGameSetHitPoints(_p_stObject->h_StandardGame,0);
}
return(fn_ucStandardGameGetHitPoints(_p_stObject->h_StandardGame));
}
/**************************************************************************/
unsigned char fn_ucGetHitPointsMax(struct tdstEngineObject_ *_p_stObject)
{
return(fn_ucStandardGameGetHitPointsMax(_p_stObject->h_StandardGame));
}
/**************************************************************************/
void fn_vSetHitPointsMax(struct tdstEngineObject_ *_p_stObject,unsigned char _ucValue)
{
fn_vStandardGameSetHitPointsMax(_p_stObject->h_StandardGame,_ucValue);
}
/**************************************************************************/
void fn_vSetHitPointsMaxToMaxValue(struct tdstEngineObject_ *_p_stObject)
{
fn_vStandardGameSetHitPointsMax(_p_stObject->h_StandardGame,fn_ucStandardGameGetHitPointsMaxMax(_p_stObject->h_StandardGame));
}
/**************************************************************************/
void fn_vAddHitPointsMax(struct tdstEngineObject_ *_p_stObject,unsigned char _ucValue)
{
if (fn_ucStandardGameGetHitPointsMax(_p_stObject->h_StandardGame)+_ucValue<=fn_ucStandardGameGetHitPointsMaxMax(_p_stObject->h_StandardGame))
fn_vStandardGameSetHitPointsMax(_p_stObject->h_StandardGame,(unsigned char)(fn_ucStandardGameGetHitPointsMax(_p_stObject->h_StandardGame)+_ucValue));
else
fn_vStandardGameSetHitPointsMax(_p_stObject->h_StandardGame,fn_ucStandardGameGetHitPointsMaxMax(_p_stObject->h_StandardGame));
}
/**************************************************************************/
unsigned char fn_ucSubHitPointsMax(struct tdstEngineObject_ *_p_stObject,unsigned char _ucValue)
{
if ((long)fn_ucStandardGameGetHitPointsMax(_p_stObject->h_StandardGame)-(long)_ucValue>0)
fn_vStandardGameSetHitPointsMax(_p_stObject->h_StandardGame,(unsigned char)(fn_ucStandardGameGetHitPointsMax(_p_stObject->h_StandardGame)-_ucValue));
else
{
fn_vStandardGameSetHitPointsMax(_p_stObject->h_StandardGame,0);
}
fn_vAddHitPoints(_p_stObject,0);
return(fn_ucStandardGameGetHitPointsMax(_p_stObject->h_StandardGame));
}
/**************************************************************************/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,889 @@
/*=========================================================================
* Input.cpp : Contain the pad structure.
* This is a part of the Game project.
*
* Version 1.0
* Creation date 22/08/96
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1996
*=======================================================================*/
//#define DEMO
#if defined(WIN32)
#include <stdio.h>
#endif /* WIN32 */
#include "ToolsCPA.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/EngMode.h"
#include "Structur/ErrGame.h"
#include "Structur/Input_S.h"
#include "Structur/StdObjSt.h"
#include "Structur/Objects.h"
#include "Ai\AiBase\WPEngDsp.h"
#include "Always.h"
#include "Basic.h"
#include "Input.h"
#include "InitEng.h"
#include "GameEng.h"
#include "GamOpt.h"
#include "ObjInit.h"
#include "ObjType.h"
#include "Zemem.h"
#include "Mainchar.h"
#include "prf.h"
#if !defined(U64)
#include "SnapShot.h"
#endif /* U64 */
#ifdef GAME_MENUS
#endif /* GAME_MENUS */
extern BOOL g_bAnimConstantSpeed;
#define D_3dData_StructureDefine
#include "LipsSync.h"
#include "micros.h"
#include "actions\3dData.h"
#ifdef U64
#include "u_boot.h"
#include "u_cfb.h"
#include "U_zbuf.h"
#include "GLD/Specif/u_vpt.h" /*AR9810*/
#endif /*U64*/
#ifndef RETAIL
#include "PlayAnim/interpol/a3x_Mem.h"
#endif
#ifdef GAM_USE_SNA
#include "SNA\snaglob.h"
#endif /* GAM_USE_SNA*/
/* XB 05/05/99 */
extern void GAM_fn_vEventuallyRecordDemo(void);
extern void fn_vSwitchToDemoLevel(void);
/* End XB 05/05/99 */
/**************************************************************************/
extern GAM_fn_vClearWindowRaster();
extern unsigned char g_ucZDCVisible;
extern unsigned char g_ucDisplayBoundingVolumes;
#if defined(_DEBUG)
extern unsigned char g_ucWhatDoIDisplay;
#endif /* _DEBUG */
#if !defined(U64) && defined(_DEBUG)
extern unsigned char g_ucSlowDownEngine;
extern unsigned char g_ucSlowDownTime;
#endif /* !U64 && _DEBUG */
#if defined(GAM_USE_SCRIPT)
SCR_tde_Anl_ReturnValue fn_eScriptCallBackIPTLink(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;
unsigned long ulNumberOfEntry;
IPT_tdxHandleToEntryElement hCurrentEntry;
if (M_IsTitle)
{
SCR_M_RdL0_SetSectionLong(C_ThisSection,0,0);
}
else if (M_IsEntry)
{
if (M_ActionIs(C_Entry_IPTLink))
{
if( stricmp(_ap_szParams[0],"ForAllVersion")
#if defined(WIN32)
||stricmp(_ap_szParams[0],"ForPc")
#endif /* WIN32 */
)
{
hCurrentEntry = IPT_fn_hGetEntryActionHandle(_ap_szParams[0]);
SCR_M_RdL0_GetSectionLong(C_ThisSection,0,unsigned long,ulNumberOfEntry);
*((IPT_tdxHandleToEntryElement*)&g_st_3DOS_EntryActions+ulNumberOfEntry) = hCurrentEntry;
ulNumberOfEntry++;
SCR_M_RdL0_SetSectionLong(C_ThisSection,0,ulNumberOfEntry);
}
}
}
else if (M_IsEnd)
{
SCR_M_RdL0_GetSectionLong(C_ThisSection,0,unsigned long,ulNumberOfEntry);
if (ulNumberOfEntry!=sizeof(struct tdst_EntryActions_)/sizeof(IPT_tdxHandleToEntryElement))
M_GameFatalError(E_uwGameScriptBadIPTLinkNumber);
}
return(eReturnValue);
}
#endif /* GAM_USE_SCRIPT */
/**** Useful for displaying extra datas ****/
unsigned char g_ucDisplayWaypoints = 0;
#if !defined(U64) && defined(_DEBUG)
unsigned char g_ucDisplayRayTraceSegments = 0;
short g_wRayTraceSegmentLife[30] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
MTH3D_tdstVector g_stRayTraceSegmentOrigin[30];
MTH3D_tdstVector g_stRayTraceSegmentEnd[30];
#endif /* !U64 && _DEBUG */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
unsigned char g_ucDisplayBoundingVolumes = 0;
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/* ANNECY CG KEY 4 ACTIVATED GENDOORS 18/06/98 {*/
unsigned char g_ucDisplayActivatedGendoors;
#ifndef U64
extern unsigned char ucIsInitDone;
extern unsigned char ucIsInitDone4Gendoors;
#endif
#if defined(__cplusplus)
extern "C"
{
#endif /* __cplusplus */
unsigned char g_ucDisplayCenters;
#if defined(__cplusplus)
}
#endif /* __cplusplus */
/* } ENDANNECY CG*/
#ifdef PROFILE_IA
extern void dumpCond();
extern void dumpFunc();
extern void dumpProc();
extern void clearCond();
extern void clearFunc();
extern void clearProc();
#endif /* PROFILE_IA*/
/****************** FabPerez Cheat Code *****************/
#if defined(WIN32) && defined(_DEBUG)
#define D_IPT_Input_StructureDefine
#include "IPT/IPT_KDef.h"
#include "IPT/IPT_Str.h"
#undef D_IPT_Input_StructureDefine
extern IPT_tdxHandleToKeyWordElement g_hKeyWordElement;
extern IPT_tdxHandleToEntryElement g_h_ActualEntryInput;
extern g_iXValueCheat, g_iYValueCheat;
void AnalyseCheatCode(void);
void fnIncDeltaTime(BOOL INC_DELTA);
void fnInvertPad(BOOL INVERT_PAD);
void fnRandomPad(BOOL RANDOM_PAD);
#define PRF_C_lMaxNbCheatCodeVariable 4
#define CHEAT_CODE0 0
#define CHEAT_CODE_DELTA_TIME 1
#define CHEAT_CODE_INVERT_PAD 2
#define CHEAT_CODE_RANDOM_PAD 3
BOOL g_CheatCodeActivate = FALSE;
BOOL a_lCheatCodeVariable[PRF_C_lMaxNbCheatCodeVariable] = {FALSE, FALSE, FALSE, FALSE};
BOOL IsActiveCheatCode(unsigned long ulCurrentCheatCode);
void (*a_p_fnCheatCodeFonction[PRF_C_lMaxNbCheatCodeVariable] )(BOOL)= {NULL, fnIncDeltaTime, fnInvertPad, fnRandomPad};
unsigned long g_ulCurrentCheatCode = 0;
#endif //(WIN32) &(_DEBUG)
/****************** Fin FabPerez Cheat Code *****************/
/****************** FabPerez Cheat Code *****************/
#if defined(WIN32) && defined(_DEBUG)
void AnalyseCheatCode(void)
{
int i;
int CurrentCheatCode, PrecedentCheatCode;
if(g_ulCurrentCheatCode != 0)
{
if(g_ulCurrentCheatCode == PRF_C_lMaxNbCheatCodeVariable || g_ulCurrentCheatCode == 1)
{
g_ulCurrentCheatCode = 1;
CurrentCheatCode = 1;
PrecedentCheatCode = PRF_C_lMaxNbCheatCodeVariable-1;
}
else
{
CurrentCheatCode = g_ulCurrentCheatCode;
PrecedentCheatCode = g_ulCurrentCheatCode-1;
}
a_lCheatCodeVariable[PrecedentCheatCode] = FALSE;
a_lCheatCodeVariable[CurrentCheatCode] = TRUE;
}
else // Desactive tous les CheatCodes
{
for(i=1; i < PRF_C_lMaxNbCheatCodeVariable; i++)
{
a_lCheatCodeVariable[i] = FALSE;
}
}
}
BOOL IsActiveCheatCode(unsigned long ulCurrentCheatCode)
{
return a_lCheatCodeVariable[ulCurrentCheatCode];
}
void fnInvertPad(BOOL INVERT_PAD)
{
if(INVERT_PAD)
{
g_iXValueCheat = -g_iXValueCheat;
g_iYValueCheat = -g_iYValueCheat;
}
}
void fnRandomPad(BOOL RANDOM_PAD)
{
double Test;
if(RANDOM_PAD)
{
Test = ((double) rand() *2) / ((double) RAND_MAX) ;
g_iXValueCheat *= Test;
g_iYValueCheat *= Test;
}
}
void fnIncDeltaTime(BOOL INC_DELTA)
{
u_long ulTmpValue;
stTimerCount stRealTimeCountTmp;
unsigned long ulDeltaTime;
if(INC_DELTA)
{
fn_wTimerRead(g_stEngineStructure.stEngineTimer.sTimerHandle,&stRealTimeCountTmp);
if ( stRealTimeCountTmp.m_ulHighPart == g_stEngineStructure.stEngineTimer.stRealTimeCount.m_ulHighPart )
{
ulDeltaTime = stRealTimeCountTmp.m_ulLowPart - g_stEngineStructure.stEngineTimer.stRealTimeCount.m_ulLowPart;
}
else
{
if ( stRealTimeCountTmp.m_ulLowPart >= g_stEngineStructure.stEngineTimer.stRealTimeCount.m_ulLowPart )
ulDeltaTime = stRealTimeCountTmp.m_ulLowPart - g_stEngineStructure.stEngineTimer.stRealTimeCount.m_ulLowPart;
else
{
ulDeltaTime = stRealTimeCountTmp.m_ulLowPart + (0xffffffff - g_stEngineStructure.stEngineTimer.stRealTimeCount.m_ulLowPart + 1);
}
}
if ( g_stEngineStructure.stEngineTimer.stRealTimeCount.m_ulLowPart >= ulDeltaTime )
g_stEngineStructure.stEngineTimer.stRealTimeCount.m_ulLowPart -= ulDeltaTime;
else
{
g_stEngineStructure.stEngineTimer.stRealTimeCount.m_ulLowPart -= ulDeltaTime;
//g_stEngineStructure.stEngineTimer.stRealTimeCount.m_ulLowPart += 0xffffffff - ulDeltaTime + 1;
g_stEngineStructure.stEngineTimer.stRealTimeCount.m_ulHighPart--;
}
}
/*
typedef struct tdstEngineTimerStructure_
{
unsigned long ulTrameNumber; // Number of the frame
short sTimerHandle;
unsigned long ulCurrentTimerCount; // Current trame timer in msec
unsigned long ulDeltaTimerCount; //Between two trames in msec
unsigned long a_ulCounter[C_NumberOfCounter]; // Other frequencies counters
unsigned long ulUsefulDeltaTime; // computed time in msec
unsigned long ulPauseTime; // When engine is in pause
MTH_tdxReal xFrameLength; // frame length in s ( 60Hz -> 1/60 s )
#ifndef U64
struct _stTimerCount stRealTimeCount; // Current trame timer in tick
struct _stTimerCount stPauseTime;
unsigned long ulTickPerMS;
#endif // U64
} tdstEngineTimerStructure;
typedef struct _stTimerCount
{
u_long m_ulLowPart;
u_long m_ulHighPart;
} stTimerCount
*/
}
#endif //(WIN32) &(_DEBUG)
/****************** Fin FabPerez Cheat Code *****************/
/**************************************************************************/
void fn_vAnalyse3DOSSpecialInputActions(void)
{
#if (defined(U64) && (!defined(FINAL_VERSION) || defined(FINAL_VERSION_FOR_TESTERS))) || (!defined(U64) && !defined(FINAL_VERSION) && !defined(RETAIL))
/*************************************/
/**** Toggle Solid/Wire rendering ****/
/*************************************/
#if !defined(PRESS_DEMO)
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hDisplayModeToggle)==IPT_C_TRUE)
{
if(g_stEngineStructure.ulDisplayMode & 0x00000004) /*We are in Draw Solid Mode*/
{
g_stEngineStructure.ulDisplayMode &= ~0x00000004;
}
else
{
g_stEngineStructure.ulDisplayMode |= 0x00000004;
}
}
#endif /* PRESS_DEMO */
/********************************/
/**** Displays Sectors infos ****/
/********************************/
#if !defined(PRESS_DEMO)
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hDisplaySectorInfos)==IPT_C_TRUE)
{
/*--- 0 : No display*/
/*--- 1 : Displays VISIBLE interaction*/
/*--- 2 : Displays COLLISION interaction*/
/*--- 3 : Displays ACTIVITY interaction*/
/*--- 4 : Displays SOUND interaction*/
g_ucSCTDisplaySectors = (unsigned char) (( g_ucSCTDisplaySectors + 1 ) % 5);
}
#endif /* PRESS_DEMO */
/****************************/
/**** Displays WayPoints ****/
/****************************/
#if !defined(PRESS_DEMO)
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hDisplayWaypoints)==IPT_C_TRUE)
{
/* ANNECY AV {*/
#ifdef GAM_USE_SNA
if (SNA_fn_ucGetLoadType () != SNA_LOAD_SNAPSHOT) /* Don't show waypoints in binarized version*/
#endif /* GAM_USE_SNA*/
/* END ANNECY AV } // (because this needs a script load)*/
{
/*--- 0 : No display*/
/*--- 1 : Displays waypoints*/
g_ucDisplayWaypoints = (unsigned char)((g_ucDisplayWaypoints + 1) % 2);
}
}
#endif /* PRESS_DEMO */
/************************************/
/**** Displays RayTrace segments ****/
/************************************/
#if !defined(PRESS_DEMO)
#if !defined(U64) && defined(_DEBUG)
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hDisplayRayTraceSegments)==IPT_C_TRUE)
{
/*--- 0 : No display*/
/*--- 1 : Display RayTrace Segments*/
g_ucDisplayRayTraceSegments = (unsigned char) (( g_ucDisplayRayTraceSegments + 1 ) % 2);
}
#endif /* !U64 && _DEBUG */
#endif /* PRESS_DEMO */
/*******************************************
* Displays Activated Gendoors 18/06/98 *
*******************************************/
#if !defined(PRESS_DEMO)
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hDisplayActivatedGendoors)==IPT_C_TRUE)
{
g_ucDisplayActivatedGendoors =(unsigned char) ((g_ucDisplayActivatedGendoors + 1) % 2);
}
#endif /* PRESS_DEMO */
/*******************************************
* Clear options displayed 20/10/98 *
*******************************************/
#if !defined(PRESS_DEMO)
/* Oliv' - Portage v14*/
#ifndef U64
/* EndOfOliv'*/
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hClearOptionsDisplayed)==IPT_C_TRUE)
{
#ifdef USE_PROFILER
unsigned long ulRasterDisplayMode;
#endif
g_ucDisplayActivatedGendoors = 0; /* Clear Gendoors*/
g_ucDisplayWaypoints = 0; /* Clear WayPoints*/
#if !defined(U64) && defined(_DEBUG)
g_ucDisplayRayTraceSegments = 0; /* Clear RayTrace segments*/
#endif /* !U64 && _DEBUG */
g_ucZDCVisible = 0; /* Clear Zones*/
g_ucSCTDisplaySectors = 0; /* Clear Sectors infos*/
g_ucDisplayBoundingVolumes = 0; /* Clear Bouding Volume*/
g_stEngineStructure.ulDisplayMode |= 0x00000004; /* Toggle Mode*/
/**** Clear rasters ****/
PRF_fn_vSetIndependantVariable (PRF_C_ulIdpCurrentPage,0);
/**** Static/dynamic ****/
#if defined(_DEBUG)
g_ucWhatDoIDisplay = 0;
#endif /* _DEBUG */
#ifdef USE_PROFILER
ulRasterDisplayMode = PRF_fn_lGetIndependantVariable(PRF_C_ulIdpRasterDisplayMode);
ulRasterDisplayMode &= ~PRF_C_ulShowAll;
ulRasterDisplayMode |= PRF_C_ulShowAll;
PRF_fn_vSetIndependantVariable( PRF_C_ulIdpRasterDisplayMode , ulRasterDisplayMode );
#endif
}
/* Oliv' - Portage v14*/
#endif
/* EndOfOliv'*/
#endif /* PRESS_DEMO */
#if !defined(PRESS_DEMO)
#ifdef PROFILE_IA
if (GetAsyncKeyState(VK_HOME) & 0x8000)
{
clearCond();
clearFunc();
clearProc();
}
if (GetAsyncKeyState(VK_INSERT) & 0x8000)
{
dumpCond();
dumpFunc();
dumpProc();
}
#endif /* PROFILE_IA*/
#endif /* PRESS_DEMO */
#if !defined(U64)
#ifndef RETAIL
#if !defined(PRESS_DEMO)
#if defined(_DEBUG)
/*******************/
/* Slowdown engine */
/*******************/
if (GetAsyncKeyState('A') & 0x8001)
{
if (g_ucSlowDownEngine)
{
if (GetAsyncKeyState (VK_CONTROL) & 0x8000)
{
if (g_ucSlowDownTime < 255 - (g_stEngineStructure.stEngineTimer.xFrameLength * 1000)) g_ucSlowDownTime += (g_stEngineStructure.stEngineTimer.xFrameLength * 1000);
}
else if (GetAsyncKeyState (VK_SHIFT) & 0x8000)
{
if (g_ucSlowDownTime > (g_stEngineStructure.stEngineTimer.xFrameLength * 1000)) g_ucSlowDownTime -= (g_stEngineStructure.stEngineTimer.xFrameLength * 1000);
else g_ucSlowDownTime = 0;
}
else
{
g_ucSlowDownEngine = 1 - g_ucSlowDownEngine;
}
}
else
{
g_ucSlowDownEngine = 1 - g_ucSlowDownEngine;
}
}
#endif /* _DEBUG */
#endif /* PRESS_DEMO */
/**************************/
/**** Screen snap shot ****/
/**************************/
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hScreenSnapShot)==IPT_C_TRUE)
fn_vGetAndSaveSnapShotOfScreenAsBMP();
#if !defined(PRESS_DEMO)
/* ANNECY AV DEMO {*/
/**************************/
/**** Demo Keys ****/
/**************************/
{
static int bRecordKeyPressed = FALSE;
static int bPlayKeyPressed = FALSE;
static int bSaveKeyPressed = FALSE;
static int bLoadKeyPressed = FALSE;
static int bVCRKeyPressed = FALSE;
if ((GetAsyncKeyState ('E') & 0x8000) && (GetAsyncKeyState (VK_CONTROL) & 0x8000) && (GetAsyncKeyState (VK_SHIFT) & 0x8000))
{
if (bRecordKeyPressed == FALSE)
{
bRecordKeyPressed = TRUE;
fn_vReinitTheMap();
if(g_DEMO_KeybTest == DEMO_PLAY) g_DEMO_KeybTest = DEMO_NOTHING;
else DEMO_fn_vPrepareForWrite ();
}
}
else bRecordKeyPressed = FALSE;
if ((GetAsyncKeyState ('L') & 0x8000) && (GetAsyncKeyState (VK_CONTROL) & 0x8000) && (GetAsyncKeyState (VK_SHIFT) & 0x8000))
{
if (bPlayKeyPressed == FALSE)
{
bPlayKeyPressed = TRUE;
fn_vReinitTheMap ();
DEMO_fn_vSetTestInputDuringDemo (TRUE);
DEMO_fn_vSetMapToLoadWhenDemoFinished ("");
DEMO_fn_vPrepareForRead (0);
}
}
else bPlayKeyPressed = FALSE;
if ((GetAsyncKeyState ('S') & 0x8000) && (GetAsyncKeyState (VK_CONTROL) & 0x8000) && (GetAsyncKeyState (VK_SHIFT) & 0x8000))
{
if (bSaveKeyPressed == FALSE)
{
bSaveKeyPressed = TRUE;
DEMO_fn_vSaveToFile ();
g_DEMO_KeybTest = DEMO_NOTHING;
}
}
else bSaveKeyPressed = FALSE;
if ((GetAsyncKeyState ('C') & 0x8000) && (GetAsyncKeyState (VK_CONTROL) & 0x8000) && (GetAsyncKeyState (VK_SHIFT) & 0x8000))
{
if (bLoadKeyPressed == FALSE)
{
bLoadKeyPressed = TRUE;
DEMO_fn_vLoadFromFile ("Demos\\Demo000.Sav");
}
}
else bLoadKeyPressed = FALSE;
if ((GetAsyncKeyState ('V') & 0x8000) && (GetAsyncKeyState (VK_CONTROL) & 0x8000) && (GetAsyncKeyState (VK_SHIFT) & 0x8000))
{
if (bVCRKeyPressed == FALSE)
{
bVCRKeyPressed = TRUE;
DEMO_fn_vSwitchVCRMode ();
}
}
else bVCRKeyPressed = FALSE;
}
#endif /* PRESS_DEMO */
#endif /* !RETAIL ? */
/* END ANNECY AV }*/
#endif /*!defined(U64)*/
/****************** FabPerez Cheat Code *****************/
#if !defined(PRESS_DEMO)
#if defined(WIN32) && defined(_DEBUG)
if ((GetAsyncKeyState ('C') & 0x8000) && (GetAsyncKeyState (VK_SHIFT) & 0x8000))
{
g_CheatCodeActivate = TRUE;
++g_ulCurrentCheatCode;
AnalyseCheatCode();
}
else if((GetAsyncKeyState ('C') & 0x8000) && (GetAsyncKeyState (VK_CONTROL) & 0x8000))
{
g_CheatCodeActivate = TRUE;
g_ulCurrentCheatCode = 0;
AnalyseCheatCode();
}
#endif /*WIN32 _DEBUG*/
#endif /* PRESS_DEMO */
/***************** Fin FabPerez Cheat Code *****************/
/********************/
/**** Pause Mode ****/
/********************/
/* ANNECY AV {*/
/*
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hPause)==IPT_C_TRUE)
{
if (!fn_bIsEngineInPause())
fn_vSetEngineInPaused();
else
fn_vResetEngineFromPaused();
}
if (g_stEngineStructure.eEngineMode==EM_ModePlaying)
{
// ************************ Oliv' - Portage v15 : remove 1 warning here
// *** Display Fix Mode *** Oliv' - Portage v15 : remove 1 warning here
// ************************ Oliv' - Portage v15 : remove 1 warning here
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hDisplayFixMode)==IPT_C_TRUE)
{
if (g_stEngineStructure.eDisplayFixMode==DFM_DisplayAll)
fn_vSetDisplayFixFlag(DFM_DisplayNothing);
else if (g_stEngineStructure.eDisplayFixMode==DFM_DisplayNothing)
fn_vSetDisplayFixFlag(DFM_DisplayAll);
}
}
*/
/* END ANNECY AV }*/
/******************************************************/
/**** Restart map when loaded and when player dead ****/
/******************************************************/
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hReinitTheMap)==IPT_C_TRUE)
{
/*FB101298*/
#ifndef U64
if (g_DEMO_KeybTest == DEMO_PLAY) DEMO_fn_vStopWhenPlaying();
#endif /*U64*/
/*END FB*/
if (!g_stEngineStructure.bEngineFrozen)
fn_vReinitTheMap();
}
#if !defined(PRESS_DEMO)
/*HP 071098 */
#ifdef U64
/* Marc:Begin */
#ifdef DEMO
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hRecordDemo)==IPT_C_TRUE)
{
char *szName=fn_p_szGetLevelName();
GAM_fn_vEventuallyRecordDemo();
fn_vSetNextLevelName(szName);
fn_vChangeEngineMode(EM_ModeChangeLevel);
// fn_vReinitTheMap();
}
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hPlayDemo)==IPT_C_TRUE)
{
INO_fn_vU64PlayDemo();
fn_vSwitchToDemoLevel();
/* GAM_fn_vLaunchDemoMode(); */
}
#endif /* DEMO */
#endif /* U64 */
#endif /* PRESS_DEMO */
#if !defined(PRESS_DEMO)
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hDisplayLight)==IPT_C_TRUE)
g_bShowLight=(unsigned char)(1-g_bShowLight);
#endif /* PRESS_DEMO */
/* ANNECY AV {*/
/*
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hTestMemory)==IPT_C_TRUE)
fn_vGameTestMemory();
*/
/* END ANNECY AV }*/
/******************************************************/
/**** change map menu ****/
/******************************************************/
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hChooseLevel)==IPT_C_TRUE)
if (g_stEngineStructure.ucNumberOfLevels > 1)
g_cChooseLevel = 0;
if (g_cChooseLevel > -1)
{
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hChooseLevelUp)==IPT_C_TRUE)
{
g_cChooseLevel = (char) ((g_cChooseLevel + 1) % g_stEngineStructure.ucNumberOfLevels);
}
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hChooseLevelDown)==IPT_C_TRUE)
{
g_cChooseLevel = (char)((g_cChooseLevel + g_stEngineStructure.ucNumberOfLevels - 1) % g_stEngineStructure.ucNumberOfLevels);
}
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hChooseLevelValidate)==IPT_C_TRUE)
{
#ifndef U64
ucIsInitDone4Gendoors = 0;
ucIsInitDone = 0;
#endif
g_ucDisplayActivatedGendoors = 0;
g_ucDisplayCenters = 0;
g_ucDisplayWaypoints = 0;
GAM_fn_vAskToChangeLevel( g_stEngineStructure.a_szLevelName[ g_cChooseLevel ] , TRUE );
g_cChooseLevel = -1;
}
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hChooseLevelInvalidate)==IPT_C_TRUE)
{
g_cChooseLevel = -1;
}
}
/* ANNECY AV {*/
/*
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hConstantAnimSpeed)==IPT_C_TRUE)
{
g_bAnimConstantSpeed=1-g_bAnimConstantSpeed;
}
*/
#if !defined(PRESS_DEMO)
/* END ANNECY AV }*/
#ifndef RETAIL
/******************************************************/
/**** Anim Stack Log ****/
/******************************************************/
#ifdef GAM_USE_SCRIPT
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hMemoryStackLog)==IPT_C_TRUE) {
FILE * fLogFile;
/* open file in appending mode and add log*/
fLogFile = fopen("AnimStack.log","a");
if (fLogFile) {
fprintf(fLogFile,"=========> MAP : %s\n",g_stEngineStructure.szLevelName);
fn_vAnimStackLog(fLogFile);
fclose(fLogFile);
}
}
#endif /* GAM_USE_SCRIPT*/
#endif /* RETAIL */
#endif /* PRESS_DEMO */
#endif /* (defined(U64) && (!defined(FINAL_VERSION) || defined(FINAL_VERSION_FOR_TESTERS))) || (!defined(U64) && !defined(FINAL_VERSION) && !defined(RETAIL)) */
}
#define M_SwapFlag(lVar,lFlag) PRF_fn_vSetIndependantVariable( lVar , (PRF_fn_lGetIndependantVariable(lVar) & lFlag) ? (PRF_fn_lGetIndependantVariable(lVar) & ~lFlag) \
: (PRF_fn_lGetIndependantVariable(lVar) | lFlag) )
#define M_IsFlag(lVar,lFlag) (PRF_fn_lGetIndependantVariable(lVar) & lFlag ? TRUE : FALSE)
#define M_SetFlag(lVar,lFlag) PRF_fn_vSetIndependantVariable( lVar , (PRF_fn_lGetIndependantVariable(lVar) | lFlag) )
/**************************************************************************/
void fn_vEngineReadInput(void)
{
if (g_stEngineStructure.eInputMode==IM_Normal)
{
IPT_fn_vReadInput();
fn_vAnalyse3DOSSpecialInputActions();
#ifndef U64
#ifdef USE_PROFILER
/* page*/
PRF_fn_vSetIndependantVariable(PRF_C_ulIdpVirtualKey, -1 );
#if !defined(PRESS_DEMO)
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hDisplayRaster)==IPT_C_TRUE)
{
if (! (GetAsyncKeyState( VK_RMENU) & 0x8000))
{
if (GetAsyncKeyState (VK_CONTROL) & 0x8000)
{
if ( !(GetAsyncKeyState (VK_SHIFT) & 0x8000) )
PRF_fn_lIncIndependantVariable (PRF_C_ulIdpAdvancedPage, 1); /* Activate/Disactivate advanced raster display mode*/
else
M_SwapFlag(PRF_C_ulIdpRasterDisplayMode, PRF_C_ulChangeActor); /* */
}
else
if (GetAsyncKeyState (VK_SHIFT) & 0x8000)
PRF_fn_lIncIndependantVariable (PRF_C_ulIdpCurrentPage,-1); /* Decreaze raster display mode number*/
else
PRF_fn_lIncIndependantVariable (PRF_C_ulIdpCurrentPage, 1); /* Increaze raster display mode number*/
/* clear screen*/
M_SetFlag(PRF_C_ulIdpRasterDisplayMode , PRF_C_ulClearScreen);
}
}
else if ( IPT_fn_bIsValidated(g_st_3DOS_EntryActions.hDisplayRaster) )
{
if (GetAsyncKeyState( VK_RMENU ) & 0x8000)
{
long lAsyncState;
if ( ((lAsyncState = GetAsyncKeyState(VK_RETURN)) & 0x8000) && !(lAsyncState & 1) )
PRF_fn_vSetIndependantVariable(PRF_C_ulIdpVirtualKey, VK_RETURN );
if ( ((lAsyncState = GetAsyncKeyState(VK_BACK)) & 0x8000) && !(lAsyncState & 1) )
PRF_fn_vSetIndependantVariable(PRF_C_ulIdpVirtualKey, VK_BACK );
/*
if ( ((lAsyncState = GetAsyncKeyState(VK_LEFT)) & 0x8000) && !(lAsyncState & 1) )
PRF_fn_vSetIndependantVariable(PRF_C_ulIdpVirtualKey, VK_LEFT );
if ( ((lAsyncState = GetAsyncKeyState(VK_UP)) & 0x8000) && !(lAsyncState & 1) )
PRF_fn_vSetIndependantVariable(PRF_C_ulIdpVirtualKey, VK_UP );
if ( ((lAsyncState = GetAsyncKeyState(VK_RIGHT)) & 0x8000) && !(lAsyncState & 1) )
PRF_fn_vSetIndependantVariable(PRF_C_ulIdpVirtualKey, VK_RIGHT );
if ( ((lAsyncState = GetAsyncKeyState(VK_DOWN)) & 0x8000) && !(lAsyncState & 1) )
PRF_fn_vSetIndependantVariable(PRF_C_ulIdpVirtualKey, VK_DOWN );
*/
}
}
/* mode*/
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hDisplayRasterPCU64)==IPT_C_TRUE)
{
if (GetAsyncKeyState (VK_CONTROL) & 0x8000)
{
if (M_IsFlag(PRF_C_ulIdpRasterDisplayMode, PRF_C_ulVariableMode))
{
M_SwapFlag(PRF_C_ulIdpRasterDisplayMode, PRF_C_ulVariableMode); /* Show/hide variable page*/
M_SwapFlag(PRF_C_ulIdpRasterDisplayMode, PRF_C_ulShowPGMMode); /* Show/hide variable page*/
}
else if (M_IsFlag(PRF_C_ulIdpRasterDisplayMode, PRF_C_ulShowPGMMode))
{
M_SwapFlag(PRF_C_ulIdpRasterDisplayMode, PRF_C_ulShowPGMMode);
}
else
{
M_SwapFlag(PRF_C_ulIdpRasterDisplayMode, PRF_C_ulVariableMode); /* Show/hide variable page*/
}
}
else if (GetAsyncKeyState (VK_SHIFT) & 0x8000)
{
if( (PRF_fn_lGetIndependantVariable (PRF_C_ulIdpRasterDisplayMode) & PRF_C_ulSuperImposed) )
GAM_fn_vClearWindowRaster();
M_SwapFlag(PRF_C_ulIdpRasterDisplayMode, PRF_C_ulSuperImposed); /* Show/hide variable page*/
}
else
{
M_SwapFlag(PRF_C_ulIdpRasterDisplayMode, PRF_C_ulU64Mode);
if( !(PRF_fn_lGetIndependantVariable (PRF_C_ulIdpRasterDisplayMode) & PRF_C_ulU64Mode) )
M_SwapFlag(PRF_C_ulIdpRasterDisplayMode, PRF_C_ulFinalMode);
}
/* clear screen*/
M_SetFlag(PRF_C_ulIdpRasterDisplayMode , PRF_C_ulClearScreen);
}
/* collumn*/
if (IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hDisplayRasterMode)==IPT_C_TRUE)
{
if (GetAsyncKeyState (VK_CONTROL) & 0x8000) M_SwapFlag(PRF_C_ulIdpRasterDisplayMode, PRF_C_ulShowMaximum); /* Ctrl +F3 : show/hide max*/
else if (GetAsyncKeyState (VK_SHIFT) & 0x8000) M_SwapFlag(PRF_C_ulIdpRasterDisplayMode, PRF_C_ulShowAverage); /* Shift+F3 : show/hide average*/
else M_SwapFlag(PRF_C_ulIdpRasterDisplayMode, PRF_C_ulShowCurrent); /* +F3 : show/hide current*/
/* clear screen*/
M_SetFlag(PRF_C_ulIdpRasterDisplayMode , PRF_C_ulClearScreen);
}
#endif /* PRESS_DEMO */
#endif /* USE_PROFILER */
#endif /* U64*/
}
}
/**************************************************************************/

View File

@@ -0,0 +1,79 @@
#ifdef D_USE_LIPSYNC
/*=========================================================================
* LSYbase.c : MEmory management of the LipsSynchs
*
* Version 1.0
* Creation date 27/05/97
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi R&D 1997
*=======================================================================*/
/*
*=======================================================================
Modifications:
*=======================================================================*/
#include "LSerm.h"
#include "LSmem.h"
#pragma warning( disable : 4127 4514 )
/**************************************************************************/
void *LSY_fn_p_vAlloc(unsigned long lSize)
{
void *p_vPointer;
Mmg_M_SetModeAlloc4Ch(LipsSynch,E_ucLipsSynchMemoryBlock,C_ucMmgDefaultChannel);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeLipSynchro , 0 );
p_vPointer=(void*)Mmg_fn_p_vAlloc4Ch(lSize,C_ucMmgDefaultChannel);
memset(p_vPointer,0,lSize);
if (p_vPointer==NULL)
M_LipsSynchFatalError(E_uwLipsSynchMemoryPlace);
return (p_vPointer);
}
/**************************************************************************/
#ifndef _FIRE_DEADCODE_U64_
void LSY_fn_vFree(void *p_vPointer)
{
Mmg_M_SetModeAlloc4Ch(LipsSynch,E_ucLipsSynchMemoryBlock,C_ucMmgDefaultChannel);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeLipSynchro , 0 );
Mmg_fn_vFree4Ch(p_vPointer,C_ucMmgDefaultChannel);
}
/**************************************************************************/
void LSY_fn_vFirstInitLSYMemory(unsigned long _ulLipsSynchMenorySize)
{
Erm_M_InitErrMsg(LipsSynch); /* Init the error module*/
Mmg_M_InitMmg(LipsSynch);
/**** Check the ACP memory module ****/
Mmg_fn_cCheckAlignmentValidity();
Mmg_M_InitBlock(LipsSynch,E_ucLipsSynchMemoryBlock,_ulLipsSynchMenorySize);
}
#endif /* _FIRE_DEADCODE_U64_ */
/**************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void LSY_fn_vDesinitLSYMemory(void)
{
Mmg_M_FreeBlock(LipsSynch,E_ucLipsSynchMemoryBlock);
Mmg_M_DeleteBlock(LipsSynch,E_ucLipsSynchMemoryBlock);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/**************************************************************************/
#ifndef _FIRE_DEADCODE_U64_
void LSY_PrintUsedStaticMemory(void)
{
Mmg_M_PrintUsedStaticMemoryInModule(LipsSynch);
}
/**************************************************************************/
void LSY_fn_vFreeLipsSynchroBlock(void)
{
Mmg_M_FreeBlock(LipsSynch,E_ucLipsSynchMemoryBlock);
}
#endif /* _FIRE_DEADCODE_U64_ */
#endif /* D_USE_LIPSYNC*/

View File

@@ -0,0 +1,606 @@
#ifdef D_USE_LIPSYNC
#define D_ObjsTbls_Define
/* MR0912*/
#define LSY_MainFile
#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 "micros.h"
#include "structur\ObjsTbls.h"
#include "LipsSync.h"
#include "Playanim\Playanim.h"
#include "SND.h"
#include "LSMem.h"
#include "LSErm.h"
/*-----------------------------------------------------------------------------
* Description : Allocate a Lips Synchro table of events
*-----------------------------------------------------------------------------
* Input : Number of events
* Output : Table of lips event
*-----------------------------------------------------------------------------
* Creation date : 30/06/97 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
tdstLipsSynchroEvent *fn_xAllocateLipsSynchroEvents(long lNbEvents)
{ tdstLipsSynchroEvent *p_stLSEvents;
p_stLSEvents=LSY_fn_p_vAlloc((lNbEvents+1)*sizeof(struct tdstLipsSynchroEvent_));
return p_stLSEvents;
}
/* MR1908*/
struct tdstDialText_ *fn_xAllocateDialTexts(long lNbTexts)
{ struct tdstDialText_ *p_stTexts;
p_stTexts=LSY_fn_p_vAlloc(lNbTexts*sizeof(struct tdstDialText_));
return p_stTexts;
}
struct tdstActing_ *fn_xAllocateActing(long lNbActing)
{ struct tdstActing_ *p_stActing;
p_stActing=LSY_fn_p_vAlloc(lNbActing*sizeof(struct tdstActing_));
return p_stActing;
}
/* MR0912*/
tdstLipsSynchroBinTable *fn_xAllocateLipsSynchroBinTable(long lNbElts)
{ tdstLipsSynchroBinTable *p_stLSBTable;
p_stLSBTable=LSY_fn_p_vAlloc((lNbElts+1)*sizeof(struct tdstLipsSynchroBinTable_));
return p_stLSBTable;
}
/*-----------------------------------------------------------------------------
* Description : Allocate a Lips Synchro table
*-----------------------------------------------------------------------------
* Input : None
* Output : Lips table
*-----------------------------------------------------------------------------
* Creation date : 30/06/97 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
tdxHandleOfLipsSynchroTable fn_xAllocateLipsSynchroTable()
{ tdxHandleOfLipsSynchroTable hLSTable;
hLSTable=LSY_fn_p_vAlloc(sizeof(struct tdstLipsSynchroTable_));
/* MR1908*/
hLSTable->lNumberOfFrames=0;
hLSTable->lSpeed=0;
hLSTable->p_stTable=NULL;
hLSTable->lSoundHandle=0;
hLSTable->ucNumberOfChannelAffected=0;
hLSTable->lNumberOfTexts=0;
hLSTable->p_stDialTexts=NULL;
hLSTable->lNumberOfActings=0;
hLSTable->p_stActing=NULL;
return hLSTable;
}
/*-----------------------------------------------------------------------------
* Description : Set the speed of the Lips
*-----------------------------------------------------------------------------
* Input : Lips table & speed
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 30/06/97 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vLSSetSpeed(tdxHandleOfLipsSynchroTable hLSTable,long lSpeed)
{
hLSTable->lSpeed=lSpeed;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*-----------------------------------------------------------------------------
* Description : Get the speed of the Lips
*-----------------------------------------------------------------------------
* Input : Lips table
* Output : Speed
*-----------------------------------------------------------------------------
* Creation date : 30/06/97 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
long fn_lLSGetSpeed(tdxHandleOfLipsSynchroTable hLSTable)
{
return hLSTable->lSpeed;
}
/*-----------------------------------------------------------------------------
* Description : Return the number of frame in the lips table
*-----------------------------------------------------------------------------
* Input : Lips table
* Output : Number of frames
*-----------------------------------------------------------------------------
* Creation date : 30/06/97 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
long fn_lLSGetNumberOfFrame(tdxHandleOfLipsSynchroTable hLSTable)
{
return hLSTable->lNumberOfFrames;
}
/*-----------------------------------------------------------------------------
* Description : Set the phoneme of an element of the lips table
*-----------------------------------------------------------------------------
* Input : Lips table & index & phoneme
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 30/06/97 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vLSSetPhoneme(tdxHandleOfLipsSynchroTable hLSTable,int iIndex,unsigned char ucPhoneme)
{
hLSTable->p_stTable[iIndex].ucPhoneme=ucPhoneme;
}
/*-----------------------------------------------------------------------------
* Description : Set the intensity of an element of the lips table
*-----------------------------------------------------------------------------
* Input : Lips table & index & intensity
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 30/06/97 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vLSSetIntensity(tdxHandleOfLipsSynchroTable hLSTable,int iIndex,unsigned char ucIntensity)
{
hLSTable->p_stTable[iIndex].ucIntensity=ucIntensity;
}
/*-----------------------------------------------------------------------------
* Description : Set the expression of an element of the lips table
*-----------------------------------------------------------------------------
* Input : Lips table & index & expression
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 30/06/97 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vLSSetExpression(tdxHandleOfLipsSynchroTable hLSTable,int iIndex,unsigned char ucExpression)
{
hLSTable->p_stTable[iIndex].ucIntensity=ucExpression;
}
/*-----------------------------------------------------------------------------
* Description : Return the phoneme of an element of the lips table
*-----------------------------------------------------------------------------
* Input : Lips table & index
* Output : phoneme
*-----------------------------------------------------------------------------
* Creation date : 30/06/97 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
unsigned char fn_ucLSGetPhoneme(tdxHandleOfLipsSynchroTable hLSTable,int iIndex)
{
return hLSTable->p_stTable[iIndex].ucPhoneme;
}
/*-----------------------------------------------------------------------------
* Description : Return the intensity of an element of the lips table
*-----------------------------------------------------------------------------
* Input : Lips table & index
* Output : intensity
*-----------------------------------------------------------------------------
* Creation date : 30/06/97 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
unsigned char fn_ucLSGetIntensity(tdxHandleOfLipsSynchroTable hLSTable,int iIndex)
{
return hLSTable->p_stTable[iIndex].ucIntensity;
}
/*-----------------------------------------------------------------------------
* Description : Return the expression of an element of the lips table
*-----------------------------------------------------------------------------
* Input : Lips table & index
* Output : expression
*-----------------------------------------------------------------------------
* Creation date : 30/06/97 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
unsigned char fn_ucLSGetExpression(tdxHandleOfLipsSynchroTable hLSTable,int iIndex)
{
return hLSTable->p_stTable[iIndex].ucExpression;
}
/*-----------------------------------------------------------------------------
* Description : Set the sound to be played with the lips table
*-----------------------------------------------------------------------------
* Input : Lips table & reference to the sound
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 30/06/97 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
* 08/25/97:St<53>phane RONSE:replace SND_tduRefEvt with SND_tdxHandleToSoundEvent
*---------------------------------------------------------------------------*/
void fn_vLSSetSound(tdxHandleOfLipsSynchroTable hLSTable,SND_tdxHandleToSoundEvent p_stSound)
{
hLSTable->p_stSndEvent=p_stSound;
}
/*-----------------------------------------------------------------------------
* Description : Return the sound to be played with the lips table
*-----------------------------------------------------------------------------
* Input : Lips table
* Output : reference to the sound
*-----------------------------------------------------------------------------
* Creation date : 30/06/97 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
* 08/25/97:St<53>phane RONSE:replace SND_tduRefEvt with SND_tdxHandleToSoundEvent
*---------------------------------------------------------------------------*/
SND_tdxHandleToSoundEvent fn_xLSGetSound(tdxHandleOfLipsSynchroTable hLSTable)
{
return hLSTable->p_stSndEvent;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/* MR0708*/
void fn_vSetSoundHandle(tdxHandleOfLipsSynchroTable hLSTable,long handle)
{
hLSTable->lSoundHandle=handle;
}
long fn_lGetSoundHandle(tdxHandleOfLipsSynchroTable hLSTable)
{
return hLSTable->lSoundHandle;
}
/*-----------------------------------------------------------------------------
* Description : Add a channel to be synchronized with the sound
*-----------------------------------------------------------------------------
* Input : Lips table & channel to be added
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 30/06/97 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vLSAddChannelSync(tdxHandleOfLipsSynchroTable hLSTable,unsigned char ucChannelNumber)
{
hLSTable->ucChannelAffected[hLSTable->ucNumberOfChannelAffected++]=ucChannelNumber;
}
/*-----------------------------------------------------------------------------
* Description : Erase all the channels to be synchronized
*-----------------------------------------------------------------------------
* Input : Lips table
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 30/06/97 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vLSResetChannelSync(tdxHandleOfLipsSynchroTable hLSTable)
{
hLSTable->ucNumberOfChannelAffected=0;
}
/*-----------------------------------------------------------------------------
* Description : Unused function
*-----------------------------------------------------------------------------
* Input : ...
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 30/06/97 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vPlayLipsSynch(HIE_tdxHandleToSuperObject hSOM)
{ MS_tdxHandleTo3dData hCurrent3dData=M_GetMSHandle(hSOM,3dData);
tdxHandleOfLipsSynchroTable hLipsTable=fn_x3dDataGetLipsTable(hCurrent3dData);
unsigned char ucAnimSpeed;
unsigned char ucLipsSpeed;
unsigned short uwLipsFrame;
unsigned short uwStartSynchroFrame,uwCurrentSynchroFrame;
tdstObjectsTablesList * hObjTable;
int i/*,j*/;
/*struct tdstState_ *p_stCurrentState;
struct tdstElement3d_ *p_stCurrentElement3d;
HIE_tdxHandleToSuperObject hElement;
struct tdstFrame3d_ *p_stCurrentFrame3d;*/
if (!hLipsTable)
return;
ucAnimSpeed=fn_uc3dDataGetFrameRate(hCurrent3dData);
ucLipsSpeed=(unsigned char)fn_lLSGetSpeed(hLipsTable);
uwStartSynchroFrame=fn_uw3dDataGetStartSynchroFrame(hCurrent3dData);
uwCurrentSynchroFrame=fn_uw3dDataGetCurrentSynchroFrame(hCurrent3dData);
/* MR0708*/
/*uwLipsFrame=(unsigned short)(((uwCurrentSynchroFrame-uwStartSynchroFrame)*ucLipsSpeed)/ucAnimSpeed);*/
uwLipsFrame=(unsigned short)((SND_fn_rGetPosSound(fn_lGetSoundHandle(hLipsTable))-uwStartSynchroFrame)*ucLipsSpeed);
hObjTable=fn_h3dDataGetCurrentObjectsTable(hCurrent3dData);
for (i=0;i<hObjTable->wNumberOfElement;i++)
{
if (hObjTable->d_stObjectsTable[i].ucPhoneme==hLipsTable->p_stTable[uwLipsFrame].ucPhoneme)
break;
}
/* p_stCurrentState = fn_h3dDataGetCurrentState(hCurrent3dData);
p_stCurrentAnim = p_stCurrentState->p_stAnim;
p_stCurrentFrame3d = &p_stCurrentAnim->d_stFrame3d[ucCurrentFrame];
HIE_M_ForEachChildOf(hSOM,hElement,j)
{
if(j==fn_h3dDataGetCurrentState(h_Current3dData)->p_stAnim->ucMaxNumberOfElements) break;
p_stCurrentElement3d = p_stCurrentFrame3d->d_p_stElement3d[j];
if(p_stCurrentElement3d!=NULL)
{ if (p_stCurrentElement3d->wElement==0) // T<>te (Provisoire)
p_stCurrentElement3d->wElement=i;
}
}*/
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*-----------------------------------------------------------------------------
* Description : Return the element3D number to be displayed in the given channel
*-----------------------------------------------------------------------------
* Input : SuperObject (character) & channel
* Output : Number of the element3D
*-----------------------------------------------------------------------------
* Creation date : 30/06/97 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
short fn_vGetLipsSynchObject(HIE_tdxHandleToSuperObject hSOM,short wChannelNumber)
{
MS_tdxHandleTo3dData hCurrent3dData=M_GetMSHandle(hSOM,3dData);
tdxHandleOfLipsSynchroTable hLipsTable=fn_x3dDataGetLipsTable(hCurrent3dData);
unsigned char ucAnimSpeed;
unsigned char ucLipsSpeed;
unsigned short uwLipsFrame;
unsigned short uwStartSynchroFrame,uwCurrentSynchroFrame;
tdstObjectsTablesList * hObjTable;
short i;
short wObject2=0,wObject1=0,wObject=0,wDistance,wDistance1;
BOOL bFound=FALSE;
short a_wObjectSelected[255],wNbOS=0,a_wObjectSelected2[255],wNbOS2=0;
SndReal xSndTime;
double fTimeInSeconds;
if (!hLipsTable) /* No lips table*/
return NO_LIPS;
/* Search if the current channel is synchronized*/
for (i=0;i<hLipsTable->ucNumberOfChannelAffected;i++)
if (hLipsTable->ucChannelAffected[i]==wChannelNumber)
bFound=TRUE;
if (!bFound)
/* The current channel is synchronized*/
return NO_LIPS;
ucAnimSpeed=fn_uc3dDataGetFrameRate(hCurrent3dData); /* Speed of the anim*/
ucLipsSpeed=(unsigned char)fn_lLSGetSpeed(hLipsTable); /* Speed of the lips*/
uwStartSynchroFrame=fn_uw3dDataGetStartSynchroFrame(hCurrent3dData); /* Virtual start frame number of the anim*/
uwCurrentSynchroFrame=fn_uw3dDataGetCurrentSynchroFrame(hCurrent3dData); /* Virtual current frame number of the anim*/
/*uwLipsFrame=(unsigned short)(((uwCurrentSynchroFrame-uwStartSynchroFrame)*ucLipsSpeed)/ucAnimSpeed); // Corresponding frame for the lips*/
xSndTime=SND_fn_rGetPosSound(fn_lGetSoundHandle(hLipsTable));
fTimeInSeconds=M_RealToDoubleSnd(xSndTime);
uwLipsFrame=(unsigned short)((fTimeInSeconds-uwStartSynchroFrame)*ucLipsSpeed);
if ((uwLipsFrame>fn_lLSGetNumberOfFrame(hLipsTable))||(xSndTime==SND_C_POS_ENDED)||(xSndTime==SND_C_POS_UNKNOWN))
{
SND_fn_vKillObjectSound2((long)hSOM,g_lSoundObjectTypeLipsSynchro);
/* The discussion is over*/
hLipsTable->iIndex=-1;
fn_v3dDataSetLipsTable(M_GetMSHandle(hSOM,3dData),NULL);
return NO_LIPS;
}
/* MR2008 : subtitles*/
/* if (hLipsTable->lNumberOfTexts)
for (i=(short)(hLipsTable->lNumberOfTexts-1);i>=0;i--)
if (uwLipsFrame>=hLipsTable->p_stDialTexts[i].lFrameNumber)
{
#if defined(GAM_USE_SCRIPT)
fn_vAddSuperimposedText(
hLipsTable->iIndex,
hLipsTable->p_stDialTexts[i].hText,
FON_fn_xGetFontOfTextHandle(hLipsTable->p_stDialTexts[i].hText),
hLipsTable->p_stDialTexts[i].xPosX,
hLipsTable->p_stDialTexts[i].xPosY,-1);
#endif
break;
}*/
/* MR2108 : Acting*/
if (hLipsTable->lNumberOfActings)
for (i=0;i<hLipsTable->lNumberOfActings;i++)
if (uwLipsFrame==hLipsTable->p_stActing[i].lFrameNumber) /* A voir... Cas o<> <20>a rame...*/
{ PLA_fn_bSetNewState(hSOM,hLipsTable->p_stActing[i].hNewState, FALSE,FALSE);
}
/* Recover the object table*/
hObjTable=fn_h3dDataGetCurrentObjectsTable(hCurrent3dData);
if (hLipsTable->p_stTable[uwLipsFrame].ucPhoneme==NO_PHONEME)
return NO_LIPS;
/* Search an object in the OT with the best phoneme*/
wDistance1=(short)LARGE_NUMBER;
for (i=0;i<hObjTable->wNumberOfElement;i++)
{
if (hObjTable->d_stObjectsTable[i].wTypeOfTarget==C_wTdO_Undefined) /* Hole in the OT*/
continue;
wDistance=(short)abs(hObjTable->d_stObjectsTable[i].ucPhoneme-hLipsTable->p_stTable[uwLipsFrame].ucPhoneme);
if (wDistance==wDistance1)
{ a_wObjectSelected[wNbOS++]=i;
}
if (wDistance<wDistance1)
{ wDistance1=wDistance;
wObject=i;
wNbOS=0;
a_wObjectSelected[wNbOS++]=i; /* table which contains the object with the good phoneme*/
}
}
/* Search an object in the OT with the best intensity*/
wDistance1=(short)LARGE_NUMBER;
for (i=0;i<wNbOS;i++)
{
if (hObjTable->d_stObjectsTable[a_wObjectSelected[i]].wTypeOfTarget==C_wTdO_Undefined)
continue;
if (hObjTable->d_stObjectsTable[a_wObjectSelected[i]].ucPhoneme!=hObjTable->d_stObjectsTable[wObject].ucPhoneme)
continue;
wDistance=(short)abs(hObjTable->d_stObjectsTable[a_wObjectSelected[i]].ucIntensity-hLipsTable->p_stTable[uwLipsFrame].ucIntensity);
if (wDistance==wDistance1)
{ a_wObjectSelected2[wNbOS2++]=a_wObjectSelected[i];
}
if (wDistance<wDistance1)
{ wDistance1=wDistance;
wObject1=a_wObjectSelected[i];
wNbOS2=0;
a_wObjectSelected2[wNbOS2++]=a_wObjectSelected[i];
}
}
/* Search an object in the OT with the best expression*/
wDistance1=(short)LARGE_NUMBER;
for (i=0;i<wNbOS2;i++)
{
if (hObjTable->d_stObjectsTable[a_wObjectSelected2[i]].wTypeOfTarget==C_wTdO_Undefined)
continue;
if ((hObjTable->d_stObjectsTable[a_wObjectSelected2[i]].ucPhoneme!=hObjTable->d_stObjectsTable[wObject].ucPhoneme)||
(hObjTable->d_stObjectsTable[a_wObjectSelected2[i]].ucIntensity!=hObjTable->d_stObjectsTable[wObject1].ucIntensity))
continue;
wDistance=(short)abs(hObjTable->d_stObjectsTable[a_wObjectSelected2[i]].ucExpression-hLipsTable->p_stTable[uwLipsFrame].ucExpression);
if (wDistance<wDistance1)
{ wDistance1=wDistance;
wObject2=a_wObjectSelected2[i];
}
}
/*return NO_LIPS;*/
/*fn_v3dDataSetCurrentSynchroFrame(hCurrent3dData,(unsigned char)(uwCurrentSynchroFrame+1));*/
return wObject2;
}
/*-----------------------------------------------------------------------------
* Description : Start synchro lipsing for a character
*-----------------------------------------------------------------------------
* Input : SuperObject (character) & lips table
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 30/06/97 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
* 08/25/97:St<53>phane RONSE:replace SND_tduRefEvt with SND_tdxHandleToSoundEvent
*---------------------------------------------------------------------------*/
void fn_vStartLipsSynchro(HIE_tdxHandleToSuperObject hSOM,tdxHandleOfLipsSynchroTable hLipsTable)
{ long lSoundHandle;
SND_tduRefEvt pEvt;
fn_v3dDataSetLipsTable(M_GetMSHandle(hSOM,3dData),hLipsTable);
fn_v3dDataSetStartSynchroFrame(M_GetMSHandle(hSOM,3dData),0);
fn_v3dDataSetCurrentSynchroFrame(M_GetMSHandle(hSOM,3dData),0);
/* MR2001*/
/*pEvt.pstPtr=hLipsTable->p_stSndEvent;*/
pEvt.pstPtr=SND_fn_pGetBinEvent((unsigned long)hLipsTable->p_stSndEvent)
;
lSoundHandle=SND_fn_lSendRequestSound((long)hSOM,g_lSoundObjectTypeLipsSynchro,pEvt,0,NULL); /* MR0708*/
fn_vSetSoundHandle(hLipsTable,lSoundHandle);
/* MR2008*/
hLipsTable->iIndex=-1;
}
/*-----------------------------------------------------------------------------
* Description : Stop synchro lipsing for a character
*-----------------------------------------------------------------------------
* Input : SuperObject (character)
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 07/07/97 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
* 08/25/97:St<53>phane RONSE:replace SND_tduRefEvt with SND_tdxHandleToSoundEvent
*---------------------------------------------------------------------------*/
void fn_vStopLipsSynchro(HIE_tdxHandleToSuperObject hSOM)
{ tdxHandleOfLipsSynchroTable hLipsTable;
/*SND_tduRefEvt pEvt;*/
hLipsTable=fn_x3dDataGetLipsTable(M_GetMSHandle(hSOM,3dData));
if (hLipsTable)
{
/* pEvt.pstPtr=hLipsTable->p_stSndEventStop;*/
/* SND_fn_lSendRequestSound((long)hSOM,g_lSoundObjectTypeAnim,pEvt,0,NULL);*/
SND_fn_vKillObjectSound2((long)hSOM,g_lSoundObjectTypeLipsSynchro);
}
fn_v3dDataSetLipsTable(M_GetMSHandle(hSOM,3dData),NULL);
}
BOOL fn_bIsDiscussionOver(HIE_tdxHandleToSuperObject hSOM)
{
return (fn_x3dDataGetLipsTable(M_GetMSHandle(hSOM,3dData))==NULL);
}
#endif /*D_USE_LIPSYNC*/

View File

@@ -0,0 +1,725 @@
/*#include "fonhdls.h"
#include "ACP_Base.h"
*/
#include "MTH.h"
/*
#include "DPT.h"
#include "GEO.h"
#include "GLI.h"
*/
#include "SCR.h"
#include "RND.h"
/*
#include "POS.h"
#include "SPO.h"
#include "LST.h"
*/
#include "fonfont.h"
/*************************************************************************/
void FON_fn_vSetElapsedTime(unsigned long ulTime)
{
FON_g_stGeneral.ulElapsedTime = ulTime;
}
/*************************************************************************/
/*void FON_fn_vInitEffectFor(FON_tdxHandleOfString _hText,FON_tdeTypeOfDisplay _eTypeOfDisplay)
{
switch(_eTypeOfDisplay)
{
case FON_Disabled:
FON_fn_vReinitTextEffectWithEffect(_hText,&FON_g_stEffectByDisplay.stDisabledEffect);
break;
case FON_Enabled:
FON_fn_vReinitTextEffectWithEffect(_hText,&FON_g_stEffectByDisplay.stEnabledEffect);
break;
case FON_Selected:
FON_fn_vReinitTextEffectWithEffect(_hText,&FON_g_stEffectByDisplay.stSelectedEffect);
break;
case FON_Pressed:
FON_fn_vReinitTextEffectWithEffect(_hText,&FON_g_stEffectByDisplay.stPressedEffect);
break;
}
}*/
/*************************************************************************/
/*void FON_fn_vInitEffectOfOneCharactFor(FON_tdxHandleOfString _hText,FON_tdeTypeOfDisplay _eTypeOfDisplay,unsigned long _ulIndex)
{
switch(_eTypeOfDisplay)
{
case FON_Disabled:
FON_fn_vReinitTextEffectOfOneCharactWithEffect(_hText,&FON_g_stEffectByDisplay.stDisabledEffect,_ulIndex);
break;
case FON_Enabled:
FON_fn_vReinitTextEffectOfOneCharactWithEffect(_hText,&FON_g_stEffectByDisplay.stEnabledEffect,_ulIndex);
break;
case FON_Selected:
FON_fn_vReinitTextEffectOfOneCharactWithEffect(_hText,&FON_g_stEffectByDisplay.stSelectedEffect,_ulIndex);
break;
case FON_Pressed:
FON_fn_vReinitTextEffectOfOneCharactWithEffect(_hText,&FON_g_stEffectByDisplay.stPressedEffect,_ulIndex);
break;
}
}*/
/*************************************************************************/
/*void FON_fn_vReinitTextEffect(FON_tdxHandleOfString _hText)
{
FON_fn_vReinitTextEffectWithEffect(_hText,&FON_fn_p_stGetFontAndEffectPointerOfHandle(_hText)->stEffect);
}*/
/*************************************************************************/
/*void FON_fn_vReinitTextEffectOfOneCharact(FON_tdxHandleOfString _hText,unsigned long _ulIndex)
{
FON_fn_vReinitTextEffectOfOneCharactWithEffect(_hText,&FON_fn_p_stGetFontAndEffectPointerOfHandle(_hText)->stEffect,_ulIndex);
}*/
/*************************************************************************/
/*void FON_fn_vDesinitTextEffectOfOneCharact(FON_tdxHandleOfString _hText,unsigned long _ulIndex)
{
POS_fn_vSetIdentityMatrix(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalMatrix[_ulIndex]);
POS_fn_vSetDynVector(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynTranslation[_ulIndex],0.0,0.0,0.0);
POS_fn_vSetDynVector(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynRotation[_ulIndex],0.0,0.0,0.0);
POS_fn_vSetDynVector(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynScale[_ulIndex],1.0,1.0,1.0);
FON_fn_p_stGetTextPointerOfHandle(_hText)->d_p_stLight[_ulIndex]=NULL;
}*/
/*************************************************************************/
/*void FON_fn_vCopyEffectOfOneCharact(FON_tdxHandleOfString _hTextDest,unsigned long _ulIndexDest,FON_tdxHandleOfString _hTextSrc,unsigned long _ulIndexSrc)
{
if ( FON_fn_p_stGetTextPointerOfHandle(_hTextDest)->d_hLocalMatrix!=NULL
&&FON_fn_p_stGetTextPointerOfHandle(_hTextSrc)->d_hLocalMatrix[_ulIndexSrc]!=NULL)
POS_fn_vCopyMatrix(FON_fn_p_stGetTextPointerOfHandle(_hTextDest)->d_hLocalMatrix[_ulIndexDest],
FON_fn_p_stGetTextPointerOfHandle(_hTextSrc)->d_hLocalMatrix[_ulIndexSrc]);
if ( FON_fn_p_stGetTextPointerOfHandle(_hTextDest)->d_hLocalDynTranslation!=NULL
&&FON_fn_p_stGetTextPointerOfHandle(_hTextSrc)->d_hLocalDynTranslation!=NULL)
POS_fn_vCopyCompletDyn(FON_fn_p_stGetTextPointerOfHandle(_hTextDest)->d_hLocalDynTranslation[_ulIndexDest],
FON_fn_p_stGetTextPointerOfHandle(_hTextSrc)->d_hLocalDynTranslation[_ulIndexSrc]);
if ( FON_fn_p_stGetTextPointerOfHandle(_hTextDest)->d_hLocalDynRotation!=NULL
&&FON_fn_p_stGetTextPointerOfHandle(_hTextSrc)->d_hLocalDynRotation!=NULL)
POS_fn_vCopyCompletDyn(FON_fn_p_stGetTextPointerOfHandle(_hTextDest)->d_hLocalDynRotation[_ulIndexDest],
FON_fn_p_stGetTextPointerOfHandle(_hTextSrc)->d_hLocalDynRotation[_ulIndexSrc]);
if ( FON_fn_p_stGetTextPointerOfHandle(_hTextDest)->d_hLocalDynScale!=NULL
&&FON_fn_p_stGetTextPointerOfHandle(_hTextSrc)->d_hLocalDynScale!=NULL)
POS_fn_vCopyCompletDyn(FON_fn_p_stGetTextPointerOfHandle(_hTextDest)->d_hLocalDynScale[_ulIndexDest],
FON_fn_p_stGetTextPointerOfHandle(_hTextSrc)->d_hLocalDynScale[_ulIndexSrc]);
if ( FON_fn_p_stGetTextPointerOfHandle(_hTextDest)->d_p_stLight!=NULL
&&FON_fn_p_stGetTextPointerOfHandle(_hTextSrc)->d_p_stLight!=NULL)
FON_fn_p_stGetTextPointerOfHandle(_hTextDest)->d_p_stLight[_ulIndexDest]=FON_fn_p_stGetTextPointerOfHandle(_hTextSrc)->d_p_stLight[_ulIndexSrc];
}*/
/*************************************************************************/
/*void FON_fn_vReinitTextEffectWithEffect(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect)
{
if (p_stEffect->eEffect&FON_E_EffectTranslationXTo0)
FON_fn_vInitTextEffectTranslationXTo0(_hText,p_stEffect,p_stEffect->ulTranslationXParam);
if (p_stEffect->eEffect&FON_E_EffectTranslationYTo0)
FON_fn_vInitTextEffectTranslationYTo0(_hText,p_stEffect,p_stEffect->ulTranslationYParam);
if (p_stEffect->eEffect&FON_E_EffectTranslationZTo0)
FON_fn_vInitTextEffectTranslationZTo0(_hText,p_stEffect,p_stEffect->ulTranslationZParam);
if (p_stEffect->eEffect&FON_E_EffectRotation)
FON_fn_vInitTextEffectRotation(_hText,p_stEffect,p_stEffect->ulRotationParam);
if (p_stEffect->eEffect&FON_E_EffectRotationTo0)
FON_fn_vInitTextEffectRotationTo0(_hText,p_stEffect,p_stEffect->ulRotationParam);
if (p_stEffect->eEffect&FON_E_EffectScaleXTo1)
FON_fn_vInitTextEffectScaleXTo1(_hText,p_stEffect,p_stEffect->ulScaleXParam);
if (p_stEffect->eEffect&FON_E_EffectScaleYTo1)
FON_fn_vInitTextEffectScaleYTo1(_hText,p_stEffect,p_stEffect->ulScaleYParam);
if (p_stEffect->eEffect&FON_E_EffectScaleZTo1)
FON_fn_vInitTextEffectScaleZTo1(_hText,p_stEffect,p_stEffect->ulScaleZParam);
if (p_stEffect->eEffect&FON_E_EffectScaleXWave)
FON_fn_vInitTextEffectScaleXWave(_hText,p_stEffect,p_stEffect->ulScaleXParam);
if (p_stEffect->eEffect&FON_E_EffectScaleYWave)
FON_fn_vInitTextEffectScaleYWave(_hText,p_stEffect,p_stEffect->ulScaleXParam);
if (p_stEffect->eEffect&FON_E_EffectScaleZWave)
FON_fn_vInitTextEffectScaleZWave(_hText,p_stEffect,p_stEffect->ulScaleXParam);
if (p_stEffect->eEffect&FON_E_EffectScaleXWaveTo1)
FON_fn_vInitTextEffectScaleXWaveTo1(_hText,p_stEffect,p_stEffect->ulScaleXParam);
if (p_stEffect->eEffect&FON_E_EffectScaleYWaveTo1)
FON_fn_vInitTextEffectScaleYWaveTo1(_hText,p_stEffect,p_stEffect->ulScaleXParam);
if (p_stEffect->eEffect&FON_E_EffectScaleZWaveTo1)
FON_fn_vInitTextEffectScaleZWaveTo1(_hText,p_stEffect,p_stEffect->ulScaleXParam);
if (p_stEffect->eEffect&FON_E_EffectLight)
FON_fn_vInitTextEffectLight(_hText,p_stEffect,p_stEffect->ulRotationParam);
}*/
/*************************************************************************/
/*void FON_fn_vReinitTextEffectOfOneCharactWithEffect(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulIndex)
{
if (p_stEffect->eEffect&FON_E_EffectTranslationXTo0)
FON_fn_vInitTextEffectTranslationXTo0OfOneCharact(_hText,p_stEffect,p_stEffect->ulTranslationXParam,_ulIndex);
if (p_stEffect->eEffect&FON_E_EffectTranslationYTo0)
FON_fn_vInitTextEffectTranslationYTo0OfOneCharact(_hText,p_stEffect,p_stEffect->ulTranslationYParam,_ulIndex);
if (p_stEffect->eEffect&FON_E_EffectTranslationZTo0)
FON_fn_vInitTextEffectTranslationZTo0OfOneCharact(_hText,p_stEffect,p_stEffect->ulTranslationZParam,_ulIndex);
if (p_stEffect->eEffect&FON_E_EffectRotation)
FON_fn_vInitTextEffectRotationOfOneCharact(_hText,p_stEffect,p_stEffect->ulRotationParam,_ulIndex);
if (p_stEffect->eEffect&FON_E_EffectRotationTo0)
FON_fn_vInitTextEffectRotationTo0OfOneCharact(_hText,p_stEffect,p_stEffect->ulRotationParam,_ulIndex);
if (p_stEffect->eEffect&FON_E_EffectScaleXTo1)
FON_fn_vInitTextEffectScaleXTo1OfOneCharact(_hText,p_stEffect,p_stEffect->ulScaleXParam,_ulIndex);
if (p_stEffect->eEffect&FON_E_EffectScaleYTo1)
FON_fn_vInitTextEffectScaleYTo1OfOneCharact(_hText,p_stEffect,p_stEffect->ulScaleYParam,_ulIndex);
if (p_stEffect->eEffect&FON_E_EffectScaleZTo1)
FON_fn_vInitTextEffectScaleZTo1OfOneCharact(_hText,p_stEffect,p_stEffect->ulScaleZParam,_ulIndex);
if (p_stEffect->eEffect&FON_E_EffectScaleXWave)
FON_fn_vInitTextEffectScaleXWaveOfOneCharact(_hText,p_stEffect,p_stEffect->ulScaleXParam,_ulIndex);
if (p_stEffect->eEffect&FON_E_EffectScaleYWave)
FON_fn_vInitTextEffectScaleYWaveOfOneCharact(_hText,p_stEffect,p_stEffect->ulScaleXParam,_ulIndex);
if (p_stEffect->eEffect&FON_E_EffectScaleZWave)
FON_fn_vInitTextEffectScaleZWaveOfOneCharact(_hText,p_stEffect,p_stEffect->ulScaleXParam,_ulIndex);
if (p_stEffect->eEffect&FON_E_EffectScaleXWaveTo1)
FON_fn_vInitTextEffectScaleXWaveTo1OfOneCharact(_hText,p_stEffect,p_stEffect->ulScaleXParam,_ulIndex);
if (p_stEffect->eEffect&FON_E_EffectScaleYWaveTo1)
FON_fn_vInitTextEffectScaleYWaveTo1OfOneCharact(_hText,p_stEffect,p_stEffect->ulScaleXParam,_ulIndex);
if (p_stEffect->eEffect&FON_E_EffectScaleZWaveTo1)
FON_fn_vInitTextEffectScaleZWaveTo1OfOneCharact(_hText,p_stEffect,p_stEffect->ulScaleXParam,_ulIndex);
if (p_stEffect->eEffect&FON_E_EffectLight)
FON_fn_vInitTextEffectLightOfOneCharact(_hText,p_stEffect,p_stEffect->ulRotationParam,_ulIndex);
}*/
/*************************************************************************/
/*void FON_fn_vInitTextEffect(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,FON_tdeEffect _eEffect,unsigned long _ulParam)
{
FON_fn_p_stGetFontAndEffectPointerOfHandle(_hText)->stEffect.eEffect |= _eEffect;
if (_eEffect&FON_E_EffectTranslationXTo0)
FON_fn_vInitTextEffectTranslationXTo0(_hText,p_stEffect,_ulParam);
else if (_eEffect&FON_E_EffectTranslationYTo0)
FON_fn_vInitTextEffectTranslationYTo0(_hText,p_stEffect,_ulParam);
else if (_eEffect&FON_E_EffectTranslationZTo0)
FON_fn_vInitTextEffectTranslationZTo0(_hText,p_stEffect,_ulParam);
else if (_eEffect&FON_E_EffectRotation)
FON_fn_vInitTextEffectRotation(_hText,p_stEffect,_ulParam);
else if (_eEffect&FON_E_EffectRotationTo0)
FON_fn_vInitTextEffectRotationTo0(_hText,p_stEffect,_ulParam);
else if (_eEffect&FON_E_EffectScaleXTo1)
FON_fn_vInitTextEffectScaleXTo1(_hText,p_stEffect,_ulParam);
else if (_eEffect&FON_E_EffectScaleYTo1)
FON_fn_vInitTextEffectScaleYTo1(_hText,p_stEffect,_ulParam);
else if (_eEffect&FON_E_EffectScaleZTo1)
FON_fn_vInitTextEffectScaleZTo1(_hText,p_stEffect,_ulParam);
else if (_eEffect&FON_E_EffectScaleXWave)
FON_fn_vInitTextEffectScaleXWave(_hText,p_stEffect,_ulParam);
else if (_eEffect&FON_E_EffectScaleYWave)
FON_fn_vInitTextEffectScaleYWave(_hText,p_stEffect,_ulParam);
else if (_eEffect&FON_E_EffectScaleZWave)
FON_fn_vInitTextEffectScaleZWave(_hText,p_stEffect,_ulParam);
else if (_eEffect&FON_E_EffectScaleXWaveTo1)
FON_fn_vInitTextEffectScaleXWaveTo1(_hText,p_stEffect,_ulParam);
else if (_eEffect&FON_E_EffectScaleYWaveTo1)
FON_fn_vInitTextEffectScaleYWaveTo1(_hText,p_stEffect,_ulParam);
else if (_eEffect&FON_E_EffectScaleZWaveTo1)
FON_fn_vInitTextEffectScaleZWaveTo1(_hText,p_stEffect,_ulParam);
else if (_eEffect&FON_E_EffectLight)
FON_fn_vInitTextEffectLight(_hText,p_stEffect,_ulParam);
}*/
/*************************************************************************/
/*void FON_fn_vPlayLetterEffect(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long lIndex)
{
if ( p_stEffect->eEffect&FON_E_EffectTranslationXTo0
||p_stEffect->eEffect&FON_E_EffectTranslationYTo0
||p_stEffect->eEffect&FON_E_EffectTranslationZTo0)
FON_fn_vPlayLetterEffectTranslationXYZTo0(_hText,p_stEffect,lIndex);
if ( p_stEffect->eEffect&FON_E_EffectRotation
||p_stEffect->eEffect&FON_E_EffectRotationTo0)
FON_fn_vPlayLetterEffectRotation(_hText,p_stEffect,lIndex);
if ( p_stEffect->eEffect&FON_E_EffectScaleXTo1
||p_stEffect->eEffect&FON_E_EffectScaleYTo1
||p_stEffect->eEffect&FON_E_EffectScaleZTo1)
FON_fn_vPlayLetterEffectScaleXYZTo1(_hText,p_stEffect,lIndex);
if ( p_stEffect->eEffect&FON_E_EffectScaleXWave
||p_stEffect->eEffect&FON_E_EffectScaleYWave
||p_stEffect->eEffect&FON_E_EffectScaleZWave
||p_stEffect->eEffect&FON_E_EffectScaleXWaveTo1
||p_stEffect->eEffect&FON_E_EffectScaleYWaveTo1
||p_stEffect->eEffect&FON_E_EffectScaleZWaveTo1)
FON_fn_vPlayLetterEffectScaleXYZWave(_hText,p_stEffect,lIndex);
if (p_stEffect->eEffect&FON_E_EffectLight)
FON_fn_vPlayLetterEffectLight(_hText,p_stEffect,lIndex);
}*/
/*************************************************************************/
/*************************************************************************/
/*void FON_fn_vInitTextEffectTranslationXTo0(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam)
{
unsigned long i;
p_stEffect->ulTranslationXParam = _ulParam;
FON_fn_p_stGetFontAndEffectPointerOfHandle(_hText)->stEffect.ulTranslationXParam = _ulParam;
for (i=0;i<FON_fn_ulGetTrueLenghtOfText(_hText);i++)
{
FON_fn_vInitTextEffectTranslationXTo0OfOneCharact(_hText,p_stEffect,_ulParam,i);
}
}*/
/*************************************************************************/
/*void FON_fn_vInitTextEffectTranslationXTo0OfOneCharact(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam,unsigned long lIndex)
{
MTH_tdxReal xBasedDistX;
MTH_tdxReal xAlphaDistX;
MTH3D_tdstVector stI;
xBasedDistX = (MTH_tdxReal)((signed char)(_ulParam&0x000000ff));
xAlphaDistX = ((MTH_tdxReal)((signed char)((_ulParam&0x0000ff00)>> 8)))/10.0f;
POS_fn_vSetDynVector(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynTranslation[lIndex],
xBasedDistX+lIndex*xAlphaDistX,
POS_fn_xGetDynY(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynTranslation[lIndex]),
POS_fn_xGetDynZ(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynTranslation[lIndex]));
POS_fn_vGetTranslationVector(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalMatrix[lIndex],&stI);
MTH3D_M_vSetXofVector(&stI,xBasedDistX+lIndex*xAlphaDistX);
POS_fn_vSetTranslationVector(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalMatrix[lIndex],&stI);
POS_fn_vBeginDynX(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynTranslation[lIndex],((MTH_tdxReal)((signed char)((_ulParam&0x00ff0000)>>16)))/1000.0f);
POS_fn_vStopDynX(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynTranslation[lIndex],0,TRUE);
}*/
/*************************************************************************/
/*************************************************************************/
/*void FON_fn_vInitTextEffectTranslationYTo0(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam)
{
unsigned long i;
p_stEffect->ulTranslationYParam = _ulParam;
FON_fn_p_stGetFontAndEffectPointerOfHandle(_hText)->stEffect.ulTranslationYParam = _ulParam;
for (i=0;i<FON_fn_ulGetTrueLenghtOfText(_hText);i++)
{
FON_fn_vInitTextEffectTranslationYTo0OfOneCharact(_hText,p_stEffect,_ulParam,i);
}
}*/
/*************************************************************************/
/*void FON_fn_vInitTextEffectTranslationYTo0OfOneCharact(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam,unsigned long lIndex)
{
MTH_tdxReal xBasedDistY;
MTH_tdxReal xAlphaDistY;
MTH3D_tdstVector stI;
xBasedDistY = (MTH_tdxReal)((signed char)(_ulParam&0x000000ff));
xAlphaDistY = ((MTH_tdxReal)((signed char)((_ulParam&0x0000ff00)>> 8)))/10.0f;
POS_fn_vSetDynVector(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynTranslation[lIndex],
POS_fn_xGetDynX(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynTranslation[lIndex]),
xBasedDistY+lIndex*xAlphaDistY,
POS_fn_xGetDynZ(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynTranslation[lIndex]));
POS_fn_vGetTranslationVector(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalMatrix[lIndex],&stI);
MTH3D_M_vSetYofVector(&stI,xBasedDistY+lIndex*xAlphaDistY);
POS_fn_vSetTranslationVector(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalMatrix[lIndex],&stI);
POS_fn_vBeginDynY(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynTranslation[lIndex],((MTH_tdxReal)((signed char)((_ulParam&0x00ff0000)>>16)))/1000.0f);
POS_fn_vStopDynY(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynTranslation[lIndex],0,TRUE);
}*/
/*************************************************************************/
/*************************************************************************/
/*void FON_fn_vInitTextEffectTranslationZTo0(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam)
{
unsigned long i;
p_stEffect->ulTranslationZParam = _ulParam;
FON_fn_p_stGetFontAndEffectPointerOfHandle(_hText)->stEffect.ulTranslationZParam = _ulParam;
for (i=0;i<FON_fn_ulGetTrueLenghtOfText(_hText);i++)
{
FON_fn_vInitTextEffectTranslationZTo0OfOneCharact(_hText,p_stEffect,_ulParam,i);
}
}*/
/*************************************************************************/
/*void FON_fn_vInitTextEffectTranslationZTo0OfOneCharact(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam,unsigned long lIndex)
{
MTH_tdxReal xBasedDistZ;
MTH_tdxReal xAlphaDistZ;
MTH3D_tdstVector stI;
xBasedDistZ = (MTH_tdxReal)((signed char)(_ulParam&0x000000ff));
xAlphaDistZ = ((MTH_tdxReal)((signed char)((_ulParam&0x0000ff00)>> 8)))/10.0f;
POS_fn_vSetDynVector(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynTranslation[lIndex],
POS_fn_xGetDynX(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynTranslation[lIndex]),
POS_fn_xGetDynY(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynTranslation[lIndex]),
xBasedDistZ+lIndex*xAlphaDistZ);
POS_fn_vGetTranslationVector(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalMatrix[lIndex],&stI);
MTH3D_M_vSetZofVector(&stI,xBasedDistZ+lIndex*xAlphaDistZ);
POS_fn_vSetTranslationVector(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalMatrix[lIndex],&stI);
POS_fn_vBeginDynZ(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynTranslation[lIndex],((MTH_tdxReal)((signed char)((_ulParam&0x00ff0000)>>16)))/1000.0f);
POS_fn_vStopDynZ(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynTranslation[lIndex],0,TRUE);
}*/
/*************************************************************************/
/*************************************************************************/
/*void FON_fn_vPlayLetterEffectTranslationXYZTo0(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long lIndex)
{
p_stEffect=p_stEffect;
POS_fn_vPlayTrans(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynTranslation[lIndex],FON_g_stGeneral.ulElapsedTime);
POS_fn_vGetMatrixFromDynTrans(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalMatrix[lIndex],FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynTranslation[lIndex]);
}*/
/*************************************************************************/
/*************************************************************************/
/*void FON_fn_vInitTextEffectRotation(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam)
{
unsigned long i;
p_stEffect->ulRotationParam = _ulParam;
FON_fn_p_stGetFontAndEffectPointerOfHandle(_hText)->stEffect.ulRotationParam = _ulParam;
for (i=0;i<FON_fn_ulGetTrueLenghtOfText(_hText);i++)
{
FON_fn_vInitTextEffectRotationOfOneCharact(_hText,p_stEffect,_ulParam,i);
}
}*/
/*************************************************************************/
/*void FON_fn_vInitTextEffectRotationOfOneCharact(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam,unsigned long lIndex)
{
p_stEffect = p_stEffect;
POS_fn_vBeginDynX(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynRotation[lIndex],((MTH_tdxReal)((signed char)((_ulParam&0x00ff0000)>>16)))/10000.0f);
POS_fn_vBeginDynY(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynRotation[lIndex],((MTH_tdxReal)((signed char)((_ulParam&0x0000ff00)>> 8)))/10000.0f);
POS_fn_vBeginDynZ(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynRotation[lIndex],((MTH_tdxReal)((signed char)((_ulParam&0x000000ff)>> 0)))/10000.0f);
}*/
/*************************************************************************/
/*************************************************************************/
/*void FON_fn_vInitTextEffectRotationTo0(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam)
{
unsigned long i;
p_stEffect->ulRotationParam = _ulParam;
FON_fn_p_stGetFontAndEffectPointerOfHandle(_hText)->stEffect.ulRotationParam = _ulParam;
for (i=0;i<FON_fn_ulGetTrueLenghtOfText(_hText);i++)
{
FON_fn_vInitTextEffectRotationTo0OfOneCharact(_hText,p_stEffect,_ulParam,i);
}
}*/
/*************************************************************************/
/*void FON_fn_vInitTextEffectRotationTo0OfOneCharact(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam,unsigned long lIndex)
{
FON_fn_vInitTextEffectRotationOfOneCharact(_hText,p_stEffect,_ulParam,lIndex);
POS_fn_vStopDynX(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynRotation[lIndex],0,TRUE);
POS_fn_vStopDynY(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynRotation[lIndex],0,TRUE);
POS_fn_vStopDynZ(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynRotation[lIndex],0,TRUE);
}*/
/*************************************************************************/
/*************************************************************************/
/*void FON_fn_vPlayLetterEffectRotation(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long lIndex)
{
p_stEffect=p_stEffect;
POS_fn_vPlayRot(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynRotation[lIndex],FON_g_stGeneral.ulElapsedTime);
POS_fn_vGetMatrixFromRot(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalMatrix[lIndex],FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynRotation[lIndex]);
}*/
/*************************************************************************/
/*************************************************************************/
/*void FON_fn_vInitTextEffectScaleX(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam)
{
unsigned long i;
p_stEffect->ulScaleXParam = _ulParam;
FON_fn_p_stGetFontAndEffectPointerOfHandle(_hText)->stEffect.ulScaleXParam = _ulParam;
for (i=0;i<FON_fn_ulGetTrueLenghtOfText(_hText);i++)
{
FON_fn_vInitTextEffectScaleXOfOneCharact(_hText,p_stEffect,_ulParam,i);
}
}*/
/*************************************************************************/
/*void FON_fn_vInitTextEffectScaleXOfOneCharact(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam,unsigned long lIndex)
{
p_stEffect = p_stEffect;
}*/
/*************************************************************************/
/*void FON_fn_vPlayLetterEffectScaleX(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long lIndex)
{
p_stEffect=p_stEffect;
}*/
/*************************************************************************/
/*************************************************************************/
/*void FON_fn_vInitTextEffectScaleXTo1(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam)
{
unsigned long i;
p_stEffect->ulScaleXParam = _ulParam;
FON_fn_p_stGetFontAndEffectPointerOfHandle(_hText)->stEffect.ulScaleXParam = _ulParam;
for (i=0;i<FON_fn_ulGetTrueLenghtOfText(_hText);i++)
{
FON_fn_vInitTextEffectScaleXTo1OfOneCharact(_hText,p_stEffect,_ulParam,i);
}
}*/
/*************************************************************************/
/*void FON_fn_vInitTextEffectScaleXTo1OfOneCharact(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam,unsigned long lIndex)
{
MTH_tdxReal xBasedDistX;
MTH_tdxReal xAlphaDistX;
MTH3D_tdstVector stI,stJ,stK;
xBasedDistX = (MTH_tdxReal)((signed char)(_ulParam&0x000000ff))/10.0f;
xAlphaDistX = ((MTH_tdxReal)((signed char)((_ulParam&0x0000ff00)>> 8)))/100.0f;
POS_fn_vSetDynVector(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynScale[lIndex],
xBasedDistX+lIndex*xAlphaDistX,
POS_fn_xGetDynY(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynScale[lIndex]),
POS_fn_xGetDynZ(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynScale[lIndex]));
POS_fn_vGetScaleMatrix(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalMatrix[lIndex],&stI,&stJ,&stK);
MTH3D_M_vSetXofVector(&stI,xBasedDistX+lIndex*xAlphaDistX);
POS_fn_vSetScaleMatrix(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalMatrix[lIndex],&stI,&stJ,&stK);
POS_fn_vBeginDynX(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynScale[lIndex],((MTH_tdxReal)((signed char)((_ulParam&0x00ff0000)>>16)))/10000.0f);
POS_fn_vStopDynX(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynScale[lIndex],1,TRUE);
}*/
/*************************************************************************/
/*************************************************************************/
/*void FON_fn_vInitTextEffectScaleYTo1(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam)
{
unsigned long i;
p_stEffect->ulScaleYParam = _ulParam;
FON_fn_p_stGetFontAndEffectPointerOfHandle(_hText)->stEffect.ulScaleYParam = _ulParam;
for (i=0;i<FON_fn_ulGetTrueLenghtOfText(_hText);i++)
{
FON_fn_vInitTextEffectScaleYTo1OfOneCharact(_hText,p_stEffect,_ulParam,i);
}
}*/
/*************************************************************************/
/*void FON_fn_vInitTextEffectScaleYTo1OfOneCharact(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam,unsigned long lIndex)
{
MTH_tdxReal xBasedDistY;
MTH_tdxReal xAlphaDistY;
MTH3D_tdstVector stI,stJ,stK;
xBasedDistY = (MTH_tdxReal)((signed char)(_ulParam&0x000000ff))/10.0f;
xAlphaDistY = ((MTH_tdxReal)((signed char)((_ulParam&0x0000ff00)>> 8)))/100.0f;
POS_fn_vSetDynVector(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynScale[lIndex],
POS_fn_xGetDynX(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynScale[lIndex]),
xBasedDistY+lIndex*xAlphaDistY,
POS_fn_xGetDynZ(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynScale[lIndex]));
POS_fn_vGetScaleMatrix(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalMatrix[lIndex],&stI,&stJ,&stK);
MTH3D_M_vSetYofVector(&stJ,xBasedDistY+lIndex*xAlphaDistY);
POS_fn_vSetScaleMatrix(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalMatrix[lIndex],&stI,&stJ,&stK);
POS_fn_vBeginDynY(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynScale[lIndex],((MTH_tdxReal)((signed char)((_ulParam&0x00ff0000)>>16)))/10000.0f);
POS_fn_vStopDynY(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynScale[lIndex],1,TRUE);
}*/
/*************************************************************************/
/*************************************************************************/
/*void FON_fn_vInitTextEffectScaleZTo1(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam)
{
unsigned long i;
p_stEffect->ulScaleZParam = _ulParam;
FON_fn_p_stGetFontAndEffectPointerOfHandle(_hText)->stEffect.ulScaleZParam = _ulParam;
for (i=0;i<FON_fn_ulGetTrueLenghtOfText(_hText);i++)
{
FON_fn_vInitTextEffectScaleZTo1OfOneCharact(_hText,p_stEffect,_ulParam,i);
}
}*/
/*************************************************************************/
/*void FON_fn_vInitTextEffectScaleZTo1OfOneCharact(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam,unsigned long lIndex)
{
MTH_tdxReal xBasedDistZ;
MTH_tdxReal xAlphaDistZ;
MTH3D_tdstVector stI,stJ,stK;
xBasedDistZ = (MTH_tdxReal)((signed char)(_ulParam&0x000000ff))/10.0f;
xAlphaDistZ = ((MTH_tdxReal)((signed char)((_ulParam&0x0000ff00)>> 8)))/100.0f;
POS_fn_vSetDynVector(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynScale[lIndex],
POS_fn_xGetDynX(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynScale[lIndex]),
POS_fn_xGetDynY(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynScale[lIndex]),
xBasedDistZ+lIndex*xAlphaDistZ);
POS_fn_vGetScaleMatrix(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalMatrix[lIndex],&stI,&stJ,&stK);
MTH3D_M_vSetZofVector(&stK,xBasedDistZ+lIndex*xAlphaDistZ);
POS_fn_vSetScaleMatrix(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalMatrix[lIndex],&stI,&stJ,&stK);
POS_fn_vBeginDynZ(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynScale[lIndex],((MTH_tdxReal)((signed char)((_ulParam&0x00ff0000)>>16)))/10000.0f);
POS_fn_vStopDynZ(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynScale[lIndex],1,TRUE);
}*/
/*************************************************************************/
/*************************************************************************/
/*void FON_fn_vPlayLetterEffectScaleXYZTo1(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long lIndex)
{
p_stEffect=p_stEffect;
POS_fn_vPlayScale(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynScale[lIndex],FON_g_stGeneral.ulElapsedTime);
POS_fn_vGetMatrixFromScale(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalMatrix[lIndex],FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynScale[lIndex]);
}*/
/*************************************************************************/
/*************************************************************************/
/*void FON_fn_vInitTextEffectScaleXWave(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam)
{
unsigned long i;
p_stEffect->ulScaleXParam = _ulParam;
FON_fn_p_stGetFontAndEffectPointerOfHandle(_hText)->stEffect.ulScaleXParam = _ulParam;
for (i=0;i<FON_fn_ulGetTrueLenghtOfText(_hText);i++)
{
FON_fn_vInitTextEffectScaleXWaveOfOneCharact(_hText,p_stEffect,_ulParam,i);
}
}*/
/*************************************************************************/
/*void FON_fn_vInitTextEffectScaleXWaveOfOneCharact(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam,unsigned long lIndex)
{
MTH_tdxReal xRandomValue;
xRandomValue = RND_fn_xGetRealRandomValue(FON_g_stGeneral.hRandomHandle,
((MTH_tdxReal)((signed char)((p_stEffect->ulScaleXParam&0x00ff0000)>>16)))/10000.0f,
((MTH_tdxReal)((signed char)((p_stEffect->ulScaleXParam&0xff000000)>>24)))/10000.0f);
POS_fn_vBeginDynX(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynScale[lIndex],xRandomValue);
}*/
/*************************************************************************/
/*************************************************************************/
/*void FON_fn_vInitTextEffectScaleXWaveTo1(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam)
{
unsigned long i;
p_stEffect->ulScaleXParam = _ulParam;
FON_fn_p_stGetFontAndEffectPointerOfHandle(_hText)->stEffect.ulScaleXParam = _ulParam;
for (i=0;i<FON_fn_ulGetTrueLenghtOfText(_hText);i++)
{
FON_fn_vInitTextEffectScaleXWaveTo1OfOneCharact(_hText,p_stEffect,_ulParam,i);
}
}*/
/*************************************************************************/
/*void FON_fn_vInitTextEffectScaleXWaveTo1OfOneCharact(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam,unsigned long lIndex)
{
FON_fn_vInitTextEffectScaleXWaveOfOneCharact(_hText,p_stEffect,_ulParam,lIndex);
POS_fn_vStopDynX(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynScale[lIndex],1,TRUE);
}*/
/*************************************************************************/
/*************************************************************************/
/*void FON_fn_vInitTextEffectScaleYWave(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam)
{
unsigned long i;
p_stEffect->ulScaleYParam = _ulParam;
FON_fn_p_stGetFontAndEffectPointerOfHandle(_hText)->stEffect.ulScaleYParam = _ulParam;
for (i=0;i<FON_fn_ulGetTrueLenghtOfText(_hText);i++)
{
FON_fn_vInitTextEffectScaleYWaveOfOneCharact(_hText,p_stEffect,_ulParam,i);
}
}*/
/*************************************************************************/
/*void FON_fn_vInitTextEffectScaleYWaveOfOneCharact(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam,unsigned long lIndex)
{
MTH_tdxReal xRandomValue;
xRandomValue = RND_fn_xGetRealRandomValue(FON_g_stGeneral.hRandomHandle,
((MTH_tdxReal)((signed char)((p_stEffect->ulScaleXParam&0x00ff0000)>>16)))/10000.0f,
((MTH_tdxReal)((signed char)((p_stEffect->ulScaleXParam&0xff000000)>>24)))/10000.0f);
POS_fn_vBeginDynY(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynScale[lIndex],xRandomValue);
}*/
/*************************************************************************/
/*************************************************************************/
/*void FON_fn_vInitTextEffectScaleYWaveTo1(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam)
{
unsigned long i;
p_stEffect->ulScaleYParam = _ulParam;
FON_fn_p_stGetFontAndEffectPointerOfHandle(_hText)->stEffect.ulScaleYParam = _ulParam;
for (i=0;i<FON_fn_ulGetTrueLenghtOfText(_hText);i++)
{
FON_fn_vInitTextEffectScaleYWaveTo1OfOneCharact(_hText,p_stEffect,_ulParam,i);
}
}*/
/*************************************************************************/
/*void FON_fn_vInitTextEffectScaleYWaveTo1OfOneCharact(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam,unsigned long lIndex)
{
FON_fn_vInitTextEffectScaleYWaveOfOneCharact(_hText,p_stEffect,_ulParam,lIndex);
POS_fn_vStopDynY(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynScale[lIndex],1,TRUE);
}*/
/*************************************************************************/
/*************************************************************************/
/*void FON_fn_vInitTextEffectScaleZWave(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam)
{
unsigned long i;
p_stEffect->ulScaleZParam = _ulParam;
FON_fn_p_stGetFontAndEffectPointerOfHandle(_hText)->stEffect.ulScaleZParam = _ulParam;
for (i=0;i<FON_fn_ulGetTrueLenghtOfText(_hText);i++)
{
FON_fn_vInitTextEffectScaleZWaveOfOneCharact(_hText,p_stEffect,_ulParam,i);
}
}*/
/*************************************************************************/
/*void FON_fn_vInitTextEffectScaleZWaveOfOneCharact(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam,unsigned long lIndex)
{
MTH_tdxReal xRandomValue;
xRandomValue = RND_fn_xGetRealRandomValue(FON_g_stGeneral.hRandomHandle,
((MTH_tdxReal)((signed char)((p_stEffect->ulScaleXParam&0x00ff0000)>>16)))/10000.0f,
((MTH_tdxReal)((signed char)((p_stEffect->ulScaleXParam&0xff000000)>>24)))/10000.0f);
POS_fn_vBeginDynZ(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynScale[lIndex],xRandomValue);
}*/
/*************************************************************************/
/*************************************************************************/
/*void FON_fn_vInitTextEffectScaleZWaveTo1(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam)
{
unsigned long i;
p_stEffect->ulScaleZParam = _ulParam;
FON_fn_p_stGetFontAndEffectPointerOfHandle(_hText)->stEffect.ulScaleZParam = _ulParam;
for (i=0;i<FON_fn_ulGetTrueLenghtOfText(_hText);i++)
{
FON_fn_vInitTextEffectScaleZWaveTo1OfOneCharact(_hText,p_stEffect,_ulParam,i);
}
}*/
/*************************************************************************/
/*void FON_fn_vInitTextEffectScaleZWaveTo1OfOneCharact(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam,unsigned long lIndex)
{
FON_fn_vInitTextEffectScaleZWaveOfOneCharact(_hText,p_stEffect,_ulParam,lIndex);
POS_fn_vStopDynZ(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynScale[lIndex],1,TRUE);
}*/
/*************************************************************************/
/*************************************************************************/
/*void FON_fn_vPlayLetterEffectScaleXYZWave(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long lIndex)
{
POS_fn_vPlayDynValue(POS_fn_hGetDynValueX(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynScale[lIndex]),
(MTH_tdxReal)((signed char)(p_stEffect->ulScaleXParam&0x000000ff))/50.0f,
((MTH_tdxReal)((signed char)((p_stEffect->ulScaleXParam&0x0000ff00)>> 8)))/50.0f,
POS_E_Wave,
FON_g_stGeneral.ulElapsedTime);
POS_fn_vPlayDynValue(POS_fn_hGetDynValueY(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynScale[lIndex]),
(MTH_tdxReal)((signed char)(p_stEffect->ulScaleYParam&0x000000ff))/50.0f,
((MTH_tdxReal)((signed char)((p_stEffect->ulScaleYParam&0x0000ff00)>> 8)))/50.0f,
POS_E_Wave,
FON_g_stGeneral.ulElapsedTime);
POS_fn_vPlayDynValue(POS_fn_hGetDynValueZ(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynScale[lIndex]),
(MTH_tdxReal)((signed char)(p_stEffect->ulScaleZParam&0x000000ff))/50.0f,
((MTH_tdxReal)((signed char)((p_stEffect->ulScaleZParam&0x0000ff00)>> 8)))/50.0f,
POS_E_Wave,
FON_g_stGeneral.ulElapsedTime);
POS_fn_vGetMatrixFromScale(FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalMatrix[lIndex],FON_fn_p_stGetTextPointerOfHandle(_hText)->d_hLocalDynScale[lIndex]);
}*/
/*************************************************************************/
/*************************************************************************/
/*void FON_fn_vInitTextEffectLight(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam)
{
unsigned long i;
FON_fn_p_stGetFontAndEffectPointerOfHandle(_hText)->stEffect.p_stLight=p_stEffect->p_stLight;
for (i=0;i<FON_fn_ulGetTrueLenghtOfText(_hText);i++)
{
FON_fn_vInitTextEffectLightOfOneCharact(_hText,p_stEffect,_ulParam,i);
}
}*/
/*************************************************************************/
/*void FON_fn_vInitTextEffectLightOfOneCharact(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long _ulParam,unsigned long lIndex)
{
lIndex = lIndex;
_ulParam = _ulParam;
FON_fn_p_stGetTextPointerOfHandle(_hText)->d_p_stLight[lIndex]=p_stEffect->p_stLight;
}*/
/*************************************************************************/
/*void FON_fn_vPlayLetterEffectLight(FON_tdxHandleOfString _hText,FON_tdstEffect *p_stEffect,unsigned long lIndex)
{
_hText = _hText;
p_stEffect = p_stEffect;
lIndex = lIndex;
}*/
/*************************************************************************/
/*************************************************************************/

View File

@@ -0,0 +1,150 @@
#ifndef __FONERM_H__
#define __FONERM_H__
#ifdef __cplusplus
extern "C" {
#endif
#define C_szFONVersion "FON V1.0.0" /* The format is XXX Va.b.c with Xxx is the Tag of the module */
#define C_szFONFullName "2D-FONT module"/* the complete and clear name of the module */
#define C_szFONDate __DATE__ /*The format is "Mmm dd yyyy".You can use __DATE__ but be careful that you have the control of the compilation*/
#include "ERM.h"
#undef EXTERN
#if !defined(FON_MainFile)
#define EXTERN extern
#else /* !FON_MainFile */
#define EXTERN
#endif /* !FON_MainFile */
#define __FATAL_ERR_FON__
#define __WARNING1_ERR_FON__
/* error of the FON Module*/
enum e_uwFONErrNumber{
E_uwFONFatalErr,
#ifdef __FATAL_ERR_FON__
/* Fatals error :*/
E_uwFONFatalNotAFatalError,
E_uwFONWarningErrorIsNotAWarningError,
E_uwFONTooMuchFonts,
E_uwFONTooMuchFONs,
E_uwFONMemoryError,
E_uwFONNotEnoughStringSpace,
E_uwFontScriptBadNumberOfArg,
E_uwTooManyCharactersInFont,
#endif /*__FATAL_ERR_FON__*/
E_uwFONStartOfWarning,/* important constant, it allows to recognize if an error is fatal or not.*/
#ifdef __WARNING1_ERR_FON__
E_uwFONUnknownLetter,
E_uwFONUnknownFON,
E_uwFONUnknownFont,
E_uwFONUnknownText,
E_uwFONTooManyCharacterInFont,
E_uwFONWarningShouldNotHappen,/* should never happen, but....*/
#endif /*__WARNING1_ERR_FON__*/
E_uwFONErrNumber
};
EXTERN unsigned char g_ucFONModuleId /*number of identification of the Erm module*/
#ifdef FON_MainFile
= C_ucModuleNotInitialized
#endif /*FON_MainFile*/
;
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
EXTERN CPA_EXPORT char * g_a_szFONInformationModule []
#if defined(FON_MainFile) && !defined(CPA_WANTS_IMPORT)
= {C_szFONVersion, C_szFONFullName, C_szFONDate}
#endif /*FON_MainFile && CPA_WANTS_IMPORT*/
;
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
EXTERN char * g_szFONModuleName /* Obliged syntax 'g_sz'+[Abbreviation of ModuleName]+'ModuleName'*/
#ifdef FON_MainFile
= "Module FON"
#endif /*FON_MainFile*/
;
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#if defined(__ERROR_STRINGS__)
EXTERN tdstErrorMsg g_a_stFONTabErr [] /* Obliged syntax 'g_a_st'+[Abbreviation of ModuleName]+'TabErr'*/
#ifdef FON_MainFile
={
#ifdef __FATAL_ERR_FON__
E_uwFONFatalNotAFatalError, "This is not a valide FON Debug fatal error",
E_uwFONWarningErrorIsNotAWarningError,"M_GameWarningError : Try to raise a fatal or a information",
E_uwFONTooMuchFonts, "Too much fonts are defined",
E_uwFONTooMuchFONs, "Too much FONs are defined",
E_uwFONMemoryError,"Not enough memory.",
E_uwFONNotEnoughStringSpace,"No enough strings space",
E_uwFontScriptBadNumberOfArg,"Script : bad number of arguments",
E_uwTooManyCharactersInFont,"To many characters in font",
#endif /*__FATAL_ERR_FON__*/
E_uwFONStartOfWarning,"This is a strange FON Debug Warning",
#ifdef __WARNING1_ERR_FON__
E_uwFONUnknownLetter,"Unknown Letter",
E_uwFONUnknownFON,"Unknown FON",
E_uwFONUnknownFont,"Unknown font",
E_uwFONUnknownText,"Unknown text",
E_uwFONTooManyCharacterInFont,"To many characters in font",
E_uwFONWarningShouldNotHappen,"This error should never happen!!!!",
#endif /*__WARNING1_ERR_FON__*/
0xFFFF, "\0"/*fin*/
}
#endif /*FON_MainFile*/
;
#endif /*__ERROR_STRINGS__*/
#define M_FONFatalError(ErrorNum) \
{ \
if (ErrorNum>E_uwFONFatalErr&&ErrorNum<E_uwFONStartOfWarning) \
{ \
Erm_M_ClearLastError(C_ucErmDefaultChannel);\
Erm_M_UpdateLastError(FON,C_ucErmDefaultChannel,(unsigned short)ErrorNum,C_lErmNoDebugData,C_ucErmOpenInfoWindow,C_ucAllowStopForDebug, NULL);\
} \
else \
{ \
Erm_M_ClearLastError((unsigned short)C_ucErmDefaultChannel);\
Erm_M_UpdateLastError(FON,C_ucErmDefaultChannel,(unsigned short)E_uwFONFatalNotAFatalError,C_lErmNoDebugData,C_ucErmOpenInfoWindow,C_ucAllowStopForDebug, NULL);\
} \
}
#define M_FONWarningError(ErrorNum) \
{ \
if (ErrorNum>E_uwFONStartOfWarning&&ErrorNum<E_uwFONErrNumber) \
{ \
Erm_M_ClearLastError((unsigned short)C_ucErmDefaultChannel);\
Erm_M_UpdateLastError(FON,C_ucErmDefaultChannel,(unsigned short)ErrorNum,C_lErmNoDebugData,C_ucErmOpenInfoWindow,C_ucAllowStopForDebug, NULL);\
} \
else \
{ \
M_FONFatalError(E_uwFONWarningErrorIsNotAWarningError); \
} \
}
#define M_FONInformationErrorWithString(ErrorNum,szString) \
{ \
if (ErrorNum>E_uwFONStartOfWarning&&ErrorNum<E_uwFONErrNumber) \
{ \
Erm_M_UpdateLastError(FON,C_ucErmDefaultChannel,(unsigned short)ErrorNum,C_lErmNoDebugData,C_ucErmNoOpenInfoWindow,C_ucNeverStopForDebug, szString);\
Erm_M_ClearLastError(C_ucErmDefaultChannel);\
} \
else \
{ \
M_FONFatalError(E_uwFONWarningErrorIsNotAWarningError); \
} \
}
#ifdef __cplusplus
}/* extern "C" */
#endif
#endif /* __FONITEM_H__ */

View File

@@ -0,0 +1,479 @@
/*=========================================================================
* mnufont.c : Functions for the menus management
*
* Version 1.0
* Creation date 27/05/97
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi R&D 1997
*=======================================================================*/
/*
*=======================================================================
Modifications:
*=======================================================================*/
/*
#include "fonhdls.h"
*/
#include "ACP_Base.h"
#include "ToolsCPA.h"
/*
#include "DPT.h"
#include "GEO.h"
#include "GLI.h"
*/
#include "SCR.h"
#include "RND.h"
/*
#include "POS.h"
#include "SPO.h"
#include "LST.h"
#include "SNA.h"
*/
#define FON_MainFile
#include "fonmem.h"
#include "fonerm.h"
#include "fonpub.h"
#include "fonfont.h"
#include "FON_Eff.h"
#include "fontext.h"
/*#if defined (U64)
void qsort(void *,size_t,size_t,int (*)(const void *,const void *));
#endif*/
/*extern void SNA_fn_vWritePointerInGlobalPointersFile(unsigned long ulPointerAdr);*/
/*extern unsigned long SNA_fn_vReadPointerFromGlobalPointersFile();*/
/*-----------------------------------------------------------------------------
* Description : Create a font
*-----------------------------------------------------------------------------
* Input : Name of the font
* Output : Handle of the font
*-----------------------------------------------------------------------------
* Creation date : 2./05/96 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
/*FON_tdxHandleOfFont FON_fn_xCreateFont(char *szFontName,unsigned long ulMaxNumberOfCharacters)
{
FON_tdxHandleOfFont hFont;
// Allocate the memory
hFont=FON_fn_p_vAllocInBloc(E_ucFONMemoryBlock,sizeof(FON_tdstFont));
#if !defined(U64)
hFont->p_szFontName = FON_fn_p_vAllocInBloc(E_ucFONMemoryBlock,(strlen(szFontName)+1)*sizeof(char));
#endif / U64
strcpy(hFont->p_szFontName,szFontName);
hFont->dLetter = FON_fn_p_vAllocInBloc(E_ucFONMemoryBlock,ulMaxNumberOfCharacters*sizeof(FON_tdxHandleOfVisual));
hFont->ulMaxNumberOfCharacters = ulMaxNumberOfCharacters;
#if !defined(U64)
// SCR_fnp_st_Link_SetValue(&FON_g_stGeneral.stFontLinkTable,szFontName,(unsigned long)hFont);
LST2_M_StaticInitElement(hFont);
LST2_M_StaticAddTail(&FON_g_stGeneral.hFontList,hFont);
#endif // U64
return (hFont);
}*/
/*-----------------------------------------------------------------------------
* Description : Release a font
*-----------------------------------------------------------------------------
* Input : Handle of a font
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 2./05/96 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
/*void FON_fn_vReleaseFont(FON_tdxHandleOfFont hFont)
{
FON_fn_vFreeInBloc(E_ucFONMemoryBlock,hFont->dLetter);
#if !defined(U64)
FON_fn_vFreeInBloc(E_ucFONMemoryBlock,hFont->p_szFontName);
#endif // U64
FON_fn_vFreeInBloc(E_ucFONMemoryBlock,hFont);
}*/
/*-----------------------------------------------------------------------------
* Description : Remove a font from the global array
*-----------------------------------------------------------------------------
* Input : Name of the font
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 2./05/96 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
/*void FON_fn_vRemoveFont(char *szFontName)
{
FON_fn_vReleaseFont(FON_fn_xGetFont(szFontName));
}*/
/*-----------------------------------------------------------------------------
* Description : Return a font from its name
*-----------------------------------------------------------------------------
* Input : Name of the font
* Output : Handle of the font
*-----------------------------------------------------------------------------
* Creation date : 2./05/96 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
/*FON_tdxHandleOfFont FON_fn_xGetFont(char *szFontName)
{
FON_tdxHandleOfFont hReturn = NULL;
#if !defined(U64)
long i;
FON_tdxHandleOfFont hFontElement;
/ *
SCR_tdst_Link_Value *p_xIndex;
p_xIndex = SCR_fnp_st_Link_SearchKey(&FON_g_stGeneral.stFontLinkTable,szFontName);
if (p_xIndex!=NULL&&SCR_M_e_Link_GetState(p_xIndex)==SCR_ELS_Link_Initialized)
hReturn = (FON_tdxHandleOfFont)SCR_M_ul_Link_GetValue(p_xIndex);
else
* /
LST2_M_StaticForEachElementOf(&FON_g_stGeneral.hFontList,hFontElement,i)
{
if (!stricmp(hFontElement->p_szFontName,szFontName))
hReturn = hFontElement;
}
if (hReturn==NULL)
M_FONWarningError(E_uwFONUnknownFont);
#endif // U64
return(hReturn);
}*/
/*-----------------------------------------------------------------------------
* Description : Return the name of a font
*-----------------------------------------------------------------------------
* Input : Font
* Output : Name of the font
*-----------------------------------------------------------------------------
* Creation date : 27/10/97 Author : Fran<61>ois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
/*char *FON_fn_szGetFontName(FON_tdxHandleOfFont hFont)
{
char *p_szFontName = NULL;
#if !defined(U64)
long i;
FON_tdxHandleOfFont hFontElement;
LST2_M_StaticForEachElementOf(&FON_g_stGeneral.hFontList,hFontElement,i)
{
if (hFontElement==hFont)
p_szFontName = hFontElement->p_szFontName;
}
/ *
SCR_tdst_Link_Value *p_xIndex;
p_xIndex = SCR_fnp_st_Link_SearchValue(&FON_g_stGeneral.stFontLinkTable,(unsigned long)hFont);
if (p_xIndex!=NULL&&SCR_M_e_Link_GetState(p_xIndex)==SCR_ELS_Link_Initialized)
p_szFontName = SCR_M_p_sz_Link_GetKey(p_xIndex);
else
* /
if (p_szFontName==NULL)
M_FONWarningError(E_uwFONUnknownFont);
#endif // U64
return(p_szFontName);
}*/
/*-----------------------------------------------------------------------------
* Description : Return TRUE if a font exists
*-----------------------------------------------------------------------------
* Input : Name of the font
* Output : TRUE/FALSE
*-----------------------------------------------------------------------------
* Creation date : 2./05/96 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
/*unsigned char FON_fn_bIsFontExists(char *szFontName)
{
unsigned char ucReturn = FALSE;
#if !defined(U64)
long i;
FON_tdxHandleOfFont hFontElement;
LST2_M_StaticForEachElementOf(&FON_g_stGeneral.hFontList,hFontElement,i)
{
if (!stricmp(hFontElement->p_szFontName,szFontName))
ucReturn = TRUE;
}
/ *
SCR_tdst_Link_Value *p_xIndex;
p_xIndex = SCR_fnp_st_Link_SearchKey(&FON_g_stGeneral.stFontLinkTable,szFontName);
if (p_xIndex!=NULL&&SCR_M_e_Link_GetState(p_xIndex)==SCR_ELS_Link_Initialized)
{
ucReturn = TRUE;
}
* /
#endif // U64
return(ucReturn);
}*/
/*-----------------------------------------------------------------------------
* Description : General inits for the fonts
*-----------------------------------------------------------------------------
* Input : Nothing
* Output : Nothing
*-----------------------------------------------------------------------------
* Creation date : 2./05/96 Author : Micha<68>l
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void FON_fn_vInitFonts(void)
{
/*FON_g_stGeneral.hMatrix = GEO_fn_hCreateMatrix();
POS_fn_vSetIdentityMatrix(FON_g_stGeneral.hMatrix);*/
#if !defined(U64)
SCR_fn_v_Link_InitTable(&FON_g_stTextLinkTable);
/* SCR_fn_v_Link_InitTable(&FON_g_stGeneral.stFontLinkTable);*/
/*LST2_M_StaticInitAnchor(&FON_g_stGeneral.hFontList);*/
#endif /* U64 */
FON_g_stGeneral.uwNumberOfLanguages = 0; /* number of defined languages */
FON_g_stGeneral.d_sLanguageArray = NULL; /* array of defined languages */
FON_g_stGeneral.p_stCommonLanguage = NULL ; /* common language strings */
FON_g_stGeneral.ulElapsedTime = 0;
FON_g_stGeneral.hRandomHandle = RND_fn_hReserveANewHandleIndex();
/*memset(&FON_g_stEffectByDisplay,0,sizeof(FON_stEffectByDisplay));*/
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*************************************************************************/
/*int FON_fn_iQSortCmp(const void *hElement1,const void *hElement2)
{
unsigned short uwChar1,uwChar2;
uwChar1 = (*(struct FON_tdstVisualFont_ **)hElement1)->uwCharacter;
uwChar2 = (*(struct FON_tdstVisualFont_ **)hElement2)->uwCharacter;
return(uwChar1-uwChar2);
}*/
/*************************************************************************/
/*void FON_fn_vTreatLoadedFont(FON_tdxHandleOfFont hFont)
{
unsigned long i;
// *** Leave all non used characters *** - Oliv' - Portage v15 - 1 warning removed here
for (i=hFont->ulMaxNumberOfCharacters-1;i>0&&hFont->dLetter[i]==NULL;i--);
if (hFont->ulMaxNumberOfCharacters!=i+1)
{
M_FONInformationErrorWithString(E_uwFONTooManyCharacterInFont,FON_fn_szGetFontName(hFont));
hFont->ulMaxNumberOfCharacters = i+1;
}
qsort((void*)hFont->dLetter,hFont->ulMaxNumberOfCharacters,sizeof(FON_tdxHandleOfVisual),FON_fn_iQSortCmp);
}*/
/*************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void FON_fn_vDesInitFonts ( void )
{
FON_fn_vDesinitFONMemory ( ) ;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifdef ACTIVE_EDITOR
void FON_fn_vReInitFonts ( void )
{
FON_fn_vInitFonts ( ) ;
/* also clear the GAM list of available languages */
g_stEngineStructure . ucNbLanguages = 0 ;
if ( g_stEngineStructure . p_stLanguageTable )
{
/* this macro clears the pointer, so no need to do it ourselves */
M_GameFreeInHLM ( g_stEngineStructure . p_stLanguageTable ) ;
}
}
#endif /* ACTIVE_EDITOR */
/*************************************************************************/
/*void FON_fn_vAddCharacterInFont(FON_tdxHandleOfFont hFont,unsigned long ulCharacterNumber,unsigned short uwCharacter,struct FON_st3DFont_ *h3DObject,MTH_tdxReal xBaseY)
{
hFont->dLetter[ulCharacterNumber]=FON_fn_p_vAllocInBloc(E_ucFONMemoryBlock,sizeof(struct FON_tdstVisualFont_));
hFont->dLetter[ulCharacterNumber]->uwCharacter = uwCharacter;
hFont->dLetter[ulCharacterNumber]->xBaseY = xBaseY;
hFont->dLetter[ulCharacterNumber]->h3DObject = h3DObject;
}*/
/*************************************************************************/
/*struct FON_st3DFont_ *FON_fn_p_stGet3dObjectOfCharacter(FON_tdxHandleOfFont hFont,unsigned short uwCharacher)
{
struct FON_st3DFont_ *h3DObject = NULL;
unsigned long i;
for (i=0;i<hFont->ulMaxNumberOfCharacters&&hFont->dLetter[i]->uwCharacter!=uwCharacher;i++)
{
if (h3DObject==NULL&&hFont->dLetter[i]->uwCharacter==' ')
h3DObject = hFont->dLetter[i]->h3DObject;
}
if (i<hFont->ulMaxNumberOfCharacters&&hFont->dLetter[i]->uwCharacter==uwCharacher)
h3DObject = hFont->dLetter[i]->h3DObject;
return (h3DObject);
}*/
/*************************************************************************/
/*MTH_tdxReal FON_fn_xGetBaseYOfCharacter(FON_tdxHandleOfFont hFont,unsigned short uwCharacher)
{
MTH_tdxReal xBaseY=0;
unsigned long i;
for (i=0;i<hFont->ulMaxNumberOfCharacters&&hFont->dLetter[i]->uwCharacter!=uwCharacher;i++)
{
if (xBaseY==0&&hFont->dLetter[i]->uwCharacter==' ')
xBaseY = hFont->dLetter[i]->xBaseY;
}
if (i<hFont->ulMaxNumberOfCharacters&&hFont->dLetter[i]->uwCharacter==uwCharacher)
xBaseY = hFont->dLetter[i]->xBaseY;
return (xBaseY);
}*/
/*************************************************************************/
/*unsigned short FON_fn_uwGetDisplayedCharacter(FON_tdxHandleOfFont hFont,char *szText,unsigned long lIndex)
{
unsigned short uwReturn = 0;
if (hFont->eTypeOfFont&FON_eGeneralStandard)
uwReturn = (unsigned char)szText[lIndex];
else if (hFont->eTypeOfFont&FON_eGeneralUnicode)
{
if ((unsigned char)szText[lIndex]<128)
uwReturn = (unsigned char)szText[lIndex];
else
uwReturn = (unsigned short)((((unsigned char)szText[lIndex])<<8)+(unsigned char)szText[lIndex+1]);
}
return(uwReturn);
}*/
/*************************************************************************/
/*unsigned long FON_fn_vGetNextCharacter(FON_tdxHandleOfFont hFont,char *szText,unsigned long lIndex)
{
unsigned long ulReturn = 0;
if (hFont->eTypeOfFont&FON_eGeneralStandard)
ulReturn = lIndex+1;
else if (hFont->eTypeOfFont&FON_eGeneralUnicode)
{
if ((unsigned char)szText[lIndex]<128)
ulReturn = lIndex+1;
else
ulReturn = lIndex+2;
}
return(ulReturn);
}*/
/*************************************************************************/
/*void FON_fn_vRemoveAllFonts()
{
}*/
/*************************************************************************/
/*GLI_tdstLight *FON_fn_p_stCreateLight(MTH_tdxReal xR,MTH_tdxReal xG,MTH_tdxReal xB,MTH_tdxReal xA)
{
GLI_tdstLight *p_stLight;
POS_tdstCompletePosition stLightMatrix;
GLI_tdstColor stColor;
MTH3D_tdstVector stI;
MTH3D_tdstVector stJ;
MTH3D_tdstVector stK;
GLI_xCreateLight (&p_stLight,GLI_C_lParallelLight);
stColor.xR = xR;
stColor.xG = xG;
stColor.xB = xB;
stColor.xA = xA;
GLI_xSetLightColor (p_stLight,&stColor );
GLI_xGetLightMatrix(p_stLight,&stLightMatrix);
POS_fn_vGetRotationMatrix(&stLightMatrix, &stI, &stJ, &stK);
MTH3D_M_vSetVectorElements(&stI,MTH_C_MinusONE,MTH_C_ZERO,MTH_C_ZERO);
MTH3D_M_vSetVectorElements(&stJ,MTH_C_ZERO,MTH_C_ZERO,MTH_C_ONE);
MTH3D_M_vSetVectorElements(&stK,MTH_C_ZERO,MTH_C_ZERO,MTH_C_ONE);
POS_fn_vSetRotationMatrix(&stLightMatrix, &stI, &stJ, &stK);
POS_fn_vComputeTransformMatrix (&stLightMatrix);
GLI_xSetLightMatrix(p_stLight,&stLightMatrix);
return(p_stLight);
}*/
/*************************************************************************/
/* MR0410*/
/*void fn_vSaveFONGeneral()
{
unsigned long i;
#if !defined(U64)
//SNA_fn_vWriteStructureInGlobalPointersFile((unsigned long *)&FON_g_stGeneral,sizeof(FON_tdstGeneral));
SNA_fn_vWritePointerInGlobalPointersFile((unsigned long) FON_g_stGeneral.d_stFontAndEffectArray);
for (i=0;i<FON_g_stGeneral.ulNumberOfTexts;i++)
{
SNA_fn_vWritePointerInGlobalPointersFile((unsigned long) FON_g_stGeneral.d_stFontAndEffectArray[i]);
}
// *** DFM 13/01/98 *** - Oliv' - Portage v15 - 1 warning removed here
SNA_fn_vWriteStructureInGlobalPointersFile((unsigned long *)&FON_g_stGeneral.hFontList,sizeof(LST2_M_StaticAnchorDeclaration(FON_tdxHandleOfFont)));
#endif // U64
}*/
/*void fn_vReadFONGeneral()
{
unsigned long i;
FON_tdxHandleOfFont hLastElementFont,hCurrentFont,hNextFont;
#if !defined(U64)
//SNA_fn_vReadStructureFromGlobalPointersFile((unsigned long *)&FON_g_stGeneral,sizeof(FON_tdstGeneral));
FON_g_stGeneral.d_stFontAndEffectArray=(struct FON_tdstFontAndEffect_ **)SNA_fn_vReadPointerFromGlobalPointersFile();
for (i=0;i<FON_g_stGeneral.ulNumberOfTexts;i++)
{
FON_g_stGeneral.d_stFontAndEffectArray[i]=(struct FON_tdstFontAndEffect_ *)SNA_fn_vReadPointerFromGlobalPointersFile();
}
// *** DFM 13/01/98 *** - Oliv' - Portage v15 - 1 warning removed here
SNA_fn_vReadStructureFromGlobalPointersFile((unsigned long *)&FON_g_stGeneral.hFontList,sizeof(LST2_M_StaticAnchorDeclaration(FON_tdxHandleOfFont)));
hLastElementFont=LST2_M_StaticGetLastElement(&FON_g_stGeneral.hFontList);
SNA_M_vValidateStaticLst(&FON_g_stGeneral.hFontList,hLastElementFont,hCurrentFont,hNextFont);
#endif // U64
}*/

View File

@@ -0,0 +1,108 @@
#ifndef __FONFONT_H__
#define __FONFONT_H__
#include "CPA_Expt.h"
#undef EXTERN
#undef extern
#if !defined(FON_MainFile)
#define EXTERN extern
#else
#define EXTERN
#endif /* FON_MainFile */
#ifdef __cplusplus
extern "C" {
#endif
/*typedef struct FON_tdstVisualFont_
{
unsigned short uwCharacter; // *** For normal and unicode characters ***
MTH_tdxReal xBaseY;
struct FON_st3DFont_ *h3DObject;
} FON_tdstVisualFont;*/
/*typedef struct FON_tdstVisualFont_ *FON_tdxHandleOfVisual;*/
/*#if !defined(U64)
LST2_M_StaticUseListOf(FON_tdxHandleOfFont);
#endif // U64
*/
/* Font structure*/
/*typedef struct FON_stFont_
{
#if !defined(U64)
LST2_M_StaticElementDeclaration(FON_tdxHandleOfFont)
char *p_szFontName;
#endif // U64
enum FON_tdeTypeOfFont_ eTypeOfFont;
unsigned long ulMaxNumberOfCharacters;
FON_tdxHandleOfVisual *dLetter;
MTH_tdxReal xCharacterSpace;
} FON_tdstFont;*/
/*
typedef enum eLanguageDefinition_
{
E_ld_French,
E_ld_English,
E_ld_German,
E_ld_Italian,
E_ld_Spanish,
E_ld_Japanese,
E_ld_Chinese,
E_ld_MaxNumberOfLanguages
} tdeLanguageDefinition;
*/
#define FON_C_HandleOffsetForCommonLanguage 20000
typedef struct stLanguage_
{
char **d_pTextsArray; /* an array of pointers to strings*/
unsigned short uwMaxNumberOfTexts; /*size of this array*/
unsigned short uwNumberOfTexts; /*used elements in this array*/
} tdstLanguage;
typedef struct FON_tdstGeneral_
{
unsigned long ulElapsedTime;
RND_tdxHandleToRandomIndex hRandomHandle;
unsigned short uwNumberOfLanguages; /*number of defined languages*/
tdstLanguage *d_sLanguageArray; /*array of defined languages*/
tdstLanguage *p_stCommonLanguage ; /* structure for common strings */
/*FB010199 (for controller pak)*/
#ifdef U64
unsigned long ulIndexOfFirstControllerPakText;
#endif /*U64*/
} FON_tdstGeneral;
/* Function prototypes*/
/*void FON_fn_vTreatLoadedFont(FON_tdxHandleOfFont hFont);*/
/*void FON_fn_vAddCharacterInFont(FON_tdxHandleOfFont hFont,unsigned long ulCharacterNumber,unsigned short uwCharacter,struct FON_st3DFont_ *h3DObject,MTH_tdxReal xBaseY);*/
/*struct FON_st3DFont_ *FON_fn_p_stGet3dObjectOfCharacter(FON_tdxHandleOfFont hFont,unsigned short uwCharacter);*/
/*MTH_tdxReal FON_fn_xGetBaseYOfCharacter(FON_tdxHandleOfFont hFont,unsigned short uwCharacher);*/
/*FON_tdxHandleOfFont FON_fn_xCreateFont(char *szFontName,unsigned long ulMaxNumberOfCharacters);*/
/*void FON_fn_vReleaseFont(FON_tdxHandleOfFont hFont);*/
/*void FON_fn_vRemoveFont(char *szFontName);*/
/*void FON_fn_vRemoveAllFonts();*/
#if !defined(U64)
/*LST2_M_StaticAnchorDeclaration(FON_tdxHandleOfFont) hFontList;*/
SCR_tdst_Link_Table FON_g_stTextLinkTable;
/* SCR_tdst_Link_Table stFontLinkTable;*/
#endif /* U64 */
EXTERN FON_tdstGeneral FON_g_stGeneral;
#ifdef __cplusplus
}/* extern "C" */
#endif
#endif /* __FONFONT_H__ */

View File

@@ -0,0 +1,482 @@
/*=========================================================================
* mnuload.c : Script interpretation for the menus
*
* Version 1.0
* Creation date 2./05/97
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi R&D 1997
*=======================================================================*/
/*
*=======================================================================
Modifications:
*=======================================================================*/
/*#include "fonhdls.h"*/
#include "ACP_Base.h"
#include "ToolsCPA.h"
/*#include "SCR.h"*/
/*#include "DPT.h"*/
/*#include "GEO.h"*/
/*#include "GLI.h"*/
/*#include "TEX.h"*/
/*#include "SCR.h"*/
/*#include "VIG.h"*/
#include "RND.h"
/*#include "LST.h"*/
#include "fonerm.h"
#include "fonmem.h"
#include "Structur/EngMode.h"
/*#include "fonpub.h"*/
/*#include "FON_Eff.h"*/
#include "fonfont.h"
#include "fonload.h"
/*#include "fontext.h"*/
static BOOL s_bIncoherenceInTxtFiles = FALSE;
/* Global array of fonts*/
#if !defined(U64)
/*SCR_tdst_Link_Table FON_g_stFontLinkTable; // For binarisation purpose only*/
SCR_tdst_Link_Table *FON_fn_p_stGetLinkTable()
{
return &FON_g_stTextLinkTable;
}
#endif /* U64 */
/*************************************************************************/
void FON_fn_vInitLoad()
{
#if !defined(U64)
SCR_fn_v_RdL0_RegisterCallback(FON_C_SectionAddNewStrings,FON_fn_eLoadTextString,SCR_CRC_c_RdL0_ForSection);
/*SCR_fn_v_Link_InitTable(&FON_g_stFontLinkTable); // for binarisation purposes only*/
#endif /* U64 */
}
/*************************************************************************/
#if !defined(U64)
#if 0
/* convert lowercase to uppercase, and accented characters to their unaccented version... */
void fn_vConvertStringChars ( char *_p_szString )
{
int j = strlen ( _p_szString ) , i ;
for ( i = 0 ; i < j ; i ++ )
{
#if 1
if ( _p_szString [ i ] >= 'a' && _p_szString [ i ] <= 'z' )
_p_szString [ i ] = toupper ( _p_szString [ i ] ) ;
#else
switch ( _p_szString [ i ] )
{
case '<27>':
_p_szString [ i ] = 'c' ;
break ;
case '<27>':
case '<27>':
case '<27>':
case '<27>':
_p_szString [ i ] = 'e' ;
break ;
case '<27>':
case '<27>':
case '<27>':
_p_szString [ i ] = 'a' ;
break ;
case '<27>':
case '<27>':
case '<27>':
_p_szString [ i ] = 'o' ;
break ;
case '<27>':
case '<27>':
_p_szString [ i ] = 'i' ;
break ;
case '<27>' :
case '<27>' :
case '<27>' :
case '<27>' :
_p_szString [ i ] = 'u' ;
break ;
}
#endif
}
}
#endif /* 0 */
/*************************************************************************/
#ifdef M_CheckScriptParamNumber
#undef M_CheckScriptParamNumber
#endif
#define M_CheckScriptParamNumber(ulNumber) \
{ \
if (SCR_fn_uc_RdL0_GetNumberOfParameters(szParams)!=ulNumber) \
M_FONFatalError(E_uwFontScriptBadNumberOfArg); \
}
SCR_tde_Anl_ReturnValue FON_fn_eLoadTextString(SCR_tdst_File_Description *p_fFile, char *szAction, char *szParams[], SCR_tde_Anl_Action cType)
{
/*enum FON_tdeTextEffect_ _eTextEffect = FON_e_Nothing;*/
/*static tdeLanguageDefinition wLanguageId;*/
static short s_wLanguageId ;
static tdstLanguage * s_p_stLoadedLanguage ;
switch (cType)
{
case SCR_EA_Anl_BeginSection:
{
/*allocate the pointer of lists of languages*/
register unsigned short uwLanguage = 0;
if ( !stricmp(szAction, "Common") )
{
/* special value for common language strings */
s_wLanguageId = -1 ;
if ( ! FON_g_stGeneral . p_stCommonLanguage )
{
FON_g_stGeneral.p_stCommonLanguage = (tdstLanguage *) FON_fn_p_vAllocInBloc (
E_ucFONTextMemoryBlock ,
sizeof ( tdstLanguage )
);
}
/* the subsequent loaded strings are to be associated with this language definition */
s_p_stLoadedLanguage = FON_g_stGeneral . p_stCommonLanguage ;
}
else
{
/* by default if any problem */
s_wLanguageId = 0;
do
{
if ( !stricmp(szAction, g_stEngineStructure.p_stLanguageTable[uwLanguage].szLanguageCode) )
{
s_wLanguageId = uwLanguage;
uwLanguage = g_stEngineStructure.ucNbLanguages;
}
} while ( uwLanguage ++ < g_stEngineStructure . ucNbLanguages ) ;
/*allocate a new language definition structure if necessary*/
if ( FON_g_stGeneral.uwNumberOfLanguages <= s_wLanguageId )
{
long lIndex;
if ( FON_g_stGeneral.d_sLanguageArray )
{
FON_g_stGeneral.d_sLanguageArray = (tdstLanguage *) FON_fn_p_vReallocInBloc(
E_ucFONTextMemoryBlock,
FON_g_stGeneral.d_sLanguageArray,
(s_wLanguageId + 1) * sizeof(tdstLanguage)
);
}
else
{
FON_g_stGeneral.d_sLanguageArray = (tdstLanguage *) FON_fn_p_vAllocInBloc(
E_ucFONTextMemoryBlock,
(s_wLanguageId + 1) * sizeof(tdstLanguage)
);
}
/*initialize all new allocated structures*/
for ( lIndex = FON_g_stGeneral.uwNumberOfLanguages; lIndex < s_wLanguageId + 1; lIndex ++ )
{
FON_g_stGeneral.d_sLanguageArray[lIndex].d_pTextsArray = NULL;
FON_g_stGeneral.d_sLanguageArray[lIndex].uwMaxNumberOfTexts = 0;
FON_g_stGeneral.d_sLanguageArray[lIndex].uwNumberOfTexts = 0;
}
FON_g_stGeneral.uwNumberOfLanguages = (unsigned short) (s_wLanguageId + 1);
}
/* the subsequent loaded strings are to be associated with this language definition */
s_p_stLoadedLanguage = FON_g_stGeneral . d_sLanguageArray + s_wLanguageId ;
}
/*update the size of the string pointers array*/
s_p_stLoadedLanguage -> uwMaxNumberOfTexts += (unsigned short) (atoi(szParams[0]));
if ( s_p_stLoadedLanguage -> d_pTextsArray )
{
s_p_stLoadedLanguage -> d_pTextsArray = (char/*struct FON_stText_*/ **) FON_fn_p_vReallocInBloc (
E_ucFONTextMemoryBlock,
s_p_stLoadedLanguage -> d_pTextsArray,
s_p_stLoadedLanguage -> uwMaxNumberOfTexts * sizeof(char/*struct FON_stText_*/ *)
);
}
else
{
s_p_stLoadedLanguage -> d_pTextsArray = (char/*struct FON_stText_*/ **) FON_fn_p_vAllocInBloc (
E_ucFONTextMemoryBlock,
s_p_stLoadedLanguage -> uwMaxNumberOfTexts * sizeof(char/*struct FON_stText_*/ *)
);
}
}
/*FON_g_stGeneral.d_stFontAndEffectArray = (struct FON_tdstFontAndEffect_ **)FON_fn_p_vReallocInBloc(E_ucFONMemoryBlock,FON_g_stGeneral.d_stFontAndEffectArray,FON_g_stGeneral.ulMaxNumberOfTexts*sizeof(struct FON_tdstFontAndEffect_ *));*/
break;
case SCR_EA_Anl_Entry :
if ( ! stricmp( szAction , FON_C_SectionNewString ) || !stricmp( szAction , FON_C_SectionNewUpperString ) )
{
char *hText = NULL;
if (s_p_stLoadedLanguage -> uwNumberOfTexts >= s_p_stLoadedLanguage -> uwMaxNumberOfTexts)
{
M_FONFatalError(E_uwFONNotEnoughStringSpace);
}
/* if the text is empty, try to find a non-empty version in any other language (the string is common to all)*/
if ( strlen(szParams[1]) == 0 )
{
long lIndex;
for (lIndex = 0; lIndex < FON_g_stGeneral.uwNumberOfLanguages; lIndex ++)
if ( FON_g_stGeneral.d_sLanguageArray[lIndex].d_pTextsArray )
{
/* get the text in the other language*/
hText = FON_g_stGeneral.d_sLanguageArray[lIndex].d_pTextsArray[s_p_stLoadedLanguage -> uwNumberOfTexts];
if ( hText )
break;
}
}
else
{
SCR_tdst_Link_Value * p_stRegisteredValue ;
char szRegisteredString [ 256 ] ;
long lSize = strlen ( szParams [ 1 ] ) ;
hText = FON_fn_p_vAllocInBloc(
E_ucFONTextMemoryBlock ,
lSize + 1
#ifdef ACTIVE_EDITOR
+ 2 /* 2 bytes for the string length */
#endif
) ;
#ifdef ACTIVE_EDITOR
/* for debug purposes (only for certain AI calls), store the size of the string after it */
* ( short * ) ( & hText [ lSize + 1 ] ) = ( short ) lSize ;
#endif
strcpy ( hText , szParams [ 1 ] ) ;
/* convert strange characters to more normal characters */
#if 0
fn_vConvertStringChars ( hText ) ;
#endif
/* upper ? */
if ( ! stricmp ( szAction , FON_C_SectionNewUpperString ) )
strupr ( hText ) ;
/* First we check if the string is already registered with a different index */
if (!s_bIncoherenceInTxtFiles)
{
p_stRegisteredValue = SCR_fnp_st_Link_SearchKey(&FON_g_stTextLinkTable, szParams[0]);
if ( p_stRegisteredValue != NULL )
{
long lRegisteredIndex = SCR_M_ul_Link_GetValue(p_stRegisteredValue);
/* common strings have special indexes to identify them */
if ( s_p_stLoadedLanguage == FON_g_stGeneral . p_stCommonLanguage )
lRegisteredIndex -= FON_C_HandleOffsetForCommonLanguage ;
if ( lRegisteredIndex != s_p_stLoadedLanguage -> uwNumberOfTexts )
{
char szMessage[256];
sprintf(szMessage, "There is an incoherence in the text file %s, at the string %s", p_fFile->a_szFileName, szParams[0]);
MessageBox(NULL,szMessage,"Incoherence in a TXT file",MB_OK|MB_ICONWARNING);
s_bIncoherenceInTxtFiles = TRUE;
#if defined ( ACTIVE_EDITOR )
fn_vForceEditor();
#endif /* ! ACTIVE_EDITOR */
}
}
}
/* Then we check if the index is already registered with a different string */
if ( ! s_bIncoherenceInTxtFiles )
{
long lRegisteredIndex = s_p_stLoadedLanguage -> uwNumberOfTexts ;
/* common strings have special indexes to identify them */
if ( s_p_stLoadedLanguage == FON_g_stGeneral . p_stCommonLanguage )
lRegisteredIndex += FON_C_HandleOffsetForCommonLanguage ;
p_stRegisteredValue = SCR_fnp_st_Link_SearchValue(&FON_g_stTextLinkTable, lRegisteredIndex ) ;
if ( p_stRegisteredValue != NULL )
{
strcpy(szRegisteredString, SCR_M_p_sz_Link_GetKey(p_stRegisteredValue));
if (stricmp(szRegisteredString, szParams[0]))
{
char szMessage[256];
sprintf(szMessage, "There is an incoherence in the text file %s, at the string %s", p_fFile->a_szFileName, szParams[0]);
MessageBox(NULL,szMessage,"Incoherence in a TXT file",MB_OK|MB_ICONWARNING);
s_bIncoherenceInTxtFiles = TRUE;
#if defined ( ACTIVE_EDITOR )
fn_vForceEditor();
#endif /* ! ACTIVE_EDITOR */
}
}
}
/* normally this line should occur once per text per language -> everything will be fine if a given text name*/
/* always has the same index in the section, because only one linktable entry may exist with a given name*/
SCR_fnp_st_Link_SetValue(
&FON_g_stTextLinkTable,
szParams[0],
s_p_stLoadedLanguage -> uwNumberOfTexts
+ (
( s_p_stLoadedLanguage == FON_g_stGeneral . p_stCommonLanguage )
? FON_C_HandleOffsetForCommonLanguage
: 0
)
) ;
}
s_p_stLoadedLanguage -> d_pTextsArray[ s_p_stLoadedLanguage -> uwNumberOfTexts ] = hText ;
s_p_stLoadedLanguage -> uwNumberOfTexts ++;
}
else if ( !stricmp(szAction, FON_C_SectionNewStringLength) )
{
char *hText = NULL;
if ( s_p_stLoadedLanguage -> uwNumberOfTexts >= s_p_stLoadedLanguage -> uwMaxNumberOfTexts )
{
M_FONFatalError(E_uwFONNotEnoughStringSpace);
}
/* if the text is empty, try to find a non-empty version in any other language (the string is common to all)*/
if ( atoi(szParams[1]) == 0 )
{
long lIndex;
for (lIndex = 0; lIndex < FON_g_stGeneral.uwNumberOfLanguages; lIndex ++)
if ( FON_g_stGeneral.d_sLanguageArray[lIndex].d_pTextsArray )
{
/* get the text in the other language*/
hText = FON_g_stGeneral.d_sLanguageArray[lIndex].d_pTextsArray[ s_p_stLoadedLanguage -> uwNumberOfTexts ] ;
if ( hText )
break;
}
}
else
{
SCR_tdst_Link_Value *p_stRegisteredValue;
char szRegisteredString[256];
long lRegisteredIndex;
long lSize;
lSize = atoi(szParams[1]);
/* allocate a string and fill it with whitespaces (so that strlen() is non-zero)*/
hText = FON_fn_p_vAllocInBloc(
E_ucFONTextMemoryBlock,
lSize + 1 /* string + zero terminator */
#ifdef ACTIVE_EDITOR
+ 2 /* 2 bytes for the string length */
#endif
);
/* fill with whitespaces for clarity */
memset(hText, ' ', lSize );
/* don't forget to set the zero terminator */
hText [ lSize ] = 0 ;
#ifdef ACTIVE_EDITOR
/* for debug purposes (only for certain AI calls), store the size of the string after it */
* ( short * ) ( & hText [ lSize + 1 ] ) = ( short ) lSize ;
#endif
/* First we check if the string is already registered with a different index */
if (!s_bIncoherenceInTxtFiles)
{
p_stRegisteredValue = SCR_fnp_st_Link_SearchKey(&FON_g_stTextLinkTable, szParams[0]);
if (p_stRegisteredValue!=NULL)
{
lRegisteredIndex = SCR_M_ul_Link_GetValue(p_stRegisteredValue);
/* common strings have special indexes to identify them */
if ( s_p_stLoadedLanguage == FON_g_stGeneral . p_stCommonLanguage )
lRegisteredIndex -= FON_C_HandleOffsetForCommonLanguage ;
if ( lRegisteredIndex != s_p_stLoadedLanguage -> uwNumberOfTexts )
{
char szMessage[256];
sprintf(szMessage, "There is an incoherence in the text file %s, at the string %s", p_fFile->a_szFileName, szParams[0]);
MessageBox(NULL,szMessage,"Incoherence in a TXT file",MB_OK|MB_ICONWARNING);
s_bIncoherenceInTxtFiles = TRUE;
#if defined ( ACTIVE_EDITOR )
fn_vForceEditor();
#endif /* ! ACTIVE_EDITOR */
}
}
}
/* Then we check if the index is already registered with a different string */
if (!s_bIncoherenceInTxtFiles)
{
long lRegisteredIndex = s_p_stLoadedLanguage -> uwNumberOfTexts ;
/* common strings have special indexes to identify them */
if ( s_p_stLoadedLanguage == FON_g_stGeneral . p_stCommonLanguage )
lRegisteredIndex += FON_C_HandleOffsetForCommonLanguage ;
p_stRegisteredValue = SCR_fnp_st_Link_SearchValue(&FON_g_stTextLinkTable, lRegisteredIndex ) ;
if ( p_stRegisteredValue != NULL )
{
strcpy(szRegisteredString, SCR_M_p_sz_Link_GetKey(p_stRegisteredValue));
if (stricmp(szRegisteredString, szParams[0]))
{
char szMessage[256];
sprintf(szMessage, "There is an incoherence in the text file %s, at the string %s", p_fFile->a_szFileName, szParams[0]);
MessageBox(NULL,szMessage,"Incoherence in a TXT file",MB_OK|MB_ICONWARNING);
s_bIncoherenceInTxtFiles = TRUE;
#if defined ( ACTIVE_EDITOR )
fn_vForceEditor();
#endif /* ! ACTIVE_EDITOR */
}
}
}
/* normally this line should occur once per text per language -> everything will be fine if a given text name*/
/* always has the same index in the section, because only one linktable entry may exist with a given name*/
SCR_fnp_st_Link_SetValue(
&FON_g_stTextLinkTable,
szParams[0],
s_p_stLoadedLanguage -> uwNumberOfTexts
+ (
( s_p_stLoadedLanguage == FON_g_stGeneral . p_stCommonLanguage )
? FON_C_HandleOffsetForCommonLanguage
: 0
)
);
}
s_p_stLoadedLanguage -> d_pTextsArray[ s_p_stLoadedLanguage -> uwNumberOfTexts ] = hText ;
s_p_stLoadedLanguage -> uwNumberOfTexts ++ ;
}
break;
case SCR_EA_Anl_EndSection:
break;
}
return SCR_ERV_Anl_NormalReturn;
}
#endif /* U64 */
/*************************************************************************/
/* Binarisation functions*/
/* See with Alain Robin for any problem or question*/
/*char* FON_fn_p_cAlloc(unsigned long _ulSize)
{
return (char*)FON_fn_p_vAllocInBloc(E_ucFONMemoryBlock,_ulSize);
}*/

View File

@@ -0,0 +1,222 @@
#include "ACP_Base.h"
#include "ToolsCPA.h"
/*#include "SCR.h"*/
/*#include "DPT.h"*/
/*#include "GEO.h"*/
/*#include "GLI.h"*/
/*#include "TEX.h"*/
/*#include "SCR.h"*/
/*#include "VIG.h"*/
#include "RND.h"
/*#include "LST.h"*/
#include "fonerm.h"
#include "fonmem.h"
#include "Structur/EngMode.h"
/*#include "fonpub.h"*/
/*#include "FON_Eff.h"*/
#include "fonfont.h"
#include "fonload.h"
/*#include "fontext.h"*/
#include "ldt.h"
/*****************************************************************
Function name : fn_iCreateTextString
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iCreateTextString( LDT_tdst_Link *pLink )
{
char *szAction;
short wLanguageId;
/*allocate the pointer of lists of languages*/
register unsigned short uwLanguage = 0;
szAction = LDT_szGetSectionName();
/* by default if any problem*/
wLanguageId = 0;
do
{
if ( !stricmp(szAction, g_stEngineStructure.p_stLanguageTable[uwLanguage].szLanguageCode) )
{
wLanguageId = uwLanguage;
uwLanguage = g_stEngineStructure.ucNbLanguages;
}
} while( uwLanguage++<g_stEngineStructure.ucNbLanguages );
LDT_SetLinkValue( pLink, (unsigned long)wLanguageId );
/*allocate a new language definition structure if necessary*/
if ( FON_g_stGeneral.uwNumberOfLanguages <= wLanguageId )
{
long lIndex;
if ( FON_g_stGeneral.d_sLanguageArray )
{
FON_g_stGeneral.d_sLanguageArray = (tdstLanguage *) FON_fn_p_vReallocInBloc(
E_ucFONTextMemoryBlock,
FON_g_stGeneral.d_sLanguageArray,
(wLanguageId + 1) * sizeof(tdstLanguage)
);
}
else
{
FON_g_stGeneral.d_sLanguageArray = (tdstLanguage *) FON_fn_p_vAllocInBloc(
E_ucFONTextMemoryBlock,
(wLanguageId + 1) * sizeof(tdstLanguage)
);
}
/*initialize all new allocated structures*/
for ( lIndex = FON_g_stGeneral.uwNumberOfLanguages; lIndex < wLanguageId + 1; lIndex ++ )
{
FON_g_stGeneral.d_sLanguageArray[lIndex].d_pTextsArray = NULL;
FON_g_stGeneral.d_sLanguageArray[lIndex].uwMaxNumberOfTexts = 0;
FON_g_stGeneral.d_sLanguageArray[lIndex].uwNumberOfTexts = 0;
}
FON_g_stGeneral.uwNumberOfLanguages = (unsigned short) (wLanguageId + 1);
}
/*update the size of the string pointers array*/
FON_g_stGeneral.d_sLanguageArray[wLanguageId].uwMaxNumberOfTexts += (unsigned short) (atoi(LDT_szGetParam(1)));
if ( FON_g_stGeneral.d_sLanguageArray[wLanguageId].d_pTextsArray ) {
FON_g_stGeneral.d_sLanguageArray[wLanguageId].d_pTextsArray = (char/*struct FON_stText_*/ **) FON_fn_p_vReallocInBloc(
E_ucFONTextMemoryBlock,
FON_g_stGeneral.d_sLanguageArray[wLanguageId].d_pTextsArray,
FON_g_stGeneral.d_sLanguageArray[wLanguageId].uwMaxNumberOfTexts * sizeof(char/*struct FON_stText_*/ *)
);
}
else
{
FON_g_stGeneral.d_sLanguageArray[wLanguageId].d_pTextsArray = (char/*struct FON_stText_*/ **) FON_fn_p_vAllocInBloc(
E_ucFONTextMemoryBlock,
FON_g_stGeneral.d_sLanguageArray[wLanguageId].uwMaxNumberOfTexts * sizeof(char/*struct FON_stText_*/ *)
);
}
return 0;
}
/*****************************************************************
Function name : fn_iLoadTextString
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iLoadTextString( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
short wLanguageId = (short)LDT_GetLinkValue(pLink);
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
if ( !stricmp(szEntry, FON_C_SectionNewString) || !stricmp(szEntry, FON_C_SectionNewUpperString) )
{
char *hText;
if (FON_g_stGeneral.d_sLanguageArray[wLanguageId].uwNumberOfTexts >= FON_g_stGeneral.d_sLanguageArray[wLanguageId].uwMaxNumberOfTexts)
{
M_FONFatalError(E_uwFONNotEnoughStringSpace);
}
/* if the text is empty, try to find a non-empty version in any other language (the string is common to all)*/
if ( strlen(LDT_szGetParam(2)) == 0 )
{
long lIndex;
for (lIndex = 0; lIndex < FON_g_stGeneral.uwNumberOfLanguages; lIndex ++)
if ( FON_g_stGeneral.d_sLanguageArray[lIndex].d_pTextsArray )
{
/* get the text in the other language*/
hText = FON_g_stGeneral.d_sLanguageArray[lIndex].d_pTextsArray[FON_g_stGeneral.d_sLanguageArray[wLanguageId].uwNumberOfTexts];
if ( hText )
break;
}
}
else
{
hText = FON_fn_p_vAllocInBloc(E_ucFONTextMemoryBlock,strlen(LDT_szGetParam(2))+1);
strcpy(hText, LDT_szGetParam(2));
if ( !stricmp(szEntry,FON_C_SectionNewUpperString) )
strupr(hText);
/* normally this line should occur once per text per language -> everything will be fine if a given text name*/
/* always has the same index in the section, because only one linktable entry may exist with a given name*/
SCR_fnp_st_Link_SetValue(&FON_g_stTextLinkTable, LDT_szGetParam(1), FON_g_stGeneral.d_sLanguageArray[wLanguageId].uwNumberOfTexts);
}
FON_g_stGeneral.d_sLanguageArray[wLanguageId].d_pTextsArray[FON_g_stGeneral.d_sLanguageArray[wLanguageId].uwNumberOfTexts] = hText;
FON_g_stGeneral.d_sLanguageArray[wLanguageId].uwNumberOfTexts ++;
}
else if (!stricmp(szEntry, FON_C_SectionNewStringLength))
{
char *hText;
if (FON_g_stGeneral.d_sLanguageArray[wLanguageId].uwNumberOfTexts >= FON_g_stGeneral.d_sLanguageArray[wLanguageId].uwMaxNumberOfTexts)
{
M_FONFatalError(E_uwFONNotEnoughStringSpace);
}
/* if the text is empty, try to find a non-empty version in any other language (the string is common to all)*/
if ( atoi(LDT_szGetParam(2)) == 0 )
{
long lIndex;
for (lIndex = 0; lIndex < FON_g_stGeneral.uwNumberOfLanguages; lIndex ++)
if ( FON_g_stGeneral.d_sLanguageArray[lIndex].d_pTextsArray )
{
/* get the text in the other language*/
hText = FON_g_stGeneral.d_sLanguageArray[lIndex].d_pTextsArray[FON_g_stGeneral.d_sLanguageArray[wLanguageId].uwNumberOfTexts];
if ( hText )
break;
}
}
else
{
long lSize;
lSize = atoi(LDT_szGetParam(2));
/* allocate a string and fill it with whitespaces (so that strlen() is non-zero)*/
hText = FON_fn_p_vAllocInBloc(E_ucFONTextMemoryBlock,lSize + 1);
memset(hText, 0, lSize + 1);
memset(hText, ' ', lSize);
*(short *) (hText + lSize) = (short) lSize;
/* normally this line should occur once per text per language -> everything will be fine if a given text name*/
/* always has the same index in the section, because only one linktable entry may exist with a given name*/
SCR_fnp_st_Link_SetValue(&FON_g_stTextLinkTable, LDT_szGetParam(1), FON_g_stGeneral.d_sLanguageArray[wLanguageId].uwNumberOfTexts);
}
FON_g_stGeneral.d_sLanguageArray[wLanguageId].d_pTextsArray[FON_g_stGeneral.d_sLanguageArray[wLanguageId].uwNumberOfTexts] = hText;
FON_g_stGeneral.d_sLanguageArray[wLanguageId].uwNumberOfTexts ++;
}
}
}
}
return 0;
}

View File

@@ -0,0 +1,166 @@
/*=========================================================================
* mnubase.c : MEmory management of the menus
*
* Version 1.0
* Creation date 27/05/97
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi R&D 1997
*=======================================================================*/
/*
*=======================================================================
Modifications:
*=======================================================================*/
/*#include "fonhdls.h"*/
#include "ACP_Base.h"
#include "ToolsCPA.h"
#include "fonerm.h"
#include "fonmem.h"
static unsigned long gs_ulFontTextMemorySize;
//FB300699
#ifdef U64
#ifndef FINAL_VERSION
#define CHECK_STRING
#endif
#endif
/**************************************************************************/
void *FON_fn_p_vAllocInBloc(enum e_ucFONStaticBlocks eBloc,unsigned long lSize)
{
void *p_vPointer;
/* Note : should not use Mmg_M_BigBoundSize !!*/
/* Mmg_M_BigBoundSize (lSize , C_uwAllocSize);*/
Mmg_M_SetModeAlloc4Ch(FON,(unsigned char)eBloc,C_ucMmgDefaultChannel);
MMG_fn_vAddMemoryInfo (MMG_C_lTypeGAM , MMG_C_lSubTypeFont , NULL);
p_vPointer = Mmg_fn_p_vAlloc4Ch(lSize,C_ucMmgDefaultChannel);
#ifndef CHECK_STRING
if (p_vPointer==NULL)
M_FONFatalError(E_uwFONMemoryError);
memset(p_vPointer,0,lSize);
#endif
return (p_vPointer);
}
/**************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void *FON_fn_p_vReallocInBloc(enum e_ucFONStaticBlocks eBloc,void *p_vPointer,unsigned long lSize)
{
Mmg_M_SetModeAlloc4Ch(FON,(unsigned char)eBloc,C_ucMmgDefaultChannel);
p_vPointer = Mmg_fn_p_vRealloc4Ch(p_vPointer,lSize,C_ucMmgDefaultChannel);
if (p_vPointer==NULL)
M_FONFatalError(E_uwFONMemoryError);
return (p_vPointer);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/**************************************************************************/
//XB 21/04/99
//#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
//End XB
void FON_fn_vFreeInBloc(enum e_ucFONStaticBlocks eBloc,void *p_vPointer)
{
Mmg_M_SetModeAlloc4Ch(FON,(unsigned char)eBloc,C_ucMmgDefaultChannel);
MMG_fn_vAddMemoryInfo (MMG_C_lTypeGAM , MMG_C_lSubTypeFont , NULL);
Mmg_fn_vFree4Ch(p_vPointer,C_ucMmgDefaultChannel);
}
//XB 21/04/99
//#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
//End XB
/**************************************************************************/
void FON_fn_vFirstInitFONMemory(unsigned long _ulFontTextMemorySize)
{
Erm_M_InitErrMsg(FON); /* Init the error module*/
Mmg_M_InitMmg(FON);
#if !defined(U64)
/**** Check the ACP memory module ****/
Mmg_fn_cCheckAlignmentValidity();
Mmg_M_InitBlock(FON,E_ucFONTextMemoryBlock,_ulFontTextMemorySize);
#else /* !U64 */
#ifdef CHECK_MEMORY
Mmg_M_InitSpecificBlock(FON,E_ucFONTextMemoryBlock, _ulFontTextMemorySize, 10000, 4, C_BlockWithFreeFlag | C_Check_AlignementFlag | C_Check_OverflowFlag);
#else /* CHECK_MEMORY */
//XB 21/04/99
//Mmg_M_InitSpecificBlock(FON,E_ucFONTextMemoryBlock, _ulFontTextMemorySize, 10000, 4, C_BlockWithoutFreeFlag | C_Check_AlignementFlag | C_Check_OverflowFlag);
Mmg_M_InitSpecificBlock(FON,E_ucFONTextMemoryBlock, _ulFontTextMemorySize, 10000, 4, C_BlockWithFreeFlag | C_Check_AlignementFlag | C_Check_OverflowFlag);
//End XB
#endif /* CHECK_MEMORY */
#endif /* U64 */
/**** Save memory size (for reinit) ****/
gs_ulFontTextMemorySize = _ulFontTextMemorySize;
}
/**************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void FON_fn_vDesinitFONMemory(void)
{
/*Mmg_M_FreeBlock(FON,E_ucFONMemoryBlock);*/
/*Mmg_M_DeleteBlock(FON,E_ucFONMemoryBlock);*/
Mmg_M_FreeBlock(FON,E_ucFONTextMemoryBlock);
Mmg_M_DeleteBlock(FON,E_ucFONTextMemoryBlock);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/**************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void FON_fn_vReinitFONMemory(void)
{
/**** free the block*/
Mmg_M_FreeBlock(FON,E_ucFONTextMemoryBlock);
Mmg_M_DeleteBlock(FON,E_ucFONTextMemoryBlock);
/**** Check the ACP memory module ****/
Mmg_fn_cCheckAlignmentValidity();
/**** Reinit the block*/
Mmg_M_InitBlock(FON,E_ucFONTextMemoryBlock,gs_ulFontTextMemorySize);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/**************************************************************************/
#if !defined(RETAIL) || defined(FINAL_VERSION_FOR_TESTERS)
void FON_PrintUsedStaticMemory(void)
{
Mmg_M_PrintUsedStaticMemoryInModule(FON);
}
#endif /* !defined(RETAIL) || defined(FINAL_VERSION_FOR_TESTERS) */
/**************************************************************************/
/*XB*/
#ifdef CHECK_MEMORY
void FON_CheckMemory(void)
{
Mmg_M_CheckMemory(FON);
}
#endif /* CHECK_MEMORY */
/*End XB*/
/**************************************************************************/
/* XB 02/06/99 */
#ifndef FINAL_VERSION
unsigned long FON_fn_ulGetUsedStaticMemory(void)
{
return Mmg_M_GetUsedStaticMemory(FON);
}
#endif /* FINAL_VERSION */
/* End XB 02/06/99 */
/**************************************************************************/

View File

@@ -0,0 +1,54 @@
#ifndef __FONMEM_H__
#define __FONMEM_H__
#include "CPA_Expt.h"
#ifdef __cplusplus
extern "C" {
#endif
#include "mmg.h"
/******************************************/
#if _MSC_VER >= 1000
#pragma once
#endif /* _MSC_VER >= 1000 */
/******************************************/
enum e_ucFONStaticBlocks
{
E_ucFONTextMemoryBlock,
/*E_ucFONMemoryBlock,*/
E_ucFONMaxBlocksNb
};
#undef EXTERN
#undef extern
#if !defined(FON_MainFile)
#define EXTERN extern
#else
#define EXTERN
#endif /* MNU_MainFile */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
EXTERN tdstBlockInfo g_a_stFONBlocksInfo[E_ucFONMaxBlocksNb];
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifdef __DYNAMIC_MALLOC_ALLOWED__
#ifdef __DEBUG_MALLOC_MODE__
EXTERN tdstDynInfo g_stFONDynInfo;
#endif /* __DEBUG_MALLOC_MODE__ */
#endif /* __DYNAMIC_MALLOC_ALLOWED__ */
#undef EXTERN
#undef extern
extern CPA_EXPORT void *FON_fn_p_vAllocInBloc(enum e_ucFONStaticBlocks eBloc,unsigned long lSize);
extern CPA_EXPORT void *FON_fn_p_vReallocInBloc(enum e_ucFONStaticBlocks eBloc,void *p_vPointer,unsigned long lSize);
extern CPA_EXPORT void FON_fn_vFreeInBloc(enum e_ucFONStaticBlocks eBloc,void *p_vPointer);
#ifdef __cplusplus
}/* extern "C" */
#endif
#endif /* __FONMEM_H__ */

View File

@@ -0,0 +1,625 @@
/*=========================================================================
* mittext.c : Functions for the menus management
*
* Version 1.0
* Creation date 2./05/97
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi R&D 1997
*=======================================================================*/
/*
*=======================================================================
Modifications:
*=======================================================================*/
/*#include "fonhdls.h"*/
#include "ACP_Base.h"
#include "ToolsCPA.h"
#include "macros.h"
#include "Structur/EngMode.h"
#include "MTH.h"
/*#include "DPT.h"*/
/*#include "GEO.h"*/
/*#include "GLI.h"*/
#include "SCR.h"
#include "RND.h"
/*#include "POS.h"*/
/*#include "SPO.h"*/
/*#include "LST.h"*/
#include "fonpub.h"
/*#include "fonmem.h"*/
#include "fonerm.h"
#include "fonfont.h"
/*#include "FON_Eff.h"*/
#include "fontext.h"
/*XB*/
/*#include <string.h>*/
/*End XB*/
/*************************************************************************/
/*MTH_tdxReal FON_fn_xComputePartXWithAlign(FON_tdxHandleOfString hText,long lIndex,MTH_tdxReal x,enum FON_tdeAlignment_ eXAlign)
{
MTH_tdxReal xPosX = 0.0f;
if (eXAlign==FON_E_LeftAlign)
xPosX=x;
else if (eXAlign==FON_E_MiddleAlign)
xPosX=x-FON_fn_xWidthOfText(hText,lIndex)/2;
else if (eXAlign==FON_E_RightAlign)
xPosX=x-FON_fn_xWidthOfText(hText,lIndex);
return(xPosX);
}*/
/*************************************************************************/
/*MTH_tdxReal FON_fn_xComputeXWithAlign(FON_tdxHandleOfString hText,MTH_tdxReal x,enum FON_tdeAlignment_ eXAlign)
{
MTH_tdxReal xPosX = 0.0f;
if (eXAlign==FON_E_LeftAlign)
xPosX=x;
else if (eXAlign==FON_E_MiddleAlign)
xPosX=x-FON_fn_xWidthOfMultipleText(hText)/2;
else if (eXAlign==FON_E_RightAlign)
xPosX=x-FON_fn_xWidthOfMultipleText(hText);
return(xPosX);
}*/
/*************************************************************************/
/*MTH_tdxReal FON_fn_xComputeYWithAlign(FON_tdxHandleOfString hText,MTH_tdxReal y,enum FON_tdeAlignment_ eYAlign)
{
MTH_tdxReal xPosY = 0.0f;
if (eYAlign==FON_E_UpAlign)
xPosY=y/ *-FON_fn_xHeightOfMultipleText(hText)* /;
else if (eYAlign==FON_E_MiddleAlign)
xPosY=y-FON_fn_xHeightOfMultipleText(hText)/2;
else if (eYAlign==FON_E_DownAlign)
xPosY=y-FON_fn_xHeightOfMultipleText(hText);
return(xPosY);
}*/
/*************************************************************************/
/*void FON_fn_vDrawText(FON_tdxHandleOfString hText,MTH_tdxReal x,MTH_tdxReal y,enum FON_tdeAlignment_ eXAlign,enum FON_tdeAlignment_ eYAlign,FON_tdeTypeOfDisplay _eDisplayType)
{
FON_fn_vDrawText3D(hText,x,y,0.0,eXAlign,eYAlign,_eDisplayType);
}*/
/*************************************************************************/
/*void FON_fn_vDrawText3D(FON_tdxHandleOfString hText,MTH_tdxReal x,MTH_tdxReal y,MTH_tdxReal z,enum FON_tdeAlignment_ eXAlign,enum FON_tdeAlignment_ eYAlign,FON_tdeTypeOfDisplay _eDisplayType)
{
char *szText;
MTH3D_tdstVector stVector;
MTH3D_tdstVector stI,stJ,stK;
MTH_tdxReal xZDecalValue;
FON_tdxHandleOfFont hFont;
struct FON_st3DFont_ *h3DObject;
unsigned long i,j;
unsigned long ulNextCharacter;
unsigned short uwDisplayedCharacter;
struct FON_stText_ *p_stText;
POS_fn_vSetIdentityMatrix(FON_g_stGeneral.hMatrix);
p_stText = FON_fn_p_stGetTextPointerOfHandle(hText);
hFont = FON_fn_xGetFontOfTextHandle(hText);
szText=p_stText->szText;
MTH3D_M_vSetZofVector(&stVector,FON_fn_xComputeYWithAlign(hText,(MTH_tdxReal)y,eYAlign));
MTH3D_M_vSetYofVector(&stVector,z);
xZDecalValue = FON_fn_xHeightOfText(hText);
for (j=0;szText[j]!=0;j=i)
{
MTH3D_M_vSetXofVector(&stVector,FON_fn_xComputePartXWithAlign(hText,j,(MTH_tdxReal)x,eXAlign));
for (i=j;szText[i]!=0&&szText[i]!=0x5E;i=ulNextCharacter)
{
uwDisplayedCharacter = FON_fn_uwGetDisplayedCharacter(hFont,szText,i);
ulNextCharacter = FON_fn_vGetNextCharacter(hFont,szText,i);
if (p_stText->d_hLocalMatrix!=NULL)
{
POS_fn_vGetTranslationVector(p_stText->d_hLocalMatrix[i],&stI);
MTH3D_M_vAddVector(&stI,&stI,&stVector);
POS_fn_vSetTranslationVector(FON_g_stGeneral.hMatrix,&stI);
POS_fn_vGetRotationMatrix(p_stText->d_hLocalMatrix[i],&stI,&stJ,&stK);
POS_fn_vSetRotationMatrix(FON_g_stGeneral.hMatrix,&stI,&stJ,&stK);
POS_fn_vGetScaleMatrix(p_stText->d_hLocalMatrix[i],&stI,&stJ,&stK);
POS_fn_vSetScaleMatrix(FON_g_stGeneral.hMatrix,&stI,&stJ,&stK);
}
else
{
POS_fn_vSetTranslationVector(FON_g_stGeneral.hMatrix,&stVector);
MTH3D_M_vSetVectorElements(&stI,1,0,0);
MTH3D_M_vSetVectorElements(&stJ,0,1,0);
MTH3D_M_vSetVectorElements(&stK,0,0,1);
POS_fn_vSetRotationMatrix(FON_g_stGeneral.hMatrix,&stI,&stJ,&stK);
POS_fn_vSetScaleMatrix(FON_g_stGeneral.hMatrix,&stI,&stJ,&stK);
}
h3DObject=FON_fn_p_stGet3dObjectOfCharacter(hFont,uwDisplayedCharacter);
POS_fn_vGetTranslationVector(FON_g_stGeneral.hMatrix,&stI);
MTH3D_M_vSetZofVector(&stI,MTH3D_M_xGetZofVector(&stI)+xZDecalValue-h3DObject->xHeight+FON_fn_xGetBaseYOfCharacter(hFont,uwDisplayedCharacter));
POS_fn_vSetTranslationVector(FON_g_stGeneral.hMatrix,&stI);
if (h3DObject->hGLIGeometric!=NULL)
if (FON_fn_p_stGetTextPointerOfHandle(hText)->d_p_stLight!=NULL)
FON_fn_vDraw3DObject(h3DObject,FON_g_stGeneral.hMatrix,FON_fn_p_stGetTextPointerOfHandle(hText)->d_p_stLight[i]);
else
FON_fn_vDraw3DObject(h3DObject,FON_g_stGeneral.hMatrix,NULL);
// *** Effect of text *** - Oliv' - Portage v15 - 1 warning removed here
FON_fn_vPlayLetterEffect(hText,FON_fn_p_stGetEffectPointerOfHandle(hText),i);
if (_eDisplayType==FON_Enabled)
FON_fn_vPlayLetterEffect(hText,&FON_g_stEffectByDisplay.stEnabledEffect,i);
else if (_eDisplayType==FON_Disabled)
FON_fn_vPlayLetterEffect(hText,&FON_g_stEffectByDisplay.stDisabledEffect,i);
else if (_eDisplayType==FON_Pressed)
FON_fn_vPlayLetterEffect(hText,&FON_g_stEffectByDisplay.stPressedEffect,i);
else if (_eDisplayType==FON_Selected)
FON_fn_vPlayLetterEffect(hText,&FON_g_stEffectByDisplay.stSelectedEffect,i);
MTH3D_M_vSetXofVector(&stVector,
MTH3D_M_xGetXofVector(&stVector)+
h3DObject->xWidth/2+
hFont->xCharacterSpace);
if (szText[ulNextCharacter]!=0)
{
h3DObject=FON_fn_p_stGet3dObjectOfCharacter(hFont,FON_fn_uwGetDisplayedCharacter(hFont,szText,ulNextCharacter));
MTH3D_M_vSetXofVector(&stVector,
MTH3D_M_xGetXofVector(&stVector)+
h3DObject->xWidth/2);
}
}
if (szText[i]==0x5E)
i++;
MTH3D_M_vSetZofVector(&stVector,MTH3D_M_xGetZofVector(&stVector)+FON_fn_xHeightOfText(hText));
}
}*/
/**************************************************************************/
/*MTH_tdxReal FON_fn_xWidthOfTextByHandle(FON_tdxHandleOfString hText,long lIndex)
{
return(FON_fn_xWidthOfText(hText,lIndex));
}*/
/**************************************************************************/
/*MTH_tdxReal FON_fn_xHeightOfTextByHandle(FON_tdxHandleOfString hText)
{
return(FON_fn_xHeightOfText(hText));
}*/
/**************************************************************************/
/*MTH_tdxReal FON_fn_xWidthOfText(FON_tdxHandleOfString hText,long lIndex)
{
unsigned int i;
MTH_tdxReal xPosX = 0.0f;
char *szText=FON_fn_p_stGetTextPointerOfHandle(hText)->szText+lIndex;
struct FON_st3DFont_ *h3DObject;
unsigned long ulNextCharacter;
FON_tdxHandleOfFont hFont;
hFont = FON_fn_xGetFontOfTextHandle(hText);
for (i=0;szText[i]!=0&&szText[i]!=0x5E;i=ulNextCharacter)
{
ulNextCharacter = FON_fn_vGetNextCharacter(hFont,szText,i);
h3DObject=FON_fn_p_stGet3dObjectOfCharacter(hFont,FON_fn_uwGetDisplayedCharacter(hFont,szText,i));
if (i==0&&(szText[i+1]==0||szText[ulNextCharacter]==0x5E))
{
xPosX=0.0f;
}
else if(szText[ulNextCharacter]==0||szText[ulNextCharacter]==0x5E)
xPosX+=(h3DObject->xWidth)/2;
else if(i==0)
xPosX+=(h3DObject->xWidth)/2 + hFont->xCharacterSpace;
else
xPosX+=h3DObject->xWidth + hFont->xCharacterSpace;
}
return(xPosX);
}*/
/**************************************************************************/
/*MTH_tdxReal FON_fn_xHeightOfText(FON_tdxHandleOfString hText)
{
return(FON_fn_p_stGet3dObjectOfCharacter(FON_fn_p_stGetFontAndEffectPointerOfHandle(hText)->p_stFont,' ')->xHeight);
return MTH_C_ZERO;
}*/
/**************************************************************************/
/*MTH_tdxReal FON_fn_xWidthOfLetter(FON_tdxHandleOfString hText,unsigned long lIndex)
{
MTH_tdxReal xPosX = 0.0f;
char *szText=FON_fn_p_stGetTextPointerOfHandle(hText)->szText+lIndex;
struct FON_st3DFont_ *h3DObject;
FON_tdxHandleOfFont hFont;
hFont = FON_fn_xGetFontOfTextHandle(hText);
h3DObject=FON_fn_p_stGet3dObjectOfCharacter(hFont,FON_fn_uwGetDisplayedCharacter(hFont,szText,0));
xPosX=h3DObject->xWidth + hFont->xCharacterSpace;
return(xPosX);
}*/
/**************************************************************************/
/*MTH_tdxReal FON_fn_xWidthOfMultipleText(FON_tdxHandleOfString hText)
{
unsigned long i;
MTH_tdxReal xMaxPosX = 0.0f;
MTH_tdxReal xPosX = 0.0f;
char *szText=FON_fn_p_stGetTextPointerOfHandle(hText)->szText;
struct FON_st3DFont_ *h3DObject;
unsigned long ulNextCharacter;
FON_tdxHandleOfFont hFont;
hFont = FON_fn_xGetFontOfTextHandle(hText);
for (i=0;szText[i]!=0;i=ulNextCharacter)
{
ulNextCharacter = FON_fn_vGetNextCharacter(hFont,szText,i);
if (szText[i]==0x5E)
{
xPosX = 0;
}
else
{
h3DObject=FON_fn_p_stGet3dObjectOfCharacter(hFont,FON_fn_uwGetDisplayedCharacter(hFont,szText,i));
if(szText[ulNextCharacter]==0||szText[ulNextCharacter]==0x5E)
xPosX+=(h3DObject->xWidth)/2;
else if(i==0)
xPosX+=(h3DObject->xWidth)/2 + hFont->xCharacterSpace;
else
xPosX+=h3DObject->xWidth + hFont->xCharacterSpace;
if (xPosX>xMaxPosX)
xMaxPosX = xPosX;
}
}
return(xMaxPosX);
}*/
/**************************************************************************/
/*MTH_tdxReal FON_fn_xHeightOfMultipleText(FON_tdxHandleOfString hText)
{
char *p_szTemp = FON_fn_p_stGetTextPointerOfHandle(hText)->szText;
unsigned long i;
for (i=1;strchr(p_szTemp,0x5E)!=NULL;i++,p_szTemp=strchr(p_szTemp,0x5E)+1);
return(i*(FON_fn_p_stGet3dObjectOfCharacter(FON_fn_p_stGetFontAndEffectPointerOfHandle(hText)->p_stFont,' ')->xHeight));
}*/
/**************************************************************************/
/*MTH_tdxReal FON_fn_xRealHeightOfText(FON_tdxHandleOfString hText,long lIndex)
{
unsigned int i;
MTH_tdxReal xHeight = 0.0f;
char *szText=FON_fn_p_stGetTextPointerOfHandle(hText)->szText+lIndex;
struct FON_st3DFont_ *h3DObject = NULL;
FON_tdxHandleOfFont hFont;
unsigned long ulNextCharacter;
hFont = FON_fn_xGetFontOfTextHandle(hText);
for (i=0;szText[i]!=0&&szText[i]!=0x5E;i=ulNextCharacter)
{
ulNextCharacter = FON_fn_vGetNextCharacter(hFont,szText,i);
h3DObject=FON_fn_p_stGet3dObjectOfCharacter(hFont,FON_fn_uwGetDisplayedCharacter(hFont,szText,i));
if (xHeight>h3DObject->xHeight)
xHeight=h3DObject->xHeight;
}
return(xHeight);
}*/
/**************************************************************************/
/*void FON_fn_vAllocText(FON_tdxHandleOfString hTextNumber,unsigned long _ulSize/ *,enum FON_tdeTextEffect_ _eTextEffect* /)
{
char/ *struct FON_stText_* / *hText;
//struct FON_tdstFontAndEffect_ *hFontAndEffect;
// unsigned long i;
//hText = FON_fn_p_vAllocInBloc(E_ucFONTextMemoryBlock,sizeof(struct FON_stText_));
//hFontAndEffect=FON_fn_p_vAllocInBloc(E_ucFONMemoryBlock,sizeof(struct FON_tdstFontAndEffect_));
hText/ *->szText* / = FON_fn_p_vAllocInBloc(E_ucFONTextMemoryBlock,_ulSize+1);
memset(hText/ *->szText* /,0,_ulSize+1);
memset(hText/ *->szText* /,' ',_ulSize);
// *** Effect gestion *** - Oliv' - Portage v15 - 1 warning removed here
/ *if (_eTextEffect!=FON_e_Nothing)
{
if (_eTextEffect&FON_e_NeedMatrix)
hText->d_hLocalMatrix = FON_fn_p_vAllocInBloc(E_ucFONTextMemoryBlock,_ulSize*sizeof(void *));
else
hText->d_hLocalMatrix = NULL;
if (_eTextEffect&FON_e_Translation)
hText->d_hLocalDynTranslation = FON_fn_p_vAllocInBloc(E_ucFONTextMemoryBlock,_ulSize*sizeof(void *));
else
hText->d_hLocalDynTranslation = NULL;
if (_eTextEffect&FON_e_Rotation)
hText->d_hLocalDynRotation = FON_fn_p_vAllocInBloc(E_ucFONTextMemoryBlock,_ulSize*sizeof(void *));
else
hText->d_hLocalDynRotation = NULL;
if (_eTextEffect&FON_e_Scale)
hText->d_hLocalDynScale = FON_fn_p_vAllocInBloc(E_ucFONTextMemoryBlock,_ulSize*sizeof(void *));
else
hText->d_hLocalDynScale = NULL;
if (_eTextEffect&FON_e_Light)
hText->d_p_stLight = FON_fn_p_vAllocInBloc(E_ucFONTextMemoryBlock,_ulSize*sizeof(void *));
else
hText->d_p_stLight = NULL;
for (i=0;i<_ulSize;i++)
{
if (_eTextEffect&FON_e_NeedMatrix)
{
hText->d_hLocalMatrix[i] = GEO_fn_hCreateMatrix();
POS_fn_vSetIdentityMatrix(hText->d_hLocalMatrix[i]);
}
if (_eTextEffect&FON_e_Translation)
{
hText->d_hLocalDynTranslation[i] = POS_fn_hCreateDynVector();
POS_fn_vSetDynVector(hText->d_hLocalDynTranslation[i],0.0,0.0,0.0);
}
if (_eTextEffect&FON_e_Rotation)
{
hText->d_hLocalDynRotation[i] = POS_fn_hCreateDynVector();
POS_fn_vSetDynVector(hText->d_hLocalDynRotation[i],0.0,0.0,0.0);
}
if (_eTextEffect&FON_e_Scale)
{
hText->d_hLocalDynScale[i] = POS_fn_hCreateDynVector();
POS_fn_vSetDynVector(hText->d_hLocalDynScale[i],1.0,1.0,1.0);
}
if (_eTextEffect&FON_e_Light)
hText->d_p_stLight[i] = NULL;
}
}
else
{
hText->d_hLocalMatrix = NULL;
hText->d_hLocalDynTranslation = NULL;
hText->d_hLocalDynRotation = NULL;
hText->d_hLocalDynScale = NULL;
hText->d_p_stLight = NULL;
}* /
//hFontAndEffect->p_stFont = NULL;
FON_g_stGeneral.d_stTextsArray[hTextNumber] = hText;
//FON_g_stGeneral.d_stFontAndEffectArray[hTextNumber] = hFontAndEffect;
}*/
/**************************************************************************/
/*
void FON_fn_vAllocTextWithoutString(FON_tdxHandleOfString hTextNumber,unsigned long _ulSize)
{
struct FON_stText_ *hText;
struct FON_tdstFontAndEffect_ *hFontAndEffect;
unsigned long i;
hText=FON_fn_p_vAllocInBloc(E_ucFONTextMemoryBlock,sizeof(struct FON_stText_));
hFontAndEffect=FON_fn_p_vAllocInBloc(E_ucFONMemoryBlock,sizeof(struct FON_tdstFontAndEffect_));
hText->d_hLocalMatrix = FON_fn_p_vAllocInBloc(E_ucFONTextMemoryBlock,_ulSize*sizeof(void *));
hText->d_hLocalDynTranslation = FON_fn_p_vAllocInBloc(E_ucFONTextMemoryBlock,_ulSize*sizeof(void *));
hText->d_hLocalDynRotation = FON_fn_p_vAllocInBloc(E_ucFONTextMemoryBlock,_ulSize*sizeof(void *));
hText->d_hLocalDynScale = FON_fn_p_vAllocInBloc(E_ucFONTextMemoryBlock,_ulSize*sizeof(void *));
for (i=0;i<_ulSize;i++)
{
hText->d_hLocalMatrix[i] = GEO_fn_hCreateMatrix();
POS_fn_vSetIdentityMatrix(hText->d_hLocalMatrix[i]);
hText->d_hLocalDynTranslation[i] = POS_fn_hCreateDynVector();
hText->d_hLocalDynRotation[i] = POS_fn_hCreateDynVector();
hText->d_hLocalDynScale[i] = POS_fn_hCreateDynVector();
POS_fn_vSetDynVector(hText->d_hLocalDynTranslation[i],0.0,0.0,0.0);
POS_fn_vSetDynVector(hText->d_hLocalDynRotation[i],0.0,0.0,0.0);
POS_fn_vSetDynVector(hText->d_hLocalDynScale[i],1.0,1.0,1.0);
}
hFontAndEffect->p_stFont = NULL;
FON_g_stGeneral.d_stTextsArray[hTextNumber] = hText;
FON_g_stGeneral.d_stFontAndEffectArray[hTextNumber] = hFontAndEffect;
}
*/
/**************************************************************************/
/*unsigned long FON_fn_ulGetNumberOfTexts(void)
{
return(FON_g_stGeneral.ulNumberOfTexts);
}*/
#if !defined(U64)
/**************************************************************************/
FON_tdxHandleOfText FON_fn_hGetTextHandle(char *_szLinkKey)
{
FON_tdxHandleOfText hReturn = FON_C_xInvalidTextHandle;
if ( _szLinkKey && strlen(_szLinkKey) )
{
SCR_tdst_Link_Value *p_xIndex;
p_xIndex = SCR_fnp_st_Link_SearchKey(&FON_g_stTextLinkTable,_szLinkKey);
if (p_xIndex!=NULL&&SCR_M_e_Link_GetState(p_xIndex)==SCR_ELS_Link_Initialized)
{
hReturn = (FON_tdxHandleOfText) SCR_M_ul_Link_GetValue(p_xIndex);
}
if ( hReturn == FON_C_xInvalidTextHandle )
M_FONWarningError(E_uwFONUnknownText);
}
return hReturn;
}
/**************************************************************************/
FON_tdxHandleOfText FON_fn_hGetTextHandleWithoutWarning(char *_szLinkKey)
{
FON_tdxHandleOfText hReturn = FON_C_xInvalidTextHandle;
SCR_tdst_Link_Value *p_xIndex;
p_xIndex = SCR_fnp_st_Link_SearchKey(&FON_g_stTextLinkTable,_szLinkKey);
if (p_xIndex!=NULL&&SCR_M_e_Link_GetState(p_xIndex)==SCR_ELS_Link_Initialized)
{
hReturn = (FON_tdxHandleOfText) SCR_M_ul_Link_GetValue(p_xIndex);
}
return hReturn;
}
/**************************************************************************/
#ifdef ACTIVE_EDITOR
char *FON_fn_szGetNameOfTextHandle(FON_tdxHandleOfText hString)
{
char *p_szReturn = NULL;
SCR_tdst_Link_Value *p_xIndex;
p_xIndex = SCR_fnp_st_Link_SearchValue(&FON_g_stTextLinkTable,(long) hString);
if (p_xIndex!=NULL&&SCR_M_e_Link_GetState(p_xIndex)==SCR_ELS_Link_Initialized)
{
p_szReturn = (char *)SCR_M_p_sz_Link_GetKey(p_xIndex);
}
return p_szReturn;
}
#endif /* ACTIVE_EDITOR */
/**************************************************************************/
#endif /* U64 */
char *FON_fn_szLoadOneStringForCurrentLanguage(FON_tdxHandleOfText _IdOfString);
char *FON_fn_szGetTextPointerForHandle(FON_tdxHandleOfText hString)
{
return ( hString == FON_C_xInvalidTextHandle )
? NULL
#ifdef U64 // FB170399
: FON_fn_szLoadOneStringForCurrentLanguage(hString);
#else
: (
( hString < FON_C_HandleOffsetForCommonLanguage )
? FON_g_stGeneral.d_sLanguageArray[g_stEngineStructure.ucCurrentLanguage].d_pTextsArray[hString]
: FON_g_stGeneral . p_stCommonLanguage -> d_pTextsArray[ hString - FON_C_HandleOffsetForCommonLanguage ]
) ;
#endif
}
#if !defined(RETAIL) || defined(USE_MONITOR)
unsigned short FON_fn_uwGetNumberOfAvailableLanguages()
{
return FON_g_stGeneral.uwNumberOfLanguages;
}
#endif !defined(RETAIL) || defined(USE_MONITOR)
/*FON_tdxHandleOfString FON_fn_hGetTextHandleWithFont(char *_szLinkKey,FON_tdxHandleOfFont hFont)
{
FON_tdxHandleOfString hReturn = FON_fn_hGetInvalidTextHandle();
#if !defined(U64)
SCR_tdst_Link_Value *p_xIndex;
p_xIndex = SCR_fnp_st_Link_SearchKey(&FON_g_stGeneral.stTextLinkTable,_szLinkKey);
if (p_xIndex!=NULL&&SCR_M_e_Link_GetState(p_xIndex)==SCR_ELS_Link_Initialized)
{
hReturn = (FON_tdxHandleOfString)SCR_M_ul_Link_GetValue(p_xIndex);
FON_fn_vChangeFontOfText(hReturn,hFont);
}
if (hReturn==FON_fn_hGetInvalidTextHandle())
M_FONWarningError(E_uwFONUnknownText);
#endif // U64
return (hReturn);
}*/
/*************************************************************************/
/*void FON_fn_vChangeFontOfText(FON_tdxHandleOfString hText,FON_tdxHandleOfFont hFont)
{
FON_g_stGeneral.d_stFontAndEffectArray[hText]->p_stFont = hFont;
}*/
/*************************************************************************/
/*FON_tdxHandleOfFont FON_fn_xGetFontOfTextHandle(FON_tdxHandleOfString hText)
{
return(FON_g_stGeneral.d_stFontAndEffectArray[hText]->p_stFont);
}*/
/*************************************************************************/
/*char/ *struct FON_stText_* / *FON_fn_p_stGetTextPointerOfHandle(FON_tdxHandleOfString hText)
{
return(FON_g_stGeneral.d_stTextsArray[hText]);
}*/
/*************************************************************************/
/*struct FON_tdstFontAndEffect_ *FON_fn_p_stGetFontAndEffectPointerOfHandle(FON_tdxHandleOfString hText)
{
return(FON_g_stGeneral.d_stFontAndEffectArray[hText]);
}*/
/*************************************************************************/
/*struct FON_tdstEffect_ *FON_fn_p_stGetEffectPointerOfHandle(FON_tdxHandleOfString hText)
{
return(&FON_g_stGeneral.d_stFontAndEffectArray[hText]->stEffect);
}*/
/*************************************************************************/
/*enum FON_tdeTypeOfFont_ FON_fn_eGetTypeOfFontForText(FON_tdxHandleOfString hText)
{
enum FON_tdeTypeOfFont_ eReturn = FON_eUnknow;
if (FON_fn_p_stGetFontAndEffectPointerOfHandle(hText)->p_stFont!=NULL)
eReturn = FON_fn_p_stGetFontAndEffectPointerOfHandle(hText)->p_stFont->eTypeOfFont;
return(eReturn);
}*/
/*************************************************************************/
/*unsigned long FON_fn_ulGetDisplayedLenghtOfText(FON_tdxHandleOfString hText)
{
// *** Return the number of displayed characters *** - Oliv' - Portage v15 - 1 warning removed here
unsigned long i;
unsigned long ulReturn = 0;
char *p_szText;
FON_tdxHandleOfFont hFont;
hFont = FON_fn_xGetFontOfTextHandle(hText);
p_szText = FON_fn_p_stGetTextPointerOfHandle(hText)/ *->szText* /;
for (i=0;p_szText[i]!=0;i=FON_fn_vGetNextCharacter(hFont,p_szText,i),ulReturn++);
return(ulReturn);
}*/
/*************************************************************************/
/*unsigned long FON_fn_ulGetTrueLenghtOfText(FON_tdxHandleOfString hText)
{
// *** Return the number of char characters *** - Oliv' - Portage v15 - 1 warning removed here
return(strlen(FON_fn_p_stGetTextPointerOfHandle(hText)->szText));
}*/
/*************************************************************************/
/*char *FON_fn_p_szGetStringPointer(FON_tdxHandleOfString hText)
{
return(FON_fn_p_stGetTextPointerOfHandle(hText)->szText);
}*/
/*************************************************************************/
/*void FON_fn_vChangeText(FON_tdxHandleOfString hText,char *szText)
{
strcpy(FON_fn_p_stGetTextPointerOfHandle(hText)/ *->szText* /,szText);
}*/
/*************************************************************************/
/*void FON_fn_vUpperText(FON_tdxHandleOfString hText)
{
strupr(FON_fn_p_stGetTextPointerOfHandle(hText)/ *->szText* /);
}*/
/*************************************************************************/
/*FON_tdxHandleOfString FON_fn_hGetInvalidTextHandle(void)
{
return(0xffffffff);
}*/
/*************************************************************************/
/*unsigned char FON_fn_bIsAValidText(FON_tdxHandleOfString hText)
{
if (hText==FON_fn_hGetInvalidTextHandle())
return(FALSE);
else
return(TRUE);
}*/
/**************************************************************************/
/*struct FON_tdstEffect_ *FON_fn_p_stGetEffectPointer(FON_tdxHandleOfString hText)
{
return(&FON_fn_p_stGetFontAndEffectPointerOfHandle(hText)->stEffect);
}*/
/**************************************************************************/

View File

@@ -0,0 +1,147 @@
#define D_MainChar_StructureDefine
/*----------------------------------------------------------------------
* Includes
*--------------------------------------------------------------------*/
#include "ToolsCPA.h"
#include "macros.h"
#include "GameEng.h"
#include "Actions/AllActs.h"
#include "Structur/GameScpt.h"
#include "Structur/ErrGame.h"
#include "Structur/MemGame.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "Structur/Objects.h"
#include "MainChar.h"
#include "Zemem.h"
/*----------------------------------------------------------------------
* Functions
*--------------------------------------------------------------------*/
MC_tdxHandleToMainCharacterNode MC_fn_hCreateMainCharacterNode()
{
tdstNodeMainCharacter * p_stMainCharNode;
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeMainChar , 0);
p_stMainCharNode=(tdstNodeMainCharacter *)M_p_GameMallocInHLM(sizeof(tdstNodeMainCharacter));
LST2_M_DynamicInitElement(p_stMainCharNode);
/* O.D.*/
MC_fn_vSetNewMainCharacter((MC_tdxHandleToMainCharacterNode)p_stMainCharNode, (HIE_tdxHandleToSuperObject)NULL);
return( (MC_tdxHandleToMainCharacterNode)p_stMainCharNode );
}
/*--------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void MC_fn_vFreeMainCharacterNode(MC_tdxHandleToMainCharacterNode hMainCharNode)
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeMainChar , 0);
M_GameFreeInHLM((tdstNodeMainCharacter *)hMainCharNode);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*--------------------------------------------------------------------*/
void MC_fn_vAddCharacterInMainCharacterList(HIE_tdxHandleToSuperObject hCharacter)
{
MC_tdxHandleToMainCharacterNode hMainCharNode;
hMainCharNode=MC_fn_hCreateMainCharacterNode();
MC_fn_vSetCharacterInMainCharacterNode(hMainCharNode,hCharacter);
LST2_M_DynamicAddTail(&g_stEngineStructure.hMainCharacterList,hMainCharNode);
SAI_fn_bInsertPointerInTable(&hMainCharNode->hCharacter,SAI_eInitWhenPlayerDead|SAI_eInitWhenReinitTheMap|SAI_eInitWhenMapLoaded);
/**** DFM : Tant que le block ACP merde, il ne faut pas vers de r<>f<EFBFBD>rence dans SAI ****/
/* SAI_fn_bInsertPointerInTable(&hMainCharNode->hCharacter,SAI_ePlayerSaveCurrentValue);*/
}
/*--------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_
void MC_fn_vRemoveCharacterinMainCharacterList(HIE_tdxHandleToSuperObject hCharacter)
{
unsigned short uwI;
MC_tdxHandleToMainCharacterNode hMainCharNode = NULL,hMainCharGoodNode = NULL;
LST2_M_DynamicForEachElementOf(&g_stEngineStructure.hMainCharacterList,hMainCharNode,uwI)
{
if( MC_fn_hGetCharacterInMainCharacterNode(hMainCharNode)==hCharacter )
hMainCharGoodNode=hMainCharNode;
}
SAI_fn_bRemoveValueFromTable(&hMainCharNode->hCharacter,SAI_eInitWhenPlayerDead|SAI_eInitWhenReinitTheMap|SAI_eInitWhenMapLoaded);
/* SAI_fn_bRemoveValueFromTable(&hMainCharNode->hCharacter,SAI_ePlayerSaveCurrentValue);*/
LST2_M_DynamicIsolate(hMainCharGoodNode);
MC_fn_vFreeMainCharacterNode( hMainCharGoodNode );
}
/*--------------------------------------------------------------------*/
unsigned char MC_fn_ucIsCharacterInMainCharacterList(HIE_tdxHandleToSuperObject hCharacter)
{
unsigned short uwI;
MC_tdxHandleToMainCharacterNode hMainCharNode;
LST2_M_DynamicForEachElementOf(&g_stEngineStructure.hMainCharacterList,hMainCharNode,uwI)
{
if( MC_fn_hGetCharacterInMainCharacterNode(hMainCharNode)==hCharacter )
return(TRUE);
}
return(FALSE);
}
#endif /* _FIRE_DEADCODE_U64_ */
/*--------------------------------------------------------------------*/
void MC_fn_vSetCharacterInMainCharacterNode(MC_tdxHandleToMainCharacterNode hMainCharNode,HIE_tdxHandleToSuperObject hCharacter)
{
((tdstNodeMainCharacter *)hMainCharNode)->hCharacter=hCharacter;
}
/*--------------------------------------------------------------------*/
HIE_tdxHandleToSuperObject MC_fn_hGetCharacterInMainCharacterNode(MC_tdxHandleToMainCharacterNode hMainCharNode)
{
return( ((tdstNodeMainCharacter *)hMainCharNode)->hCharacter );
}
/*--------------------------------------------------------------------*/
MC_tdxHandleToMainCharacterNode MC_fn_hGetFirstMainCharNode()
{
return( LST2_M_DynamicGetFirstElement(&g_stEngineStructure.hMainCharacterList) );
}
/*--------------------------------------------------------------------*/
MC_tdxHandleToMainCharacterNode MC_fn_hGetNextMainCharNode(MC_tdxHandleToMainCharacterNode hMainCharNode)
{
return( LST2_M_DynamicGetNextElement(hMainCharNode) );
}
/*--------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_
void MC_fn_vCopyStruct_MainCharNode(MC_tdxHandleToMainCharacterNode hDest,MC_tdxHandleToMainCharacterNode hSrc)
{
MC_fn_vSetCharacterInMainCharacterNode(hDest,MC_fn_hGetCharacterInMainCharacterNode(hSrc));
}
#endif /* _FIRE_DEADCODE_U64_ */
/*--------------------------------------------------------------------*/
/* O.D. 15/8/97*/
/*--------------------------------------------------------------------------
* Functions to modify the MainCharacter.
* The Engine can modify the MainCharacter only on the beginning of a frame.
*--------------------------------------------------------------------------*/
void MC_fn_vSetNewMainCharacter(MC_tdxHandleToMainCharacterNode hMainCharNode,HIE_tdxHandleToSuperObject hCharacter)
{
((tdstNodeMainCharacter *)hMainCharNode)->hNewCharacterForTheNextFrame = hCharacter;
}
HIE_tdxHandleToSuperObject MC_fn_hGetNewMainCharacter(MC_tdxHandleToMainCharacterNode hMainCharNode)
{
return (((tdstNodeMainCharacter *)hMainCharNode)->hNewCharacterForTheNextFrame);
}
#undef D_MainChar_StructureDefine

View File

@@ -0,0 +1,996 @@
# Microsoft Developer Studio Project File - Name="GamLib" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=GAMLIB - WIN32 DEBUG
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "GamLib.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "GamLib.mak" CFG="GAMLIB - WIN32 DEBUG"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "GamLib - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "GamLib - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE "GamLib - Win32 Debug with Editors" (based on\
"Win32 (x86) Static Library")
!MESSAGE "GamLib - Win32 Retail" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""$/cpa/tempgrp/GAM/MakeLib", TSCAAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
!IF "$(CFG)" == "GamLib - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "x:\cpa\lib"
# PROP Intermediate_Dir "Tmp\Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /G5 /W4 /GX /O2 /I "x:\Cpa\Public\Gam\Locale" /I "x:\Cpa\TempGrp\Gam\Locale" /I "x:\Cpa\TempGrp\Gam\P5" /I "x:\Cpa\TempGrp\Gam\TTrouble\P5" /I "x:\Cpa\Public" /I "t:\dxsdk\sdk\inc" /I "x:\Cpa\Public\GAM" /I "x:\Cpa\Main" /I "x:\Cpa\TempGrp\Gam\TTrouble" /I "x:\Cpa\TempGrp\Gam" /I "t:\3dfx\glide\src\sst1\include" /I "x:\cpa\public\gli" /D "NDEBUG" /D "USE_PROFILER" /D "USE_IPT_DX5" /D "VISUAL" /D "WIN32" /FD /c
# SUBTRACT CPP /WX /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"x:\cpa\lib\GamP5_vr.lib"
!ELSEIF "$(CFG)" == "GamLib - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "x:\cpa\lib"
# PROP Intermediate_Dir "Tmp\debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /G5 /MD /W4 /GX /Z7 /Od /I "x:\Cpa\Public\Gam\Locale" /I "x:\Cpa\TempGrp\Gam\Locale" /I "x:\Cpa\TempGrp\Gam\P5" /I "x:\Cpa\TempGrp\Gam\TTrouble\P5" /I "x:\Cpa\Public" /I "t:\dxsdk\sdk\inc" /I "x:\Cpa\Public\GAM" /I "x:\Cpa\Main" /I "x:\Cpa\TempGrp\Gam\TTrouble" /I "x:\Cpa\TempGrp\Gam" /I "t:\3dfx\glide\src\sst1\include" /I "x:\cpa\public\gli" /D "_DEBUG" /D "USE_PROFILER" /D "MTH_CHECK" /D "VISUAL" /D "WIN32" /YX /FD /c
# SUBTRACT CPP /WX /Fr
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"x:\Cpa\Lib\GamP5_vd.lib"
!ELSEIF "$(CFG)" == "GamLib - Win32 Debug with Editors"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "GamLib__"
# PROP BASE Intermediate_Dir "GamLib__"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "x:\cpa\lib"
# PROP Intermediate_Dir "Tmp\debuged"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W4 /WX /Gm /GX /Zi /Od /I "x:\Cpa\Public" /I "t:\dxsdk\sdk\inc" /I "x:\Cpa\Public\GAM" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D "GAME_APP" /D "CPA_DEBUG" /D "CPA_VISUAL" /D "RASTERS" /YX /FD /c
# SUBTRACT BASE CPP /Fr
# ADD CPP /nologo /G5 /MD /W4 /GX /Z7 /Od /I "x:\cpa\public\gli" /I "x:\Cpa\Public\Gam\Locale" /I "x:\Cpa\TempGrp\Gam\Locale" /I "x:\Cpa\TempGrp\Gam\P5" /I "x:\Cpa\TempGrp\Gam\TTrouble\P5" /I "x:\Cpa\Public" /I "t:\dxsdk\sdk\inc" /I "x:\Cpa\Public\GAM" /I "x:\Cpa\Main" /I "x:\Cpa\TempGrp\Gam\TTrouble" /I "x:\Cpa\TempGrp\Gam" /I "t:\3dfx\glide\src\sst1\include" /D "_DEBUG" /D "USE_PROFILER" /D "MTH_CHECK" /D "ACTIVE_EDITOR" /D "CPA_WANTS_EXPORT" /D "VISUAL" /D "WIN32" /FD /c
# SUBTRACT CPP /WX /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo /out:"x:\Cpa\Lib\GamP5_vd.lib"
# ADD LIB32 /nologo /out:"x:\Cpa\Lib\GamP5Evd.lib"
!ELSEIF "$(CFG)" == "GamLib - Win32 Retail"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "GamLib__"
# PROP BASE Intermediate_Dir "GamLib__"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "x:/cpa/lib"
# PROP Intermediate_Dir "tmp/retail"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G5 /MD /W4 /GX /Z7 /O2 /I "x:\Cpa\Public\Gam\Locale" /I "x:\Cpa\TempGrp\Gam\Locale" /I "x:\Cpa\TempGrp\Gam\P5" /I "x:\Cpa\TempGrp\Gam\TTrouble\P5" /I "x:\Cpa\Public" /I "t:\dxsdk\sdk\inc" /I "x:\Cpa\Public\GAM" /I "x:\Cpa\Main" /I "x:\Cpa\TempGrp\Gam\TTrouble" /I "x:\Cpa\TempGrp\Gam" /I "t:\3dfx\glide\src\sst1\include" /D "NDEBUG" /D "COL_IS_MULTITHREAD" /D "VISUAL" /D "WIN32" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D "GAME_APP" /D "RASTERS" /D "GAM_V6_ANIM" /FD /c
# SUBTRACT BASE CPP /WX /Fr /YX
# ADD CPP /nologo /G5 /W4 /GX /O2 /I "x:\Cpa\Public\Gam\Locale" /I "x:\Cpa\TempGrp\Gam\Locale" /I "x:\Cpa\TempGrp\Gam\P5" /I "x:\Cpa\TempGrp\Gam\TTrouble\P5" /I "x:\Cpa\Public" /I "t:\dxsdk\sdk\inc" /I "x:\Cpa\Public\GAM" /I "x:\Cpa\Main" /I "x:\Cpa\TempGrp\Gam\TTrouble" /I "x:\Cpa\TempGrp\Gam" /I "t:\3dfx\glide\src\sst1\include" /I "x:\cpa\public\gli" /D "NDEBUG" /D "RETAIL" /D "USE_IPT_DX5" /D "VISUAL" /D "WIN32" /FD /c
# SUBTRACT CPP /WX /Fr /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo /out:"x:\cpa\lib\GamP5_vr.lib"
# ADD LIB32 /nologo /out:"x:\cpa\lib\GamP5_vf.lib"
!ENDIF
# Begin Target
# Name "GamLib - Win32 Release"
# Name "GamLib - Win32 Debug"
# Name "GamLib - Win32 Debug with Editors"
# Name "GamLib - Win32 Retail"
# Begin Group "Sources"
# PROP Default_Filter ".c"
# Begin Source File
SOURCE=..\Actions\3dData.c
# End Source File
# Begin Source File
SOURCE=..\Actions\_Sample.cex
# End Source File
# Begin Source File
SOURCE=..\PlayAnim\Interpol\a3x_cach.c
# End Source File
# Begin Source File
SOURCE=..\PlayAnim\Interpol\a3x_int.c
# End Source File
# Begin Source File
SOURCE=..\PlayAnim\Interpol\a3x_intn.c
# End Source File
# Begin Source File
SOURCE=..\PlayAnim\Interpol\a3x_load.c
# End Source File
# Begin Source File
SOURCE=..\PlayAnim\Interpol\a3x_mem.c
# End Source File
# Begin Source File
SOURCE=..\Actions\AllActs.c
# End Source File
# Begin Source File
SOURCE=..\AlwAct.c
# End Source File
# Begin Source File
SOURCE=..\Always.c
# End Source File
# Begin Source File
SOURCE=..\PlayAnim\Anim.c
# End Source File
# Begin Source File
SOURCE=..\Actions\Animfx.c
# End Source File
# Begin Source File
SOURCE=..\Basic.c
# End Source File
# Begin Source File
SOURCE=..\specif\BASIC.Cxx
!IF "$(CFG)" == "GamLib - Win32 Release"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "GamLib - Win32 Debug"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "GamLib - Win32 Debug with Editors"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "GamLib - Win32 Retail"
# PROP BASE Exclude_From_Build 1
# PROP Exclude_From_Build 1
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\Actions\Brain.c
# End Source File
# Begin Source File
SOURCE=..\Caps.c
# End Source File
# Begin Source File
SOURCE=..\ChanLis1.cxx
!IF "$(CFG)" == "GamLib - Win32 Release"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "GamLib - Win32 Debug"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "GamLib - Win32 Debug with Editors"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "GamLib - Win32 Retail"
# PROP BASE Exclude_From_Build 1
# PROP Exclude_From_Build 1
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\ChanList.c
# End Source File
# Begin Source File
SOURCE=..\P5\CHLLoad.c
# End Source File
# Begin Source File
SOURCE=..\Actions\cineinfo.c
# End Source File
# Begin Source File
SOURCE=..\Clock.c
# End Source File
# Begin Source File
SOURCE=..\Collisio.c
# End Source File
# Begin Source File
SOURCE=..\Actions\CollSet.c
# End Source File
# Begin Source File
SOURCE=..\specif\Demos.c
# End Source File
# Begin Source File
SOURCE=..\TTrouble\P5\DspFix.c
# End Source File
# Begin Source File
SOURCE=..\Actions\Dynam.c
# End Source File
# Begin Source File
SOURCE=..\effect.c
# End Source File
# Begin Source File
SOURCE=..\Engine.c
# End Source File
# Begin Source File
SOURCE=..\Family.c
# End Source File
# Begin Source File
SOURCE=..\Locale\FON_Eff.c
# End Source File
# Begin Source File
SOURCE=..\Locale\fonfont.c
# End Source File
# Begin Source File
SOURCE=..\Locale\fonload.c
# End Source File
# Begin Source File
SOURCE=..\Locale\fonmem.c
# End Source File
# Begin Source File
SOURCE=..\Locale\fontext.c
# End Source File
# Begin Source File
SOURCE=..\GameEng.c
# End Source File
# Begin Source File
SOURCE=..\GameMain.c
# End Source File
# Begin Source File
SOURCE=..\TTrouble\P5\GamOpt.c
# End Source File
# Begin Source File
SOURCE=..\TTrouble\P5\GamSave.c
# End Source File
# Begin Source File
SOURCE=..\HitPts.c
# End Source File
# Begin Source File
SOURCE=..\ia_dnm.c
# End Source File
# Begin Source File
SOURCE=..\ia_dnm1.cxx
!IF "$(CFG)" == "GamLib - Win32 Release"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "GamLib - Win32 Debug"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "GamLib - Win32 Debug with Editors"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "GamLib - Win32 Retail"
# PROP BASE Exclude_From_Build 1
# PROP Exclude_From_Build 1
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\Initeng.c
# End Source File
# Begin Source File
SOURCE=..\specif\Initeng.cxx
!IF "$(CFG)" == "GamLib - Win32 Release"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "GamLib - Win32 Debug"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "GamLib - Win32 Debug with Editors"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "GamLib - Win32 Retail"
# PROP BASE Exclude_From_Build 1
# PROP Exclude_From_Build 1
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\Input.c
# End Source File
# Begin Source File
SOURCE=..\LipsSync.c
# End Source File
# Begin Source File
SOURCE=..\P5\LoadAni.c
# End Source File
# Begin Source File
SOURCE=..\P5\LoadFml.c
# End Source File
# Begin Source File
SOURCE=..\P5\LoadGame.c
# End Source File
# Begin Source File
SOURCE=..\P5\LoadLSyn.c
# End Source File
# Begin Source File
SOURCE=..\P5\LoadLvl.c
# End Source File
# Begin Source File
SOURCE=..\LSmem.c
# End Source File
# Begin Source File
SOURCE=..\MainChar.c
# End Source File
# Begin Source File
SOURCE=..\Micros.c
# End Source File
# Begin Source File
SOURCE=..\Actions\MS_Micro.c
# End Source File
# Begin Source File
SOURCE=..\Actions\MSlight.c
# End Source File
# Begin Source File
SOURCE=..\Actions\MSMag.c
# End Source File
# Begin Source File
SOURCE=..\Actions\MSPrtSrc.c
# End Source File
# Begin Source File
SOURCE=..\Actions\MSSound.c
# End Source File
# Begin Source File
SOURCE=..\Actions\MSWay.c
# End Source File
# Begin Source File
SOURCE=..\Objinit.c
# End Source File
# Begin Source File
SOURCE=..\ObjsTbls.c
# End Source File
# Begin Source File
SOURCE=..\ObjType.c
# End Source File
# Begin Source File
SOURCE=..\PlayAnim\PlayAnim.c
# End Source File
# Begin Source File
SOURCE=..\PlayAnim\PlayEvts.c
# End Source File
# Begin Source File
SOURCE=..\specif\rastdisp.c
# End Source File
# Begin Source File
SOURCE=..\Actions\SectInfo.c
# End Source File
# Begin Source File
SOURCE=..\P5\SnapShot.c
# End Source File
# Begin Source File
SOURCE=..\State.c
# End Source File
# Begin Source File
SOURCE=..\Actions\StdGame.c
# End Source File
# Begin Source File
SOURCE=..\specif\SubMapPs.c
# End Source File
# Begin Source File
SOURCE=..\P5\TBLLoad.c
# End Source File
# Begin Source File
SOURCE=..\TextFrmt.c
# End Source File
# Begin Source File
SOURCE=..\ToolCam.c
# End Source File
# Begin Source File
SOURCE=..\ToolMatr.c
# End Source File
# Begin Source File
SOURCE=..\ZdxStuff.c
# End Source File
# Begin Source File
SOURCE=..\ZeMem.c
# End Source File
# End Group
# Begin Group "Includes"
# PROP Default_Filter ".h"
# Begin Source File
SOURCE=..\..\..\Public\GAM\Actions\3dData.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\STRUCTUR\3DOSLkTb.h
# End Source File
# Begin Source File
SOURCE=..\..\..\public\GAM\Actions\_Sample.h
# PROP Exclude_From_Build 1
# End Source File
# Begin Source File
SOURCE=..\..\..\public\GAM\PlayAnim\Interpol\a3x_cach.h
# End Source File
# Begin Source File
SOURCE=..\..\..\public\GAM\PlayAnim\Interpol\a3x_glob.h
# End Source File
# Begin Source File
SOURCE=..\..\..\public\GAM\PlayAnim\Interpol\a3x_int.h
# End Source File
# Begin Source File
SOURCE=..\..\..\public\GAM\PlayAnim\Interpol\a3x_intn.h
# End Source File
# Begin Source File
SOURCE=..\..\..\public\GAM\PlayAnim\Interpol\a3x_load.h
# End Source File
# Begin Source File
SOURCE=..\..\..\public\GAM\PlayAnim\Interpol\a3x_mem.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Options\ActBlMal.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Options\ActObjNm.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Actions\AllActs.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Always.h
# End Source File
# Begin Source File
SOURCE=..\..\..\public\GAM\PlayAnim\Anim.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\STRUCTUR\Anim_s.h
# End Source File
# Begin Source File
SOURCE=..\..\..\public\GAM\Actions\Animfx.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Basic.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Actions\Brain.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\ChanList.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\CHLLoad.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Actions\cineinfo.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Clock.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Collisio.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Actions\CollSet.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\ColMotor.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Options\Def_Snd.h
# End Source File
# Begin Source File
SOURCE=..\..\..\public\GAM\Specif\Demos.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Actions\Dynam.h
# End Source File
# Begin Source File
SOURCE=..\..\..\public\GAM\effect.h
# End Source File
# Begin Source File
SOURCE=..\..\..\public\GAM\STRUCTUR\specif\Elem_3d.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\engine.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\STRUCTUR\Engmode.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Options\EnumCsts.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\STRUCTUR\ErrGame.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Family.h
# End Source File
# Begin Source File
SOURCE=..\..\..\public\GAM\Options\specif\Flags.h
# End Source File
# Begin Source File
SOURCE=..\..\..\public\GAM\Locale\FON_Eff.h
# End Source File
# Begin Source File
SOURCE=..\Locale\fonerm.h
# End Source File
# Begin Source File
SOURCE=..\Locale\fonfont.h
# End Source File
# Begin Source File
SOURCE=..\..\..\public\GAM\Locale\fonLoad.h
# End Source File
# Begin Source File
SOURCE=..\Locale\fonmem.h
# End Source File
# Begin Source File
SOURCE=..\..\..\public\GAM\Locale\FonPub.h
# End Source File
# Begin Source File
SOURCE=..\..\..\public\GAM\Locale\fontext.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Futil.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\GameEng.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\STRUCTUR\GameScpt.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\GAMHandl.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\GAMLst.h
# End Source File
# Begin Source File
SOURCE=..\..\..\public\GAM\GamOpt.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\GamSave.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\GAMVers.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Header.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\HitPts.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\ia_dnm.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\incgam.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Initeng.h
# End Source File
# Begin Source File
SOURCE=..\..\..\public\GAM\InitEnum.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Options\InLine.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Input.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\STRUCTUR\Input_s.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Options\LightOpt.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\LipsSync.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\LoadAni.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\LoadFml.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\LoadGame.h
# End Source File
# Begin Source File
SOURCE=..\..\..\public\GAM\LoadLSyn.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\LoadLvl.h
# End Source File
# Begin Source File
SOURCE=..\..\..\public\GAM\LSerm.h
# End Source File
# Begin Source File
SOURCE=..\..\..\public\GAM\LSmem.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Macros.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\MainChar.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\STRUCTUR\MemGame.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Micros.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Actions\MS_Micro.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Actions\MSlight.h
# End Source File
# Begin Source File
SOURCE=..\..\..\public\GAM\Actions\MSMag.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Actions\MSPrtSrc.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Actions\MSSound.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Actions\MSWay.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\STRUCTUR\Objects.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Objinit.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\STRUCTUR\ObjsTbls.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\ObjType.h
# End Source File
# Begin Source File
SOURCE=..\..\..\public\GAM\Options\Opt_Info.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\PhysiCol.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\PlayAnim\PLA_dbg.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\PlayAnim\PlayAnim.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\PlayAnim\PlayEvts.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Actions\SectInfo.h
# End Source File
# Begin Source File
SOURCE=..\P5\SnapShot.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Options\SptIALod.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\STRUCTUR\State.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\stdafx.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\Actions\StdGame.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\STRUCTUR\StdObjSt.h
# End Source File
# Begin Source File
SOURCE=..\..\..\public\gam\options\specif\SubMapPs.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\TBLLoad.h
# End Source File
# Begin Source File
SOURCE=..\..\..\public\GAM\TextFrmt.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\ToolCam.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\ToolMatr.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\ToolsCPA.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\TYPECAM.H
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\ZdxStuff.h
# End Source File
# Begin Source File
SOURCE=..\..\..\Public\GAM\ZeMem.h
# End Source File
# End Group
# Begin Group "Datas"
# PROP Default_Filter "*.ipt *.dsc"
# Begin Source File
SOURCE=..\..\..\Exe\Main\GameData\Camera.ipt
# End Source File
# Begin Source File
SOURCE=..\..\..\Exe\Main\GameData\Cheat.ipt
# End Source File
# Begin Source File
SOURCE=..\..\..\Exe\Main\GameData\Commands.ipt
# End Source File
# Begin Source File
SOURCE=..\..\..\Exe\Main\GameData\Debug.ipt
# End Source File
# Begin Source File
SOURCE=..\..\..\Exe\Main\GameData\Device.ipt
# End Source File
# Begin Source File
SOURCE=..\..\..\Exe\Main\GameData\EdAction.ipt
# End Source File
# Begin Source File
SOURCE=..\..\..\Exe\Main\GameData\EdButton.ipt
# End Source File
# Begin Source File
SOURCE=..\..\..\Exe\Main\GameData\Game.dsc
# End Source File
# Begin Source File
SOURCE=..\..\..\Exe\Main\GameData\Game.ipt
# End Source File
# Begin Source File
SOURCE=..\..\..\Exe\Main\GameData\Menu.ipt
# End Source File
# Begin Source File
SOURCE=..\..\..\Exe\Main\GameData\World\World.dsc
# End Source File
# End Group
# Begin Source File
SOURCE=.\GamLib.mak
# End Source File
# End Target
# End Project

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,34 @@
'------------------------------------------------------------------------------
'FILE DESCRIPTION: New Macro File
'------------------------------------------------------------------------------
Sub CompilDebugWithoutSound()
'DESCRIPTION: Compile GAM and MAIN modules
Dim ConfigGamLib
Dim ConfigMain
set ConfigGamLib = Projects(1).Configurations(4)
set ConfigMain = Projects(2).Configurations(7)
Build ConfigGamLib
Build ConfigMain
Documents.SaveAll True
End Sub
Sub CompilDebugWithSound()
'DESCRIPTION: Compile GAM and MAIN modules
Dim ConfigGamLib
Dim ConfigMain
set ConfigGamLib = Projects(1).Configurations(4)
set ConfigMain = Projects(2).Configurations(8)
Build ConfigGamLib
Build ConfigMain
Documents.SaveAll True
End Sub

View File

@@ -0,0 +1,5 @@
SCC = This is a source code control file
[GamLib.vcproj]
SCC_Aux_Path = "P4SCC#srvperforce-ma:1666##raymandata##Editor"
SCC_Project_Name = Perforce Project

View File

@@ -0,0 +1,646 @@
#define D_Micros_StructureDefine
#define D_Micros_VariableDefine
#define D_Brain_StructureDefine
#include "ToolsCPA.h"
#include "SND.h"
#include "Options/Options.h"
#include "macros.h"
#include "GameEng.h"
#include "Structur/State.h"
#include "Actions/AllActs.h"
#include "Structur/Anim_s.h"
#include "Structur/GameScpt.h"
#include "Structur/ErrGame.h"
#include "Structur/MemGame.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "Structur/Objects.h"
#include "Basic.h"
#include "Zemem.h"
#include "Micros.h"
#include "always.h"
#include "mainchar.h"
/* Well, ambiant music is audible up to ten meters underwater*/
#define C_xMaxDepthForMusic MTH_M_xDoubleToReal(10.0)
#if defined (ACTIVE_EDITOR) || defined (RETAIL)
#define ENGassert(param)
#else
#define ENGassert(param) assert(param)
#endif
/*
* Temporary define; waiting for SIF module update
*/
typedef enum _SIF_eInfoTypeId
{
ENVIRONMENT_INFO,
MATERIAL_INFO,
NB_INFO_TYPES,
} SIF_eInfoTypeId;
/*-----------------------------------------------------------------------------
* Description : Return to SoundLibrary Postion and speed for an object
*-----------------------------------------------------------------------------
* Input : void
* Output : void
*-----------------------------------------------------------------------------
* Creation date : 13/02/97 Author : SOUND
*---------------------------------------------------------------------------*/
long RetObjetSonoreXAnim(long indice)
{
MTH3D_tdstVector stVertex;
POS_fn_vGetTranslationVector(HIE_fn_hGetSuperObjectGlobalMatrix((HIE_tdxHandleToSuperObject)indice),&stVertex);
return (long)M_Fixed1616ToRealSnd(MTH_M_xRealToFixed16_16(stVertex.xX));
}
long RetObjetSonoreYAnim(long indice)
{
MTH3D_tdstVector stVertex;
POS_fn_vGetTranslationVector(HIE_fn_hGetSuperObjectGlobalMatrix((HIE_tdxHandleToSuperObject)indice),&stVertex);
return (long)M_Fixed1616ToRealSnd(MTH_M_xRealToFixed16_16(stVertex.xY));
}
long RetObjetSonoreZAnim(long indice)
{
MTH3D_tdstVector stVertex;
POS_fn_vGetTranslationVector(HIE_fn_hGetSuperObjectGlobalMatrix((HIE_tdxHandleToSuperObject)indice),&stVertex);
return (long)M_Fixed1616ToRealSnd(MTH_M_xRealToFixed16_16(stVertex.xZ));
}
long RetObjetSonoreVXAnim(long indice)
{
DNM_tdstDynamics *p_stDynamics;
/* DNM_tdstReport *p_stReport;*/
MTH3D_tdstVector stVertex;
if( !M_GetMSHandle((HIE_tdxHandleToSuperObject)indice,Dynam) )
return 0;
if((p_stDynamics = fn_p_stDynamGetDynamics(M_GetMSHandle((HIE_tdxHandleToSuperObject)indice,Dynam))) == NULL)
return 0;
/* p_stReport = DNM_M_p_stDynamicsGetReport(p_stDynamics);*/
/* MTH3D_M_vCopyVector(&stVertex,MTH_M_p_stMoveGetLinear(DNM_M_p_stReportGetAbsoluteCurrSpeed(p_stReport)));*/
MTH3D_M_vCopyVector(&stVertex, DNM_M_pDynamicsGetPreviousSpeed(p_stDynamics));
return (long)M_Fixed1616ToRealSnd(MTH_M_xRealToFixed16_16(stVertex.xX));
}
long RetObjetSonoreVYAnim(long indice)
{
DNM_tdstDynamics *p_stDynamics;
/* DNM_tdstReport *p_stReport;*/
MTH3D_tdstVector stVertex;
if( !M_GetMSHandle((HIE_tdxHandleToSuperObject)indice,Dynam) )
return 0;
if((p_stDynamics = fn_p_stDynamGetDynamics(M_GetMSHandle((HIE_tdxHandleToSuperObject)indice,Dynam))) == NULL)
return 0;
/* p_stReport = DNM_M_p_stDynamicsGetReport(p_stDynamics);*/
/* MTH3D_M_vCopyVector(&stVertex,MTH_M_p_stMoveGetLinear(DNM_M_p_stReportGetAbsoluteCurrSpeed(p_stReport)));*/
MTH3D_M_vCopyVector(&stVertex, DNM_M_pDynamicsGetPreviousSpeed(p_stDynamics));
return (long)M_Fixed1616ToRealSnd(MTH_M_xRealToFixed16_16(stVertex.xY));
}
long RetObjetSonoreVZAnim(long indice)
{
DNM_tdstDynamics *p_stDynamics;
/* DNM_tdstReport *p_stReport;*/
MTH3D_tdstVector stVertex;
if( !M_GetMSHandle((HIE_tdxHandleToSuperObject)indice,Dynam) )
return 0;
if((p_stDynamics = fn_p_stDynamGetDynamics(M_GetMSHandle((HIE_tdxHandleToSuperObject)indice,Dynam))) == NULL)
return 0;
/* p_stReport = DNM_M_p_stDynamicsGetReport(p_stDynamics);*/
/* MTH3D_M_vCopyVector(&stVertex,MTH_M_p_stMoveGetLinear(DNM_M_p_stReportGetAbsoluteCurrSpeed(p_stReport)));*/
MTH3D_M_vCopyVector(&stVertex, DNM_M_pDynamicsGetPreviousSpeed(p_stDynamics));
return (long)M_Fixed1616ToRealSnd(MTH_M_xRealToFixed16_16(stVertex.xZ));
}
unsigned char RetObjetSonoreREVERBAnim(long indice)
{
return 0;
}
void RetObjetSonoreExtraCoefAnim(long indice,SND_tduRefEvt evt,SndReal* pitch,SndReal* pan,SndReal* vol)
{/**/
DNM_tdstDynamics *p_stDynamics;
/* DNM_tdstReport *p_stReport;*/
MTH3D_tdstVector stVertex;
SndReal rTmpPitch, rTmpVol, rTmpPan;
/* Extra-Pitch Sound according to speed*/
rTmpPitch = C_SNDREAL_0;
for (; pitch && rTmpPitch == C_SNDREAL_0;)
{
if( !M_GetMSHandle((HIE_tdxHandleToSuperObject)indice,Dynam) )
{
*pitch = C_SNDREAL_0;
break;
}
if((p_stDynamics = fn_p_stDynamGetDynamics(M_GetMSHandle((HIE_tdxHandleToSuperObject)indice,Dynam))) == NULL)
{
*pitch = C_SNDREAL_0;
break;
}
/* p_stReport = DNM_M_p_stDynamicsGetReport(p_stDynamics);*/
/* MTH3D_M_vCopyVector(&stVertex,MTH_M_p_stMoveGetLinear(DNM_M_p_stReportGetAbsoluteCurrSpeed(p_stReport)));*/
MTH3D_M_vCopyVector(&stVertex,DNM_M_pDynamicsGetPreviousSpeed(p_stDynamics));
rTmpPitch = M_Fixed1616ToRealSnd(MTH_M_xRealToFixed16_16(MTH3D_M_xNormVector(&stVertex)));
/* normalize speed to adapt sound frequencies to be hearable ....*/
if (rTmpPitch > M_DoubleToRealSnd(200.0))
rTmpPitch = M_DoubleToRealSnd(200.0);
else
if (rTmpPitch < M_DoubleToRealSnd(0.1))
rTmpPitch = M_DoubleToRealSnd(0.1);
*pitch = rTmpPitch >> 7;
}
/* Extra-Vol Sound according to anything*/
rTmpVol = C_SNDREAL_0;
for (; vol && rTmpVol == C_SNDREAL_0;)
{
/* set volume mult here*/
rTmpVol = C_SNDREAL_1;
/* normalize speed to adapt sound frequencies to be hearable ....*/
if (rTmpVol > M_DoubleToRealSnd(127.0))
rTmpVol = M_DoubleToRealSnd(127.0);
else
if (rTmpVol < C_SNDREAL_0)
break;
*vol = rTmpVol;
}
/* Extra-Pan Sound according to anything*/
rTmpPan = C_SNDREAL_0;
for (; pan && rTmpPan == C_SNDREAL_0;)
{
/* set pan mult here*/
rTmpPan = C_SNDREAL_1;
/* normalize speed to adapt sound frequencies to be hearable ....*/
if (rTmpPan > M_DoubleToRealSnd(127.0))
rTmpPan = M_DoubleToRealSnd(127.0);
else
if (rTmpPan < C_SNDREAL_0)
break;
*pan = rTmpPan;
}
}
long RetObjetSonoreSwitchAnim(long indice,long toto)
{
SIF_eInfoTypeId eTypeId = (SIF_eInfoTypeId)toto;
HIE_tdxHandleToSuperObject hCharacter;
hCharacter = (HIE_tdxHandleToSuperObject)indice;
switch( eTypeId )
{
/* Shaitan Clean Env {*/
/*
case ENVIRONMENT_INFO:
{
MTH3D_tdstVector stPosition;
ENV_tdxHandleToEnvironment hEnvironment;
POS_fn_vGetTranslationVector(
HIE_fn_hGetSuperObjectGlobalMatrix(hCharacter),
&stPosition);
hEnvironment = SCT_fn_hGetEnvironmentFromPosition(&stPosition,
fn_h_SectInfoGetCurrentSector(
M_GetMSHandle(hCharacter,SectInfo)) );
if( hEnvironment )
{
return (long)ENV_fn_hGetSoundEnvironment(hEnvironment);
}
else
return 0;
}
break;
*/
/* End Shaitan Clan Env }*/
case MATERIAL_INFO:
{
DNM_tdstReport * p_stReport;
struct DNM_stDynamics * p_stDynamics;
unsigned long ulSurfState;
DNM_tdstObstacle * p_stObstacle;
GMT_tdxHandleToGameMaterial hGMT;
if( M_GetMSHandle(hCharacter,Dynam) )
{
p_stDynamics = fn_p_stDynamGetDynamics(
M_GetMSHandle(hCharacter,Dynam));
if( !p_stDynamics )
return 0;
p_stReport = DNM_M_p_stDynamicsGetReport(p_stDynamics);
ulSurfState =
DNM_M_ulReportGetSurfaceState(p_stReport);
/* GI check ceiling*/
if( DNM_M_bDynamicsIsGi(p_stDynamics) && (ulSurfState&C_WOT_ulCeiling)) {
p_stObstacle = DNM_M_p_stReportGetCeil(p_stReport);
hGMT = DNM_M_hObstacleGetCollidedMaterial(p_stObstacle);
if( hGMT )
return (long)GMT_fn_hGetSoundMaterial(hGMT);
else
return 0;
}
/* Climbing Check wall*/
else if( DNM_M_bDynamicsIsClimb(p_stDynamics) && (ulSurfState&C_WOT_ulWall)) {
p_stObstacle = DNM_M_p_stReportGetWall(p_stReport);
hGMT = DNM_M_hObstacleGetCollidedMaterial(p_stObstacle);
if( hGMT )
return (long)GMT_fn_hGetSoundMaterial(hGMT);
else
return 0;
}
/* other case check ground*/
else if(ulSurfState&C_WOT_ulGround) {
p_stObstacle = DNM_M_p_stReportGetGround(p_stReport);
hGMT = DNM_M_hObstacleGetCollidedMaterial(p_stObstacle);
if( hGMT )
return (long)GMT_fn_hGetSoundMaterial(hGMT);
else
return 0;
}
else
return 0;
}
else
{
return 0;
}
}
break;
case NB_INFO_TYPES:
return 0;
break;
default:
return 0;
break;
}
}
/*
SndBool RetObjetSonoreLinkAnim(long indice,long micro)
{
return TRUE;
}
*/
/* Modif 23/07/98 MAin Character always audible - Carlos Torres*/
SndBool RetObjetSonoreLinkAnim(long objet,long micro)
{
HIE_tdxHandleToSuperObject hObjectSector,hMicroSector,hSuperObj;
unsigned long ulI;
SECT_tdxHandleOfElementLstSoundInteraction hSoundList;
hObjectSector=fn_h_SectInfoGetCurrentSector( M_GetMSHandle(((HIE_tdxHandleToSuperObject)objet),SectInfo) );
hSuperObj = M_GetSuperObject( fn_hReturnHandleMicroFromIndex(micro) );
/* main charcater always audible*/
if (((HIE_tdxHandleToSuperObject)objet) == MC_fn_hGetCharacterInMainCharacterNode(MC_fn_hGetFirstMainCharNode()))
return TRUE;
hMicroSector=fn_h_SectInfoGetCurrentSector( M_GetMSHandle(hSuperObj,SectInfo) );
if( hObjectSector==hMicroSector )
return TRUE;
SECT_M_ForEachSoundNodeInSoundInteractionList(hMicroSector,hSoundList,ulI)
{
/* If the sector is in the audibility list, it is audible if volume!=VolMin.*/
if( SECT_GetSectorInSoundList(hSoundList)==hObjectSector )
return (SCT_fn_lGetVolumeInSoundList(hSoundList)!=C_MSMicro_MinVolume);
}
return TRUE; /* if sector is not in list, it is supposed to be audible*/
}
#ifndef _FIRE_DEADCODE_U64_
void RetObjetInfoAnim(long obj,char* str,long size_str)
{
HIE_tduLinkedObject hObj;
MS_tdxHandleTo3dData h_3dData;
tdxHandleToState h_State;
#ifdef _DEBUG_STRING_FOR_PLA_
tdstAnim3d * p_stAnim;
#endif
/* treatment for ghost object - ambiance*/
if (obj == SND_C_OBJET_FANTOME) {
strncpy(str,"Ghost Object",size_str);
return;
}
hObj=((HIE_tdxHandleToSuperObject)obj)->hLinkedObject;
/* get the anim*/
h_3dData = M_GetMSHandle( (HIE_tdxHandleToSuperObject)obj, 3dData );
h_State = fn_h3dDataGetCurrentState(h_3dData);
strncpy(str,"Perso:",size_str);
if (((HIE_tdxHandleToSuperObject)obj)->ulTypeOfLinkedObject==HIE_C_ulActor)
{
if (!fn_ucIsAnAlwaysObject(hObj.p_stCharacter))
{
if (hObj.p_stCharacter->h_Brain)
strncat(str,AI_M_szGetPersoName(hObj.p_stCharacter->h_Brain->p_stMind),size_str-strlen(str));
else
strncat(str,"no intelligence",size_str-strlen(str));
}
else
{
strncat(str,"Always",size_str-strlen(str));
}
}
#ifdef _DEBUG_STRING_FOR_PLA_
strncat(str,"=",size_str-strlen(str));
if ( h_State != NULL )
{
p_stAnim = fn_p_stGetAnimInState(h_State);
if (p_stAnim)
strncat(str,p_stAnim->szAnimName,size_str-strlen(str));
}
#endif
}
#endif /* _FIRE_DEADCODE_U64_ */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC 04/06/99 */
void RetObjetInfoLipsSync(long obj,char* str,long size_str)
{
HIE_tduLinkedObject hObj;
/* treatment for ghost object*/
if (obj == SND_C_OBJET_FANTOME) {
strncpy(str,"Ghost Object",size_str);
return;
}
hObj=((HIE_tdxHandleToSuperObject)obj)->hLinkedObject;
strncpy(str,"Lips:",size_str);
if (((HIE_tdxHandleToSuperObject)obj)->ulTypeOfLinkedObject==HIE_C_ulActor)
{
if (!fn_ucIsAnAlwaysObject(hObj.p_stCharacter))
{
strncat(str,AI_M_szGetPersoName(hObj.p_stCharacter->h_Brain->p_stMind),size_str-strlen(str));
}
else
{
strncat(str,"Always",size_str-strlen(str));
}
}
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC 04/06/99 */
/*-----------------------------------------------------------------------------
* Description : Return to SoundLibrary Postion and speed for an object
*-----------------------------------------------------------------------------
* Input : void
* Output : void
*-----------------------------------------------------------------------------
* Creation date : 13/02/97 Author : SOUND
*---------------------------------------------------------------------------*/
long RetObjetSonoreXMusic(long indice)
{
return 0;
}
long RetObjetSonoreYMusic(long indice)
{
return 0;
}
long RetObjetSonoreZMusic(long indice)
{
return 0;
}
long RetObjetSonoreVXMusic(long indice)
{
return 0;
}
long RetObjetSonoreVYMusic(long indice)
{
return 0;
}
long RetObjetSonoreVZMusic(long indice)
{
return 0;
}
unsigned char RetObjetSonoreREVERBMusic(long indice)
{
return 0;
}
void RetObjetSonoreExtraCoefMusic(long indice,SND_tduRefEvt evt,SndReal* pitch,SndReal* pan,SndReal* vol)
{
struct tdstEngineObject_ * p_stEngineMicro;
MTH3D_tdstVector stMicroPosition;
/* DNM_tdeFluidEnvironment eCurrentFluidEnvironment;*/
MTH_tdxReal xDepth = 0;
/* C_xMaxDepthForMusic */
if( vol==NULL )
return;
p_stEngineMicro = fn_p_stGetFirstEngineObjectInMicroList();
/* JO 22/10/97 for music during loading*/
if( !p_stEngineMicro )
{
*vol = C_SNDREAL_1;
return;
}
if( !p_stEngineMicro->h_3dData )
{
*vol = C_SNDREAL_1;
return;
}
/* eCurrentFluidEnvironment = fn_l3dDataGetEnvironmentOfCharacter(p_stEngineMicro->h_3dData);*/
/* if( eCurrentFluidEnvironment!=DNM_Fluid_Water )*/
/* {*/
/* *vol = C_SNDREAL_1;*/
/* return;*/
/* }*/
POS_fn_vGetTranslationVector(HIE_fn_hGetSuperObjectGlobalMatrix(fn_h_StandardGameGetSuperObject(p_stEngineMicro->h_StandardGame)),&stMicroPosition);
/* SECT_hGetDNMEnvironmentAndDepth(*/
/* NULL,*/
/* &stMicroPosition,*/
/* fn_h_SectInfoGetCurrentSector(p_stEngineMicro->h_SectInfo), */
/* &xDepth);*/
if( xDepth >= C_xMaxDepthForMusic )
{
*vol = C_SNDREAL_0;
}
else
{
xDepth = (C_xMaxDepthForMusic - xDepth)/C_xMaxDepthForMusic;
*vol = M_Fixed1616ToRealSnd(MTH_M_xRealToFixed16_16(xDepth));
}
}
long RetObjetSonoreSwitchMusic(long indice,long toto)
{
return 0;
}
SndBool RetObjetSonoreLinkMusic(long indice,long micro)
{
return TRUE;
}
#ifndef _FIRE_DEADCODE_U64_
void RetObjetInfoMusic(long obj,char* str,long size_str)
{
strncpy(str,"music ???",size_str);
}
#endif /* _FIRE_DEADCODE_U64_ */
#ifndef _FIRE_DEADCODE_U64_
void RetObjetInfoMenu(long obj,char* str,long size_str)
{
strncpy(str,"menu ???",size_str);
}
#endif /* _FIRE_DEADCODE_U64_ */
/*-----------------------------------------------------------------------------
* Description : init sound-object type for anim player
*-----------------------------------------------------------------------------
* Input : void
* Output : void
*-----------------------------------------------------------------------------
* Creation date : 13/02/97 Author : SOUND
*---------------------------------------------------------------------------*/
void fn_lInitSoundForAnim()
{
tdstAllRetObjectSound st_pfnRetObjectSound;
/*long lSoundObjectTypeAnim;*/
memset(&st_pfnRetObjectSound,0,sizeof(st_pfnRetObjectSound));
st_pfnRetObjectSound.X = RetObjetSonoreXAnim;
st_pfnRetObjectSound.Y = RetObjetSonoreYAnim;
st_pfnRetObjectSound.Z = RetObjetSonoreZAnim;
st_pfnRetObjectSound.VX = RetObjetSonoreVXAnim;
st_pfnRetObjectSound.VY = RetObjetSonoreVYAnim;
st_pfnRetObjectSound.VZ = RetObjetSonoreVZAnim;
st_pfnRetObjectSound.REVERB = RetObjetSonoreREVERBAnim;
st_pfnRetObjectSound.ExtraCoef = RetObjetSonoreExtraCoefAnim;
st_pfnRetObjectSound.Switch = RetObjetSonoreSwitchAnim;
st_pfnRetObjectSound.MicroLink = RetObjetSonoreLinkAnim;
g_lSoundVolumeLineSound=SND_fn_lAddVolumeLineSound();
g_lSoundObjectTypeAnim = SND_fn_lAddObjectTypeSound2(&st_pfnRetObjectSound,g_lSoundVolumeLineSound);
#ifndef _FIRE_DEADCODE_U64_
SND_fn_vSetInfoForTypeSound(g_lSoundObjectTypeAnim,RetObjetInfoAnim);
#endif /* _FIRE_DEADCODE_U64_ */
#ifdef D_USE_LIPSYNC
g_lSoundVolumeLineVoices=SND_fn_lAddVolumeLineSound();
g_lSoundObjectTypeLipsSynchro = SND_fn_lAddObjectTypeSound2(&st_pfnRetObjectSound,g_lSoundVolumeLineVoices);
SND_fn_vSetInfoForTypeSound(g_lSoundObjectTypeLipsSynchro,RetObjetInfoLipsSync);
#endif
memset(&st_pfnRetObjectSound,0,sizeof(st_pfnRetObjectSound));
st_pfnRetObjectSound.X = RetObjetSonoreXMusic;
st_pfnRetObjectSound.Y = RetObjetSonoreYMusic;
st_pfnRetObjectSound.Z = RetObjetSonoreZMusic;
st_pfnRetObjectSound.VX = RetObjetSonoreVXMusic;
st_pfnRetObjectSound.VY = RetObjetSonoreVYMusic;
st_pfnRetObjectSound.VZ = RetObjetSonoreVZMusic;
st_pfnRetObjectSound.REVERB = RetObjetSonoreREVERBMusic;
st_pfnRetObjectSound.ExtraCoef = RetObjetSonoreExtraCoefMusic;
st_pfnRetObjectSound.Switch = RetObjetSonoreSwitchMusic;
st_pfnRetObjectSound.MicroLink = RetObjetSonoreLinkMusic;
g_lSoundVolumeLineMusic=SND_fn_lAddVolumeLineSound();
g_lSoundObjectTypeMusic = SND_fn_lAddObjectTypeSound2(&st_pfnRetObjectSound,g_lSoundVolumeLineMusic);
#ifndef _FIRE_DEADCODE_U64_
SND_fn_vSetInfoForTypeSound(g_lSoundObjectTypeMusic,RetObjetInfoMusic);
#endif /* _FIRE_DEADCODE_U64_ */
/*---------------------------------------------------------------*/
memset(&st_pfnRetObjectSound,0,sizeof(st_pfnRetObjectSound));
st_pfnRetObjectSound.X = RetObjetSonoreXMusic;
st_pfnRetObjectSound.Y = RetObjetSonoreYMusic;
st_pfnRetObjectSound.Z = RetObjetSonoreZMusic;
st_pfnRetObjectSound.VX = RetObjetSonoreVXMusic;
st_pfnRetObjectSound.VY = RetObjetSonoreVYMusic;
st_pfnRetObjectSound.VZ = RetObjetSonoreVZMusic;
st_pfnRetObjectSound.REVERB = RetObjetSonoreREVERBMusic;
st_pfnRetObjectSound.ExtraCoef = RetObjetSonoreExtraCoefMusic;
st_pfnRetObjectSound.Switch = RetObjetSonoreSwitchMusic;
st_pfnRetObjectSound.MicroLink = RetObjetSonoreLinkMusic;
/* g_lSoundVolumeLineMusic=SND_fn_lAddVolumeLineSound();*/
g_lSoundObjectTypeMenu = SND_fn_lAddObjectTypeSound2(&st_pfnRetObjectSound,g_lSoundVolumeLineSound);/*<2A> changer*/
#ifndef _FIRE_DEADCODE_U64_
SND_fn_vSetInfoForTypeSound(g_lSoundObjectTypeMenu,RetObjetInfoMenu);
#endif /* _FIRE_DEADCODE_U64_ */
/*---------------------------------------------------------------*/
/* RollOff initialisation*/
SND_fn_vSetRollOffFunctionForTypeSound(g_lSoundObjectTypeAnim,fn_bRetRollOffFactor);
/*---------------------------------------------------------------*/
memset (ga_pstBlockEventSlotMemory , 0 ,GAM_C_NBLOCKEVENTSLOTNUMBER * sizeof(SND_tdstBlockEvent*));
return;
}
/*-----------------------------------------------------------------------------
* Description :
*-----------------------------------------------------------------------------
* Input :
* Output : void
*-----------------------------------------------------------------------------
* Creation date : 26/02/99 Author : MT
*---------------------------------------------------------------------------*/
void GAM_fn_lSaveBlockEventSlotMemory(SND_tdstBlockEvent *_p_stBlockEvent,unsigned long _ulIndex)
{
ENGassert(_ulIndex < GAM_C_NBLOCKEVENTSLOTNUMBER);
ga_pstBlockEventSlotMemory [_ulIndex] = _p_stBlockEvent;
}
/*-----------------------------------------------------------------------------
* Description :
*-----------------------------------------------------------------------------
* Input :
* Output :
*-----------------------------------------------------------------------------
* Creation date : 26/02/99 Author : MT
*---------------------------------------------------------------------------*/
SND_tdstBlockEvent *GAM_p_stGetBlockEventSlotMemory(unsigned long _ulIndex)
{
ENGassert(_ulIndex < GAM_C_NBLOCKEVENTSLOTNUMBER);
return ga_pstBlockEventSlotMemory [_ulIndex];
}
#undef D_Micros_StructureDefine
#undef D_Micros_VariableDefine

View File

@@ -0,0 +1,525 @@
/*=========================================================================
* ObjType.c : This module contain all object's type functions
* This is a part of the Game project.
*
* Version 1.0
* Creation date 15/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 "Actions/AllActs.h"
#include "Structur/3DOSLkTb.h"
#include "Structur/ErrGame.h"
#include "Structur/MemGame.h"
#include "Structur/Objects.h"
#include "Structur/StdObjSt.h"
#include "ObjType.h"
#include "ZeMem.h"
/*-----------------------------------------------------------------------------
* Description : Initialize the object's type structure (when the map is loaded)
*-----------------------------------------------------------------------------
* Input : void
* Output : void
*-----------------------------------------------------------------------------
* Creation date : 15/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vFirstInitObjectTypeStructure()
{
LST2_M_DynamicInitAnchor(&g_stObjectTypes.hFamilyType);
LST2_M_DynamicInitAnchor(&g_stObjectTypes.hModelType);
LST2_M_DynamicInitAnchor(&g_stObjectTypes.hPersonalType);
}
/*-----------------------------------------------------------------------------
* Description : Desinitialize the object's type structure (when the map is finish)
*-----------------------------------------------------------------------------
* Input : void
* Output : void
*-----------------------------------------------------------------------------
* Creation date : 15/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC 04/06/99 */
void fn_vLastDesinitObjectTypeStructure()
{
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC 04/06/99 */
/*-----------------------------------------------------------------------------
* Description : Find a object by its personal type (in the hierarchie)
*-----------------------------------------------------------------------------
* Input : personal type, first Super-Object
* Output : object's pointer (NULL if not found)
*-----------------------------------------------------------------------------
* Creation date : 16/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
struct tdstEngineObject_ *fn_p_stFindObjectByItsPersonalType(tdObjectType otPersonalType,HIE_tdxHandleToSuperObject p_stSuperObject)
{
tdstEngineObject *p_stEngineObject = NULL;
tdstEngineObject *p_stTempEngineObject;
long lSuperObjectType;
HIE_tdxHandleToSuperObject p_stChild;
long i;
p_stTempEngineObject = (tdstEngineObject *)HIE_fn_hGetSuperObjectObject(p_stSuperObject);
lSuperObjectType = HIE_fn_ulGetSuperObjectType(p_stSuperObject);
if ( lSuperObjectType==HIE_C_ulActor
&&M_ObjectGetPersonalType(p_stTempEngineObject)==otPersonalType)
p_stEngineObject = p_stTempEngineObject;
HIE_M_ForEachChildOf(p_stSuperObject,p_stChild,i)
{
if (p_stEngineObject==NULL)
p_stEngineObject = fn_p_stFindObjectByItsPersonalType(otPersonalType,p_stChild);
}
return(p_stEngineObject);
}
/*-----------------------------------------------------------------------------
* Description : Find or add a family type index of a family type name
*-----------------------------------------------------------------------------
* Input : family type name
* Output : family type (-1 if bad)
*-----------------------------------------------------------------------------
* Creation date : 16/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
tdObjectType fn_otFindOrAddFamilyTypeOfFamilyTypeName(char *szType)
{
tdObjectType otType = -1;
tdhHandleToObjectTypeElement hHandleToObjectTypeElement;
otType=fn_otFindFamilyTypeOfFamilyTypeName(szType);
if (otType==-1)
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeObjectTypeElement , 0 );
hHandleToObjectTypeElement = M_p_GameMallocInHLM(sizeof(struct tdstObjectTypeElement_));
LST2_M_DynamicInitElement(hHandleToObjectTypeElement);
LST2_M_DynamicAddTail(&g_stObjectTypes.hFamilyType,hHandleToObjectTypeElement);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeObjectTypeElement , 0 );
hHandleToObjectTypeElement->szName = M_p_GameMallocInHLM(strlen(szType)+1);
strcpy(hHandleToObjectTypeElement->szName,szType);
otType = fn_otFindFamilyTypeOfFamilyTypeName(szType);
hHandleToObjectTypeElement->ucElementPriority = GAM_g_ucHLMMemoryBlock;
}
return(otType);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*-----------------------------------------------------------------------------
* Description : Find a family type index of a family type name
*-----------------------------------------------------------------------------
* Input : family type name
* Output : family type (-1 if bad)
*-----------------------------------------------------------------------------
* Creation date : 16/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
tdObjectType fn_otFindFamilyTypeOfFamilyTypeName(char *szType)
{
tdObjectType otType = -1;
tdhHandleToObjectTypeElement hHandleToObjectTypeElement;
unsigned long i;
LST2_M_DynamicForEachElementOf(&g_stObjectTypes.hFamilyType,hHandleToObjectTypeElement,i)
{
if (!stricmp(szType,hHandleToObjectTypeElement->szName))
otType = i;
}
return(otType);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*-----------------------------------------------------------------------------
* Description : Find a family type name of a family type index
*-----------------------------------------------------------------------------
* Input : family type index
* Output : family type name (NULL if bad)
*-----------------------------------------------------------------------------
* Creation date : 16/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
char *fn_szFindFamilyTypeNameOfFamilyType(tdObjectType otType)
{
tdhHandleToObjectTypeElement hHandleToObjectTypeElement;
unsigned long i;
LST2_M_DynamicGetElementNumber(&g_stObjectTypes.hFamilyType,hHandleToObjectTypeElement,(unsigned long)otType,i);
if (hHandleToObjectTypeElement)
return(hHandleToObjectTypeElement->szName);
else
return(NULL);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*-----------------------------------------------------------------------------
* Description : Change a family type name of a family type index
*-----------------------------------------------------------------------------
* Input : family type index
* Output : family type name (NULL if bad)
*-----------------------------------------------------------------------------
* Creation date : 16/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#if defined(ACTIVE_EDITOR)
void fn_vChangeFamilyTypeNameOfFamilyType(tdObjectType _otType,char *_szNewName)
{
tdhHandleToObjectTypeElement hHandleToObjectTypeElement;
unsigned long i;
LST2_M_DynamicGetElementNumber(&g_stObjectTypes.hFamilyType,hHandleToObjectTypeElement,(unsigned long)_otType,i);
if (hHandleToObjectTypeElement->szName!=NULL)
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeObjectTypeElement , 0 );
M_GameFreeInHLM(hHandleToObjectTypeElement->szName);
}
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeObjectTypeElement , 0 );
hHandleToObjectTypeElement->szName = M_p_GameMallocInHLM(strlen(_szNewName)+1);
strcpy(hHandleToObjectTypeElement->szName,_szNewName);
}
#endif /* ACTIVE_EDITOR */
/*-----------------------------------------------------------------------------
* Description : Find or add a model type index of a model type name
*-----------------------------------------------------------------------------
* Input : model type name
* Output : model type (-1 if bad)
*-----------------------------------------------------------------------------
* Creation date : 16/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
tdObjectType fn_otFindOrAddModelTypeOfModelTypeName(char *szType)
{
tdObjectType otType = -1;
tdhHandleToObjectTypeElement hHandleToObjectTypeElement;
otType=fn_otFindModelTypeOfModelTypeName(szType);
if (otType==-1)
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeObjectTypeElement , 0 );
hHandleToObjectTypeElement = M_p_GameMallocInHLM(sizeof(struct tdstObjectTypeElement_));
LST2_M_DynamicInitElement(hHandleToObjectTypeElement);
LST2_M_DynamicAddTail(&g_stObjectTypes.hModelType,hHandleToObjectTypeElement);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeObjectTypeElement , 0 );
hHandleToObjectTypeElement->szName = M_p_GameMallocInHLM(strlen(szType)+1);
strcpy(hHandleToObjectTypeElement->szName,szType);
otType=fn_otFindModelTypeOfModelTypeName(szType);
hHandleToObjectTypeElement->ucElementPriority = GAM_g_ucHLMMemoryBlock;
}
return(otType);
}
/*-----------------------------------------------------------------------------
* Description : Find a model type index of a model type name
*-----------------------------------------------------------------------------
* Input : model type name
* Output : model type (-1 if bad)
*-----------------------------------------------------------------------------
* Creation date : 16/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
tdObjectType fn_otFindModelTypeOfModelTypeName(char *szType)
{
tdObjectType otType = -1;
tdhHandleToObjectTypeElement hHandleToObjectTypeElement;
unsigned long i;
LST2_M_DynamicForEachElementOf(&g_stObjectTypes.hModelType,hHandleToObjectTypeElement,i)
{
if (!stricmp(szType,hHandleToObjectTypeElement->szName))
otType = i;
}
return(otType);
}
/*-----------------------------------------------------------------------------
* Description : Find a model type name of a model type index
*-----------------------------------------------------------------------------
* Input : model type index
* Output : model type name (NULL if bad)
*-----------------------------------------------------------------------------
* Creation date : 16/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
char *fn_szFindModelTypeNameOfModelType(tdObjectType otType)
{
tdhHandleToObjectTypeElement hHandleToObjectTypeElement;
unsigned long i;
LST2_M_DynamicGetElementNumber(&g_stObjectTypes.hModelType,hHandleToObjectTypeElement,(unsigned long)otType,i);
if (hHandleToObjectTypeElement)
return(hHandleToObjectTypeElement->szName);
else
return(NULL);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*-----------------------------------------------------------------------------
* Description : Change a Model type name of a family type index
*-----------------------------------------------------------------------------
* Input : model type index
* Output : model type name (NULL if bad)
*-----------------------------------------------------------------------------
* Creation date : 16/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#if defined(ACTIVE_EDITOR)
void fn_vChangeModelTypeNameOfModelType(tdObjectType _otType,char *_szNewName)
{
tdhHandleToObjectTypeElement hHandleToObjectTypeElement;
unsigned long i;
LST2_M_DynamicGetElementNumber(&g_stObjectTypes.hModelType,hHandleToObjectTypeElement,(unsigned long)_otType,i);
if (hHandleToObjectTypeElement->szName!=NULL)
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeObjectTypeElement , 0 );
M_GameFreeInHLM(hHandleToObjectTypeElement->szName);
}
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeObjectTypeElement , 0 );
hHandleToObjectTypeElement->szName = M_p_GameMallocInHLM(strlen(_szNewName)+1);
strcpy(hHandleToObjectTypeElement->szName,_szNewName);
}
#endif /* ACTIVE_EDITOR */
/*-----------------------------------------------------------------------------
* Description : Find or add a personal type index of a personal type name
*-----------------------------------------------------------------------------
* Input : personal type name
* Output : personal type (-1 if bad)
*-----------------------------------------------------------------------------
* Creation date : 16/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
tdObjectType fn_otFindOrAddPersonalTypeOfPersonalTypeName(char *szType)
{
tdObjectType otType = -1;
tdhHandleToObjectTypeElement hHandleToObjectTypeElement;
otType=fn_otFindPersonalTypeOfPersonalTypeName(szType);
if (otType==-1)
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeObjectTypeElement , 0 );
hHandleToObjectTypeElement = M_p_GameMallocInHLM(sizeof(struct tdstObjectTypeElement_));
LST2_M_DynamicInitElement(hHandleToObjectTypeElement);
LST2_M_DynamicAddTail(&g_stObjectTypes.hPersonalType,hHandleToObjectTypeElement);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeObjectTypeElement , 0 );
hHandleToObjectTypeElement->szName = M_p_GameMallocInHLM(strlen(szType)+1);
strcpy(hHandleToObjectTypeElement->szName,szType);
otType=fn_otFindPersonalTypeOfPersonalTypeName(szType);
hHandleToObjectTypeElement->ucElementPriority = GAM_g_ucHLMMemoryBlock;
}
return(otType);
}
/*-----------------------------------------------------------------------------
* Description : Find a personal type index of a personal type name
*-----------------------------------------------------------------------------
* Input : personal type name
* Output : personal type (-1 if bad)
*-----------------------------------------------------------------------------
* Creation date : 16/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
tdObjectType fn_otFindPersonalTypeOfPersonalTypeName(char *szType)
{
tdObjectType otType = -1;
tdhHandleToObjectTypeElement hHandleToObjectTypeElement;
unsigned long i;
LST2_M_DynamicForEachElementOf(&g_stObjectTypes.hPersonalType,hHandleToObjectTypeElement,i)
{
if (!stricmp(szType,hHandleToObjectTypeElement->szName))
otType = i;
}
return(otType);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*-----------------------------------------------------------------------------
* Description : Find a personal type name of a personal type index
*-----------------------------------------------------------------------------
* Input : personal type index
* Output : personal type name (NULL if bad)
*-----------------------------------------------------------------------------
* Creation date : 16/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
char *fn_szFindPersonalTypeNameOfPersonalType(tdObjectType otType)
{
tdhHandleToObjectTypeElement hHandleToObjectTypeElement;
unsigned long i;
LST2_M_DynamicGetElementNumber(&g_stObjectTypes.hPersonalType,hHandleToObjectTypeElement,(unsigned long)otType,i);
if (hHandleToObjectTypeElement)
return(hHandleToObjectTypeElement->szName);
else
return(NULL);
}
#ifndef _FIRE_DEADCODE_U64_
/*-----------------------------------------------------------------------------
* Description : Change a personal type name of a family type index
*-----------------------------------------------------------------------------
* Input : personal type index
* Output : personal type name (NULL if bad)
*-----------------------------------------------------------------------------
* Creation date : 16/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vChangePersonalTypeNameOfPersonalType(tdObjectType _otType,char *_szNewName)
{
tdhHandleToObjectTypeElement hHandleToObjectTypeElement;
unsigned long i;
LST2_M_DynamicGetElementNumber(&g_stObjectTypes.hPersonalType,hHandleToObjectTypeElement,(unsigned long)_otType,i);
if (hHandleToObjectTypeElement->szName!=NULL)
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeObjectTypeElement , 0 );
M_GameFreeInHLM(hHandleToObjectTypeElement->szName);
}
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeObjectTypeElement , 0 );
hHandleToObjectTypeElement->szName = M_p_GameMallocInHLM(strlen(_szNewName)+1);
strcpy(hHandleToObjectTypeElement->szName,_szNewName);
}
/*XB980507*/
#endif /* _FIRE_DEADCODE_U64_ */
/*End XB*/
/*-----------------------------------------------------------------------------
* Description : Destroy all level elements
*-----------------------------------------------------------------------------
* Input : void
* Output : void
*-----------------------------------------------------------------------------
* Creation date : 05/09/97 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vFreeAllObjectTypeForPriority(unsigned char ucPriority)
{
tdhHandleToObjectTypeElement hHandleToObjectTypeElement,hHandleToNextObjectTypeElement;
unsigned long i;
LST2_M_DynamicForEachMovingElementOf(&g_stObjectTypes.hFamilyType,hHandleToObjectTypeElement,hHandleToNextObjectTypeElement,i)
{
if (hHandleToObjectTypeElement->ucElementPriority==ucPriority)
LST2_M_DynamicIsolate(hHandleToObjectTypeElement);
}
LST2_M_DynamicForEachMovingElementOf(&g_stObjectTypes.hModelType,hHandleToObjectTypeElement,hHandleToNextObjectTypeElement,i)
{
if (hHandleToObjectTypeElement->ucElementPriority==ucPriority)
LST2_M_DynamicIsolate(hHandleToObjectTypeElement);
}
LST2_M_DynamicForEachMovingElementOf(&g_stObjectTypes.hPersonalType,hHandleToObjectTypeElement,hHandleToNextObjectTypeElement,i)
{
if (hHandleToObjectTypeElement->ucElementPriority==ucPriority)
LST2_M_DynamicIsolate(hHandleToObjectTypeElement);
}
}
/*XB980507*/
/*#endif /* _FIRE_DEADCODE_U64_ */
/*End XB*/
/*-----------------------------------------------------------------------------
* Description : Find a object by its personal type name (in the hierarchie)
*-----------------------------------------------------------------------------
* Input : personal type name, first Super-Object
* Output : object's pointer (NULL if not found)
*-----------------------------------------------------------------------------
* Creation date : 16/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
struct tdstEngineObject_ *fn_p_stFindObjectByItsPersonalTypeName(char *szPersonalType,HIE_tdxHandleToSuperObject p_stSuperObject)
{
tdstEngineObject *p_stEngineObject = NULL;
tdObjectType otPersonalType;
otPersonalType = fn_otFindPersonalTypeOfPersonalTypeName(szPersonalType);
if (otPersonalType!=-1)
p_stEngineObject = fn_p_stFindObjectByItsPersonalType(otPersonalType,p_stSuperObject);
return(p_stEngineObject);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */

View File

@@ -0,0 +1,898 @@
/*=========================================================================
* Objinit.c : Initialize all object's models.
* This is a part of the Game project.
*
* Version 1.0
* Creation date 09/08/96
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1996
*=======================================================================*/
#include <cpa_std.h>
#define D_State_Define
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/Objects.h"
#include "Structur/EngMode.h"
#include "Structur/ErrGame.h"
#include "Structur/MemGame.h"
#include "Structur/StdObjSt.h"
#include "Always.h"
#include "Basic.h"
#include "Family.h"
#include "GameEng.h"
#include "InitEng.h"
#include "MainChar.h"
#include "Micros.h"
#include "ObjInit.h"
#include "PlayAnim/PlayAnim.h"
#include "ObjType.h"
#include "ZeMem.h"
#include "Toolcam.h"
#include "Structur/state.h"
#ifdef GAM_USE_SNA
#include "sna\snaglob.h"
#endif /* GAM_USE_SNA */
#if defined (ACTIVE_EDITOR) || defined (RETAIL)
#define ENGassert(param)
#else
#define ENGassert(param) assert(param)
#endif
/*-----------------------------------------------------------------------------
* Description : Free a world hierarchy
*-----------------------------------------------------------------------------
* Input : Super Object
* Output : Void
*-----------------------------------------------------------------------------
* Creation date : 12/11/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
extern ACP_tdxBool fn_bIsInFix(struct tdstEngineObject_ *p_stObject);
void fn_vDestroyAllHierarchy(HIE_tdxHandleToSuperObject p_stSuperObject)
{
HIE_tdxHandleToSuperObject p_stChild,p_stNextChild;
long i;
HIE_M_ForEachMovingChildOf(p_stSuperObject,p_stChild,p_stNextChild,i)
{
fn_vDestroyAllHierarchy(p_stChild);
}
HIE_fn_vIsolate(p_stSuperObject);
#ifdef U64
if ( (HIE_fn_ulGetSuperObjectType(p_stSuperObject) == HIE_C_ulActor) &&
!fn_ucIsAnAlwaysObject(M_GetEngineObject(p_stSuperObject)) )
{
/* desinit*/
fn_vDesinitOneObject(M_GetEngineObject(p_stSuperObject),OTI_MapLoaded);
}
#else
#if defined(GAM_USE_SNA)
switch(HIE_fn_ulGetSuperObjectType(p_stSuperObject))
{
case HIE_C_ulActor:
if ( !fn_ucIsAnAlwaysObject(M_GetEngineObject(p_stSuperObject)) )
{
/* We desinit the object*/
/* - if it is in the fix because fix objects must not be deleted*/
/* - if we load snapshot because in this case there is no need to delete it*/
if ( fn_bIsInFix(M_GetEngineObject(p_stSuperObject))
|| SNA_fn_ucGetLoadType() == SNA_LOAD_SNAPSHOT)
{
/* desinit*/
fn_vDesinitOneObject(M_GetEngineObject(p_stSuperObject),OTI_MapLoaded);
}
else
{
fn_p_stFreeEngineSuperObject(p_stSuperObject);
}
}
break;
}
#endif /* GAM_USE_SNA */
#endif /* U64*/
}
/*-----------------------------------------------------------------------------
* Description :
*-----------------------------------------------------------------------------
* Input :
* Output :
*-----------------------------------------------------------------------------
* Creation date : 25/06/98 Author : Marc
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vDestroyAllTheWorld()
{
fn_vDestroyAllHierarchy(gp_stDynamicWorld);
fn_vDestroyAllHierarchy(gp_stInactiveDynamicWorld);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*-----------------------------------------------------------------------------
* Description : Free a Character's SuperObject
*-----------------------------------------------------------------------------
* Input : Pointer to the super object
* Output : Pointer to the super object (NULL if OK)
*-----------------------------------------------------------------------------
* Creation date : 15/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_
HIE_tdxHandleToSuperObject fn_p_stFreeEngineSuperObject(HIE_tdxHandleToSuperObject p_stSuperObject)
{
tdstEngineObject *p_stEngineObject;
long lSuperObjectType;
p_stEngineObject = (struct tdstEngineObject_ *)HIE_fn_hGetSuperObjectObject(p_stSuperObject);
lSuperObjectType = HIE_fn_ulGetSuperObjectType(p_stSuperObject);
if (lSuperObjectType==HIE_C_ulActor)
{
fn_p_stFreeEngineObject(p_stEngineObject);
HIE_fn_vDestroySuperObject(p_stSuperObject);
}
else
M_GameWarningError(E_uwGameFreeEngineSuperObjectNoCharacter);
return(p_stSuperObject);
}
#endif /* _FIRE_DEADCODE_U64_ */
/*-----------------------------------------------------------------------------
* Description : Free a engine object
*-----------------------------------------------------------------------------
* Input : Pointer to the object
* Output : Pointer of the object (NULL if succes)
*-----------------------------------------------------------------------------
* Creation date : 09/10/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
struct tdstEngineObject_ *fn_p_stFreeEngineObject(struct tdstEngineObject_ *p_stTempObject)
{
long i;
for(i=(sizeof(tdstEngineObject)/sizeof(void*))-1;i>=0;i--)
{
if (M_VoidMiniStructurePointer(p_stTempObject,i)!=NULL)
/* M_ForAllMiniStructureExceptNULL(p_stTempObject,i)*/
{
g_a_stStructureHandleFunction[i].p_fn_vFreeFunction(p_stTempObject);
}
}
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeEngineObject , 0 );
M_GameFreeInHLM(p_stTempObject);
return(p_stTempObject);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*-----------------------------------------------------------------------------
* Description : Initialisation of an object
*-----------------------------------------------------------------------------
* Input : object structure pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 28/02/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vInitOneObject(struct tdstEngineObject_ *p_stObject,enum tdeObjectTreeInit_ eObjIniType)
{
long i;
if (p_stObject->h_3dData==NULL||p_stObject->h_StandardGame==NULL)
M_GameFatalError(E_uwGameInitDesinitOneObjectNullPointer);
if (M_ObjectGetFamilyType(p_stObject)==C_InvalidObjectType)
M_GameInformationError(E_uwGameInitOneObjectInvalidObject);
M_ForAllMiniStructureExceptNULL(p_stObject,i)
{
g_a_stStructureHandleFunction[i].p_fn_vInitFunction(p_stObject,eObjIniType);
}
if (eObjIniType==OTI_MapLoaded)
fn_vAllSecondPassAreDone(p_stObject->h_StandardGame);
}
/*-----------------------------------------------------------------------------
* Description : Desinitialisation of an object
*-----------------------------------------------------------------------------
* Input : object structure pointer
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 28/02/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vDesinitOneObject(struct tdstEngineObject_ *p_stObject,enum tdeObjectTreeInit_ eObjIniType)
{
long i;
if (p_stObject->h_3dData==NULL||p_stObject->h_StandardGame==NULL)
M_GameFatalError(E_uwGameInitDesinitOneObjectNullPointer);
if (M_ObjectGetFamilyType(p_stObject)==C_InvalidObjectType)
M_GameInformationError(E_uwGameInitOneObjectInvalidObject);
M_ForAllMiniStructureExceptNULL(p_stObject,i)
{
g_a_stStructureHandleFunction[i].p_fn_vDesinitFunction(p_stObject,eObjIniType);
}
}
void fn_vForceActiveAnObject(struct tdstEngineObject_ *p_stObject)
{
struct MTH3D_tdstVector_ hPosition;
POS_tdstCompletePosition *hMatrix;
HIE_tdxHandleToSuperObject hFather;
hFather = HIE_fn_hGetSuperObjectFather( M_GetSuperObject(p_stObject) );
if( hFather == gp_stInactiveDynamicWorld )
{
if( fn_ucStandardGameGetPlatFormType(M_GetMSHandle(M_GetSuperObject(p_stObject),StandardGame))!=0 )
{
HIE_fn_vSuperObjectAddHead(gp_stDynamicWorld,M_GetSuperObject(p_stObject));
}
else
{
HIE_fn_vSuperObjectAddTail(gp_stDynamicWorld,M_GetSuperObject(p_stObject));
}
}
M_CheckPointer(HIE_fn_hGetSuperObjectFather(M_GetSuperObject(p_stObject)));
hMatrix = HIE_fn_hGetSuperObjectGlobalMatrix( HIE_fn_hGetSuperObjectFather( M_GetSuperObject(p_stObject) ) );
POS_fn_vGetTranslationVector( HIE_fn_hGetSuperObjectMatrix(M_GetSuperObject(p_stObject)) ,&hPosition);
POS_fn_vMulMatrixVertex( &hPosition, hMatrix, &hPosition );
fn_vSectInfoInitForSingleCharacter(M_GetSuperObject(p_stObject),&hPosition);
fn_vStandardGameSetIsActivable(p_stObject->h_StandardGame,1);
M_ActivateObject(p_stObject);
/* if (fn_ul3dDataGetTimeDelay(p_stObject->h_3dData))*/
{ /*fn_v3dDataSetStartTime(p_stObject->h_3dData,g_stEngineStructure.stEngineTimer.ulCurrentTimerCount-fn_ul3dDataGetTimeDelay(p_stObject->h_3dData)+fn_ul3dDataGetStartTime(p_stObject->h_3dData));*/
fn_v3dDataSetStartTime(p_stObject->h_3dData,g_stEngineStructure.stEngineTimer.ulCurrentTimerCount);
fn_v3dDataSetTimePreviousFrame(p_stObject->h_3dData,g_stEngineStructure.stEngineTimer.ulCurrentTimerCount);
}
/* reactive an object, so create its element3d array if necessary*/
if (fn_p_st3dDataGetCurrentFrame(p_stObject->h_3dData)->p_stArrayOfElts3d == NULL)
{
tdstAnim3d * p_stCurrentAnim;
ENGassert(fn_h3dDataGetCurrentState(p_stObject->h_3dData) != NULL);
if (fn_h3dDataGetCurrentState(p_stObject->h_3dData))
{
p_stCurrentAnim = fn_h3dDataGetCurrentState(p_stObject->h_3dData)->p_stAnim;
if (p_stCurrentAnim)
{
/* ANNECY MT - 22/09/98 {*/
/*MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeAnimation , p_stObject->h_3dData->h_Family);*/
/*fn_p_st3dDataGetCurrentFrame(p_stObject->h_3dData)->p_stArrayOfElts3d = (tdstElement3d*)TMP_M_p_Malloc(sizeof(tdstElement3d) * p_stCurrentAnim->ucMaxNumberOfElements);*/
fn_p_st3dDataGetCurrentFrame(p_stObject->h_3dData)->p_stAnim = NULL;
/*memset(fn_p_st3dDataGetCurrentFrame(p_stObject->h_3dData)->p_stArrayOfElts3d,0,sizeof(tdstElement3d) * p_stCurrentAnim->ucMaxNumberOfElements);*/
fn_vAllocArrayOfElts3d (p_stObject -> h_3dData , p_stCurrentAnim->ucMaxNumberOfElements);
/* END ANNECY MT }*/
}
}
/* reinit anim reference to force interpolation to re-create frame*/
fn_p_st3dDataGetCurrentFrame(p_stObject->h_3dData)->p_stAnim = NULL;
}
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vActiveAnObject(struct tdstEngineObject_ *p_stObject)
{
if (!fn_bf1StandardGameGetIsDesactivateAtAll(p_stObject->h_StandardGame))
{
fn_vForceActiveAnObject(p_stObject);
}
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
void fn_vDesactiveAnObject(struct tdstEngineObject_ *p_stObject)
{
PLA_fn_vDesInitAllChildOfCharacter(M_GetSuperObject(p_stObject),p_stObject);
SND_fn_vKillObjectSound2((long)M_GetSuperObject(p_stObject),g_lSoundObjectTypeAnim);
if( !fn_bf1StandardGameGetIsDesactivateAtAll(p_stObject->h_StandardGame) && M_ObjectIsActivable(p_stObject) )
{
fn_vStandardGameSetIsActivable(p_stObject->h_StandardGame,0);
fn_vStandardGameSetIsDesactivateAtAll(p_stObject->h_StandardGame,0);
M_UnactivateObject(p_stObject);
}
}
void fn_vKillEngineObjectNotAlways(struct tdstEngineObject_ *p_stObject)
{
PLA_fn_vDesInitAllChildOfCharacter(M_GetSuperObject(p_stObject),p_stObject);
/*
switch(fn_eStandardGameGetInitFlagWhenDeadOrTaken(p_stObject->h_StandardGame))
{
case OI_WhenPlayerGoOutOfActionZone:
fn_vStandardGameSetIsActivable(p_stObject->h_StandardGame,1);
fn_vStandardGameSetIsDesactivateAtAll(p_stObject->h_StandardGame,0);
break;
case OI_Always:
fn_vStandardGameSetIsActivable(p_stObject->h_StandardGame,1);
fn_vStandardGameSetIsDesactivateAtAll(p_stObject->h_StandardGame,0);
fn_vInitOneObject(p_stObject,OTI_Always);
break;
case OI_WhenPlayerIsDead:
fn_vStandardGameSetIsActivable(p_stObject->h_StandardGame,0);
fn_vStandardGameSetIsDesactivateAtAll(p_stObject->h_StandardGame,0);
break;
case OI_NeverBackWhenTaken:
fn_vStandardGameSetIsActivable(p_stObject->h_StandardGame,0);
fn_vStandardGameSetIsDesactivateAtAll(p_stObject->h_StandardGame,1);
break;
case OI_WhenMapJustLoaded:
case OI_WhenSavedGameJustLoaded:
case OI_WhenGeneratorIsDesactivated:
fn_vStandardGameSetIsActivable(p_stObject->h_StandardGame,0);
fn_vStandardGameSetIsDesactivateAtAll(p_stObject->h_StandardGame,0);
break;
}
*/
if(!fn_bf1StandardGameGetIsDesactivateAtAll(p_stObject->h_StandardGame))
{
/* dead*/
fn_vStandardGameSetIsDesactivateAtAll(p_stObject->h_StandardGame,1);
/* definitively ????*/
if (fn_eStandardGameGetInitFlagWhenDeadOrTaken(p_stObject->h_StandardGame) == OI_NeverBackWhenTaken)
fn_vStandardGameSetIsActivable(p_stObject->h_StandardGame,0);
else
fn_vStandardGameSetIsActivable(p_stObject->h_StandardGame,1);
/* reinit ???*/
if (fn_eStandardGameGetInitFlagWhenDeadOrTaken(p_stObject->h_StandardGame) == OI_Always)
fn_vInitOneObject(p_stObject,OTI_Always);
else
M_UnactivateObject(p_stObject);
}
/*kill the eventual attached Sound Object*/
SND_fn_vKillObjectSound2((long)M_GetSuperObject(p_stObject),g_lSoundObjectTypeAnim);
}
void fn_vKillEngineObjectOrAlwaysByPointer(struct tdstEngineObject_ *p_stObject)
{
if (M_ObjectGetFamilyType(p_stObject)!=C_InvalidObjectType)
{
if (M_ObjectGetPersonalType(p_stObject)>=C_AlwaysObjectType)
fn_vKillAlwaysByPersonalType(M_ObjectGetPersonalType(p_stObject));
else
fn_vKillEngineObjectNotAlways(p_stObject);
}
else
M_GameWarningError(E_uwGameKillOneEngineObjectInvalid);
}
#ifndef _FIRE_DEADCODE_U64_
void fn_vKillEngineObjectOrAlwaysByPersonalType(tdObjectType otPersonalType)
{
if (otPersonalType!=C_InvalidObjectType)
{
if (otPersonalType>=C_AlwaysObjectType)
fn_vKillAlwaysByPersonalType(otPersonalType);
else
{
/**** look for object's pointer ****/
fn_vKillEngineObjectNotAlways(fn_p_stFindObjectByItsPersonalType(otPersonalType,gp_stActualWorld));
}
}
else
M_GameWarningError(E_uwGameKillOneEngineObjectInvalid);
}
#endif /* _FIRE_DEADCODE_U64_ */
/*-----------------------------------------------------------------------------
* Description : Initialisation of all object when
* a new game start
*-----------------------------------------------------------------------------
* Input : None
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 28/02/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vInitAllObjectsWhenNewGameStart(void)
{
}
/*************************************************************************/
void fn_vInitAllObjectsWhenMapJustLoaded(void)
{
HIE_fn_vInitMatrixStack();
fn_vInitAllObjectTree(OTI_MapLoaded,gp_stDynamicWorld);
fn_vInitAlwaysModel(OTI_MapLoaded);
}
/*************************************************************************/
void fn_vInitAllObjectsWorld(enum tdeObjectTreeInit_ eObjIniType)
{
fn_vInitAllObjectTree(eObjIniType,gp_stDynamicWorld);
fn_vInitAllObjectTree(eObjIniType,gp_stInactiveDynamicWorld);
}
/*************************************************************************/
void fn_vInitAllObjectsWhenSavedGameJustLoaded(void)
{
HIE_fn_vInitMatrixStack();
fn_vInitAllObjectsWorld(OTI_LoadSavedGame);
fn_vInitAlwaysModel(OTI_LoadSavedGame);
}
/*************************************************************************/
void fn_vReInitActorsWhenSectorBecomesActive(HIE_tdxHandleToSuperObject _hSector)
{
SECT_tdxHandleOfElementLstCharacter hCharacterList,hNextCharacterList;
HIE_tdxHandleToSuperObject hTreatCharacter;
tdstEngineObject *p_stTreatObject;
long j;
SECT_M_ForEachXMovingCharListInSector(_hSector,hCharacterList,hNextCharacterList,j)
{
hTreatCharacter = SECT_GetCharacterInList(hCharacterList);
p_stTreatObject = (tdstEngineObject *)HIE_fn_hGetSuperObjectObject(hTreatCharacter);
/* ANNECY MT - 16/12/98 {*/
/*////////////////////// Previous test
(
(
( fn_eStandardGameGetInitFlagWhenDeadOrTaken(p_stTreatObject->h_StandardGame) == OI_WhenPlayerGoOutOfActionZone
|| fn_eStandardGameGetInitFlagWhenDeadOrTaken(p_stTreatObject->h_StandardGame) == OI_Always
)
&& fn_bf1StandardGameGetIsDesactivateAtAll(p_stTreatObject->h_StandardGame)
)
|| (fn_eStandardGameGetInitFlagWhenOutOfZone(p_stTreatObject->h_StandardGame) == OI_WhenPlayerGoOutOfActionZone)
);
//////////////////////*/
if(
(fn_bf1StandardGameGetIsDesactivateAtAll(p_stTreatObject->h_StandardGame) /* perso is dead*/
&& ((fn_eStandardGameGetInitFlagWhenDeadOrTaken(p_stTreatObject->h_StandardGame) == OI_WhenPlayerGoOutOfActionZone)
||
(fn_eStandardGameGetInitFlagWhenDeadOrTaken(p_stTreatObject->h_StandardGame) == OI_Always)
)
)
||
(!fn_bf1StandardGameGetIsDesactivateAtAll(p_stTreatObject->h_StandardGame) /* perso is alive*/
&& (fn_eStandardGameGetInitFlagWhenOutOfZone(p_stTreatObject->h_StandardGame) == OI_WhenPlayerGoOutOfActionZone)
)
)
/* END ANNECY MT }*/
{
if( !fn_ucIsAnAlwaysObject(p_stTreatObject)
#ifndef U64
&& g_DEMO_KeybTest != DEMO_PLAY
#endif
)
fn_vInitOneObject(p_stTreatObject,OTI_WhenGoOutOfZone);
}
}
}
/*************************************************************************/
/* Modif : 22/05/98 loop to take perso in new active sector*/
void fn_vInitObjectsWhenPlayerChangeSector(HIE_tdxHandleToSuperObject hCharacter,
HIE_tdxHandleToSuperObject hCurrentSector,
HIE_tdxHandleToSuperObject hPreviousSector)
{
long i,j;
HIE_tdxHandleToSuperObject hListInActiveSector;
HIE_tdxHandleToSuperObject hListInPreviousSector;
SECT_tdxHandleOfElementLstActivityInteraction hActivityListInActiveSector;
SECT_tdxHandleOfElementLstActivityInteraction hActivityListInPreviousSector;
unsigned char bSectorWasAndIsActive;
// reInit actors when inactive sectors become active
// Sectors in Activation List of CurrentSector
SECT_M_ForEachActivityNodeInActivityInteractionList(hCurrentSector,hActivityListInActiveSector,i)
{
bSectorWasAndIsActive = FALSE;
hListInActiveSector = SECT_GetSectorInActivityList(hActivityListInActiveSector);
if (hListInActiveSector==hPreviousSector)
bSectorWasAndIsActive = TRUE;
else
{
SECT_M_ForEachActivityNodeInActivityInteractionList(hPreviousSector,hActivityListInPreviousSector,j)
{
hListInPreviousSector = SECT_GetSectorInActivityList(hActivityListInPreviousSector);
if (hListInPreviousSector==hListInActiveSector)
bSectorWasAndIsActive = TRUE;
}
}
if (bSectorWasAndIsActive == FALSE)
{
fn_vReInitActorsWhenSectorBecomesActive(hListInActiveSector);
}
}
// Current Sector
bSectorWasAndIsActive = FALSE;
SECT_M_ForEachActivityNodeInActivityInteractionList(hPreviousSector,hActivityListInPreviousSector,j)
{
hListInPreviousSector = SECT_GetSectorInActivityList(hActivityListInPreviousSector);
if (hListInPreviousSector==hCurrentSector)
bSectorWasAndIsActive = TRUE;
}
if (bSectorWasAndIsActive == FALSE)
{
fn_vReInitActorsWhenSectorBecomesActive(hCurrentSector);
}
}
/*************************************************************************/
/*-----------------------------------------------------------------------------
* Description : Initialisation of all object when
* the map just loaded
*-----------------------------------------------------------------------------
* Input : None
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 28/02/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vForceReinitAllObjects()
{
HIE_fn_vInitMatrixStack();
fn_vInitAllObjectsWorld(OTI_ReinitTheMap);
fn_vInitAlwaysModel(OTI_ReinitTheMap);
CAM_fn_vReInitCameras();
}
/*-----------------------------------------------------------------------------
* Description : The player is dead, we must reinit the map by doing a dead loop
*
*-----------------------------------------------------------------------------
* Input : None
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 25/06/97 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : 13/09/97 Modification Author : Olivier
* Modifications : Special Position Flag use
*---------------------------------------------------------------------------*/
void fn_vSnifThePlayerIsDead(void)
{
/* #ifndef ACTIVE_EDITOR*/
/* fn_vStandardGameChangePositionFromSpecialPositionFlag();*/
/* #endif /* ACTIVE_EDITOR */
/* ANNECY MT - 28/08/98 {*/
/* No resurection*/
POS_fn_vSetIdentityMatrix(&g_stEngineStructure.stMainCharacterPosition);
POS_fn_vSetIdentityMatrix(&g_stEngineStructure.stMainCameraPosition);
g_stEngineStructure.bResurection = FALSE;
/* END ANNECY MT }*/
/* JO 27/11/97*/
/*SND_fn_vKillAllObjectSound();*/
SND_fn_vKillAllObjectTypeSound( g_lSoundObjectTypeAnim );
#ifdef D_USE_LIPSYNC
SND_fn_vKillAllObjectTypeSound( g_lSoundObjectTypeLipsSynchro );
#endif
fn_vChangeEngineMode(EM_ModePlayerDead);
}
/*-----------------------------------------------------------------------------
* Description : The player is dead, we must reinit the map by doing a dead loop
* Must replace fn_vSnifThePlayerIsDead
*
*-----------------------------------------------------------------------------
* Input : BOOLEAN
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 02/10/97 Author : Olivier
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
/*
void fn_vSnifThePlayerIsDeadWithOption(ACP_tdxBool _bSpecialPositionUse)
{
#ifndef ACTIVE_EDITOR
if( _bSpecialPositionUse )
fn_vStandardGameChangePositionFromSpecialPositionFlag();
#endif // ACTIVE_EDITOR
// JO 27/11/97
//SND_fn_vKillAllObjectSound();
SND_fn_vKillAllObjectTypeSound( g_lSoundObjectTypeAnim );
SND_fn_vKillAllObjectTypeSound( g_lSoundObjectTypeLipsSynchro );
fn_vChangeEngineMode(EM_ModePlayerDead);
}
*/
/*-----------------------------------------------------------------------------
* Description : The player is dead, we must reinit the map by doing a
* dead loop.
* Principal character is initialized at characterOne's
* position, and principal camera at CharacterTwo's
* position, if SpecialPositionFlag(s) are valid.
* Else, the fn_vSnifThePlayerIsDeadWithOption function
* is called.
*
*-----------------------------------------------------------------------------
* Input : two characters
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 26/11/97 Author : Olivier
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vSnifThePlayerIsDeadWithResurrectionAt(HIE_tdxHandleToSuperObject _hCharacterPositionOne,HIE_tdxHandleToSuperObject _hCharacterPositionTwo)
{
/* ANNECY MT - 28/08/98 {*/
HIE_tdxHandleToSuperObject hMaincharacter = MC_fn_hGetCharacterInMainCharacterNode( MC_fn_hGetFirstMainCharNode() );
g_stEngineStructure.bResurection = FALSE;
/* save Main Character Resurection Position*/
if(_hCharacterPositionOne && hMaincharacter)
{
/* save initial position*/
POS_fn_vCopyMatrix
(
&g_stEngineStructure.stMainCharacterPosition,
fn_p_st3dDataGetMatrixInit(M_GetMSHandle(hMaincharacter,3dData))
);
/* set initial position to resurection position*/
POS_fn_vCopyMatrix
(
fn_p_st3dDataGetMatrixInit(M_GetMSHandle(hMaincharacter,3dData)),
HIE_fn_hGetSuperObjectGlobalMatrix(_hCharacterPositionOne)
);
g_stEngineStructure.bResurection = TRUE;
}
else if(hMaincharacter)
{
/* save initial position*/
POS_fn_vCopyMatrix
(
&g_stEngineStructure.stMainCharacterPosition,
fn_p_st3dDataGetMatrixInit(M_GetMSHandle(hMaincharacter,3dData))
);
g_stEngineStructure.bResurection = TRUE;
}
/* save Main Camera Resurection Position*/
if(_hCharacterPositionTwo && g_stEngineStructure.h_StdCamCaracter)
{
/* save initial position*/
POS_fn_vCopyMatrix
(
&g_stEngineStructure.stMainCameraPosition,
fn_p_st3dDataGetMatrixInit(M_GetMSHandle(g_stEngineStructure.h_StdCamCaracter,3dData))
);
/* set initial position to resurection position*/
POS_fn_vCopyMatrix
(
fn_p_st3dDataGetMatrixInit(M_GetMSHandle(g_stEngineStructure.h_StdCamCaracter,3dData)),
HIE_fn_hGetSuperObjectGlobalMatrix(_hCharacterPositionTwo)
);
g_stEngineStructure.bResurection = TRUE;
}
else if(g_stEngineStructure.h_StdCamCaracter)
{
/* save initial position*/
POS_fn_vCopyMatrix
(
&g_stEngineStructure.stMainCameraPosition,
fn_p_st3dDataGetMatrixInit(M_GetMSHandle(g_stEngineStructure.h_StdCamCaracter,3dData))
);
g_stEngineStructure.bResurection = TRUE;
}
/* END ANNECY MT }*/
/* JO 27/11/97*/
SND_fn_vKillAllObjectTypeSound( g_lSoundObjectTypeAnim );
#ifdef D_USE_LIPSYNC
SND_fn_vKillAllObjectTypeSound( g_lSoundObjectTypeLipsSynchro );
#endif
fn_vChangeEngineMode(EM_ModePlayerDead);
}
/*-----------------------------------------------------------------------------
* Description : Initialisation of all object when
* the player just dead
*-----------------------------------------------------------------------------
* Input : None
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 28/02/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vInitAllObjectsWhenPlayerDead(void)
{
HIE_fn_vInitMatrixStack();
fn_vInitAllObjectsWorld(OTI_PlayerDead);
fn_vInitAlwaysModel(OTI_PlayerDead);
}
/*-----------------------------------------------------------------------------
* Description : Read the objects tree and initialize engine objects
* recursive function
*-----------------------------------------------------------------------------
* Input : Initialisation's type
* Output : None
*-----------------------------------------------------------------------------
* Creation date : 06/09/96 Author : Francois
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vInitAllObjectTree(enum tdeObjectTreeInit_ eObjIniType,HIE_tdxHandleToSuperObject p_stSupObject)
{
HIE_tdxHandleToSuperObject p_stChild;
long i;
tdstEngineObject *p_stObject;
unsigned long ulSuperObjectType;
tdxHandleToFamilyList hFamily;
MS_tdxHandleTo3dData h3dData;
/**** Calculate absolute matrix ****/
HIE_fn_vPushMatrix(p_stSupObject);
GEO_M_vCopyMatrix(HIE_fn_hGetSuperObjectGlobalMatrix(p_stSupObject),g_p_stCurrentMatrix);
HIE_fn_vInvalidateOneGlobalMatrix(p_stSupObject);
/**** We cover all tree ****/
HIE_M_ForEachChildOf(p_stSupObject,p_stChild,i)
fn_vInitAllObjectTree(eObjIniType,p_stChild);
HIE_fn_vPopMatrix();
/**** We initialize this object ****/
p_stObject = (tdstEngineObject *)HIE_fn_hGetSuperObjectObject(p_stSupObject);
ulSuperObjectType = HIE_fn_ulGetSuperObjectType(p_stSupObject);
if (p_stObject==NULL && (ulSuperObjectType & (HIE_C_ulSuperObject | HIE_C_ulNoAction)) == 0)
{
M_GameFatalError(E_uwGameInitAllObjectTreeNullPointer);
}
if (ulSuperObjectType == HIE_C_ulActor)
{
switch (eObjIniType)
{
/* ANNECY MT - 28/08/98 {*/
case OTI_ReinitTheMap:
fn_vInitOneObject(p_stObject,eObjIniType); /* always*/
break;
/* END ANNECY MT }*/
case OTI_MapLoaded:
case OTI_LoadSavedGame:
/**** Initialisation ****/
if (
( fn_eStandardGameGetInitFlagWhenDeadOrTaken(p_stObject->h_StandardGame) == OI_WhenPlayerGoOutOfActionZone
|| fn_eStandardGameGetInitFlagWhenDeadOrTaken(p_stObject->h_StandardGame) == OI_Always
|| fn_eStandardGameGetInitFlagWhenDeadOrTaken(p_stObject->h_StandardGame) == OI_WhenPlayerIsDead
|| fn_eStandardGameGetInitFlagWhenDeadOrTaken(p_stObject->h_StandardGame) == OI_WhenMapJustLoaded
|| fn_eStandardGameGetInitFlagWhenDeadOrTaken(p_stObject->h_StandardGame) == OI_WhenSavedGameJustLoaded
)
||
( fn_eStandardGameGetInitFlagWhenDeadOrTaken(p_stObject->h_StandardGame) == OI_NeverBackWhenTaken
&& !fn_bf1StandardGameGetIsDesactivateAtAll(p_stObject->h_StandardGame)
)
)
{
if (eObjIniType==OTI_LoadSavedGame&&fn_eStandardGameGetInitFlagWhenDeadOrTaken(p_stObject->h_StandardGame) == OI_WhenSavedGameJustLoaded)
fn_vInitOneObject(p_stObject,OTI_ReinitTheMap);
else
fn_vInitOneObject(p_stObject,eObjIniType);
}
else
/**** Do not initialise it ****/
{
fn_vDesinitOneObject(p_stObject,eObjIniType);
}
/* CGHT 15/05/97*/
h3dData=M_GetMSHandle(p_stSupObject,3dData);
hFamily=fn_h3dDataGetFamily(h3dData);
HIE_fn_vSetSuperObjectBoundingVolume(p_stSupObject,(void *)(hFamily->hBoundingSphere));
break;
case OTI_AlwaysCreated:
case OTI_PlayerDead:
if (
( fn_eStandardGameGetInitFlagWhenDeadOrTaken(p_stObject->h_StandardGame) == OI_WhenPlayerGoOutOfActionZone
|| fn_eStandardGameGetInitFlagWhenDeadOrTaken(p_stObject->h_StandardGame) == OI_Always
|| fn_eStandardGameGetInitFlagWhenDeadOrTaken(p_stObject->h_StandardGame) == OI_WhenPlayerIsDead
)
||
( fn_eStandardGameGetInitFlagWhenDeadOrTaken(p_stObject->h_StandardGame) == OI_NeverBackWhenTaken
&& !fn_bf1StandardGameGetIsDesactivateAtAll(p_stObject->h_StandardGame)
)
||
( fn_eStandardGameGetInitFlagWhenDeadOrTaken(p_stObject->h_StandardGame) == OI_WhenMapJustLoaded
&& !fn_bf1StandardGameGetIsDesactivateAtAll(p_stObject->h_StandardGame)
)
)
/**** Initialise it ****/
{
fn_vInitOneObject(p_stObject,eObjIniType);
}
else
/**** Do not initialise it ****/
{
fn_vDesinitOneObject(p_stObject,eObjIniType);
}
break;
default :
M_GameFatalError(E_uwGameInitAllObjectTreeBadInitType);
break;
}
/* Update Global Matrix for correct DNM Init.*/
HIE_fn_vPushMatrix(p_stSupObject);
HIE_fn_vPopMatrix();
/* Init DNM Object*/
if(M_GetMSHandle(p_stSupObject,Dynam)!=NULL)
{
fn_vDynamInit(p_stObject,eObjIniType);
}
}
}
/* Create a child for a super object*/
#ifdef ACTIVE_EDITOR
void fn_vAddChildToSuperObject(HIE_tdxHandleToSuperObject hChild,char *szFamily,char *szModel,char *szPersonal)
{
tdstEngineObject * p_stObject;
p_stObject=(tdstEngineObject*)HIE_fn_hGetSuperObjectObject(hChild);
fn_vStandardGameSetPersonalType(p_stObject->h_StandardGame,fn_otFindOrAddPersonalTypeOfPersonalTypeName(szPersonal));
fn_vStandardGameSetFamilyType(p_stObject->h_StandardGame,fn_otFindOrAddFamilyTypeOfFamilyTypeName(szFamily));
fn_vStandardGameSetModelType(p_stObject->h_StandardGame,fn_otFindOrAddModelTypeOfModelTypeName(szModel));
fn_v3dDataSetFamily(p_stObject->h_3dData,fn_hFindOrAddFAmily(fn_otStandardGameGetFamilyType(p_stObject->h_StandardGame)));
PLA_fn_vInitNewState(hChild,fn_h3dDataGetInitialState(p_stObject->h_3dData));
PLA_fn_bDoFirstInitOfAnimPlayerForCharacter(hChild,fn_h3dDataGetInitialState(p_stObject->h_3dData)->p_stAnim);
}
#endif /* ACTIVE_EDITOR */

View File

@@ -0,0 +1,295 @@
/*=========================================================================
* ObjsTbls.c : This module contain all models functions
* This is a part of the Game project.
*
* Version 1.0
* Creation date 01/04/97
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1997
*=======================================================================*/
/*******************************************************/
/**** For the structures and variables declarations ****/
/*******************************************************/
#define D_ObjsTbls_Define
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Family.h"
#include "Structur/MemGame.h"
#include "Structur/ErrGame.h"
#include "Structur/Objects.h"
#include "Structur/GameScpt.h"
#include "Structur/MemGame.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "Structur/ObjsTbls.h"
#include "ZeMem.h"
/* ************* ObjectsTablesList *************/
tdxHandleToObjectsTablesList fn_hObjectsTablesListAlloc(void)
{
tdxHandleToObjectsTablesList h_ObjectsTablesListElement;
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeTBLList , 0 );
h_ObjectsTablesListElement = (tdxHandleToObjectsTablesList)M_p_GameMallocInHLM(sizeof(struct tdstObjectsTablesList_));
h_ObjectsTablesListElement->wNumberOfElement = 0;
h_ObjectsTablesListElement->d_stObjectsTable = NULL;
#ifndef U64 //AR9904 Useless !
h_ObjectsTablesListElement->d_stInitObjectsTable = NULL;
#endif
/* ANNECY AV {*/
h_ObjectsTablesListElement->wZDxUsed = 0;
/* END ANNECY AV }*/
return(h_ObjectsTablesListElement);
}
/* ************************************************************************************************* */
/* ************************************************************************************************* */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_hObjectsTablesListFree(tdxHandleToObjectsTablesList h_ObjectsTableElement)
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeTBLList , 0 );
M_GameFreeInHLM(h_ObjectsTableElement);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/* ************************************************************************************************* */
/* ************************************************************************************************* */
void fn_vInitObjectsTablesList(struct tdstFamilyList_ *p_stFamily)
{
/* Init the List structure*/
LST2_M_StaticInitAnchor(&(p_stFamily->hForObjectsTablesList));
}
#ifndef LST2_StaticIsOptimised
void fn_vAddAnObjectsTablesInList( struct tdstFamilyList_ *p_stFamily
, tdxHandleToObjectsTablesList h_ObjectsTablesListElement)
{
LST2_M_StaticAddTail(&(p_stFamily->hForObjectsTablesList),h_ObjectsTablesListElement);
}
#else
void fn_vAddAnObjectsTablesInList( struct tdstFamilyList_ *p_stFamily, tdxHandleToObjectsTablesList h_ObjectsTablesListElement)
{
LST2_M_StaticSetNumberOfElements(&(p_stFamily->hForObjectsTablesList), 1);
LST2_M_StaticSetFirstElement(&(p_stFamily->hForObjectsTablesList),h_ObjectsTablesListElement);
}
#endif /*AR9808*/
/* ************************************************************************************************* */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vChangeObjectsTableForCharacter(HIE_tdxHandleToSuperObject p_stSuperObject, long l_Number)
{
long i;
tdxHandleToObjectsTablesList h_ObjectsTablesListElement;
if(fn_h3dDataGetCurrentObjectsTable(M_GetMSHandle(p_stSuperObject,3dData))==NULL) return;
LST2_M_StaticGetElementNumber(&(fn_h3dDataGetFamily(M_GetMSHandle(p_stSuperObject,3dData))->hForObjectsTablesList)
,h_ObjectsTablesListElement
,l_Number,i);
fn_v3dDataSetCurrentObjectsTable(M_GetMSHandle(p_stSuperObject,3dData),h_ObjectsTablesListElement);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/* ************************************************************************************************* */
/* ************************************************************************************************* */
void fn_vExchangeTwoObjectsInCurrentObjectsTable(HIE_tdxHandleToSuperObject p_stSuperObject
,unsigned short w_ObjectA ,unsigned short w_ObjectB)
{
struct tdstObjectsTableElement_ stObjectsTableElement;
if(fn_h3dDataGetCurrentObjectsTable(M_GetMSHandle(p_stSuperObject,3dData))==NULL) return;
memcpy( &stObjectsTableElement
, &(fn_h3dDataGetCurrentObjectsTable(M_GetMSHandle(p_stSuperObject,3dData))->d_stObjectsTable[w_ObjectB])
, sizeof(struct tdstObjectsTableElement_));
memcpy( &(fn_h3dDataGetCurrentObjectsTable(M_GetMSHandle(p_stSuperObject,3dData))->d_stObjectsTable[w_ObjectB])
, &(fn_h3dDataGetCurrentObjectsTable(M_GetMSHandle(p_stSuperObject,3dData))->d_stObjectsTable[w_ObjectA])
, sizeof(struct tdstObjectsTableElement_));
memcpy( &(fn_h3dDataGetCurrentObjectsTable(M_GetMSHandle(p_stSuperObject,3dData))->d_stObjectsTable[w_ObjectA])
, &stObjectsTableElement
, sizeof(struct tdstObjectsTableElement_));
}
/* ************************************************************************************************* */
/* ************************************************************************************************* */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vCopyObjectDestFromSourceOfObjectsTable(HIE_tdxHandleToSuperObject p_stSuperObject
,unsigned short w_ObjectDest ,unsigned short w_ObjectSource)
{
if(fn_h3dDataGetCurrentObjectsTable(M_GetMSHandle(p_stSuperObject,3dData))==NULL) return;
memcpy( &(fn_h3dDataGetCurrentObjectsTable(M_GetMSHandle(p_stSuperObject,3dData))->d_stObjectsTable[w_ObjectDest])
, &(fn_h3dDataGetCurrentObjectsTable(M_GetMSHandle(p_stSuperObject,3dData))->d_stObjectsTable[w_ObjectSource])
, sizeof(struct tdstObjectsTableElement_));
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/* ************************************************************************************************* */
/* ************************************************************************************************* */
void fn_vCopyObjectFromObjectTabletoAnother(
tdxHandleToObjectsTablesList _hTargetTable,
tdxHandleToObjectsTablesList _hSourceTable,
unsigned short _uwTargetObject,
unsigned short _uwSourceObject
)
{
if ( _hTargetTable == NULL || _hSourceTable == NULL ) return;
_hTargetTable->d_stObjectsTable[_uwTargetObject] = _hSourceTable->d_stObjectsTable[_uwSourceObject];
}
/* ************************************************************************************************* */
/* ************************************************************************************************* */
unsigned short fn_uwGetObjectTableNumberOfelements(tdxHandleToObjectsTablesList _hTargetTable)
{
if ( _hTargetTable )
return _hTargetTable->wNumberOfElement;
else
return 0;
}
/* ************************************************************************************************* */
/* ************************************************************************************************* */
/* ************* ObjectsTables *************/
void fn_vObjectsTablesAlloc(tdxHandleToObjectsTablesList h_ObjectsTablesListElement,unsigned short wNumberOfElement)
{
unsigned long i;
h_ObjectsTablesListElement->wNumberOfElement = wNumberOfElement;
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeTBLElement , 0 );
h_ObjectsTablesListElement->d_stObjectsTable
= (struct tdstObjectsTableElement_ *)M_p_GameMallocInHLM(wNumberOfElement*sizeof(struct tdstObjectsTableElement_));
#ifndef U64 //AR9904 Useless !
h_ObjectsTablesListElement->d_stInitObjectsTable = NULL;
#endif
for ( i = 0; i < wNumberOfElement; i ++ )
h_ObjectsTablesListElement->d_stObjectsTable[i].wTypeOfTarget = C_wTdO_Undefined;
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vDuplicateObjectTable(tdxHandleToObjectsTablesList hObjTableList)
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeTBLElement , 0 );
hObjTableList->d_stInitObjectsTable
= (struct tdstObjectsTableElement_ *)M_p_GameMallocInHLM(hObjTableList->wNumberOfElement*sizeof(struct tdstObjectsTableElement_));
memcpy(hObjTableList->d_stInitObjectsTable,hObjTableList->d_stObjectsTable,sizeof(struct tdstObjectsTableElement_)*hObjTableList->wNumberOfElement);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vReInitObjectTable(tdxHandleToObjectsTablesList hObjTableList)
{
memcpy(hObjTableList->d_stObjectsTable,hObjTableList->d_stInitObjectsTable,sizeof(struct tdstObjectsTableElement_)*hObjTableList->wNumberOfElement);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/* ***** ACCESS FUNCTIONS BY HANDLES ***** */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
tdxHandleToObjectsTableElement fn_d_hGetObjectsTable(tdxHandleToObjectsTablesList h_ObjectsTablesListElement)
{
return(h_ObjectsTablesListElement->d_stObjectsTable);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
tdxHandleToObjectsTableElement fn_d_hGetInitObjectsTable(tdxHandleToObjectsTablesList h_ObjectsTablesListElement)
{
return(h_ObjectsTablesListElement->d_stInitObjectsTable);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
tdxHandleToObjectsTableElement fn_d_hGetElementByNumberInObjectsTable(tdxHandleToObjectsTablesList h_ObjectsTablesListElement
,unsigned short wNumberInTable)
{
return(&(h_ObjectsTablesListElement->d_stObjectsTable[wNumberInTable]));
}
/* *** TypeOfTarget*/
unsigned short fn_wObjectsTableGetTypeOfTarget(tdxHandleToObjectsTableElement h_ObjectsTablesElement)
{
return(h_ObjectsTablesElement->wTypeOfTarget);
}
void fn_vObjectsTableSetTypeOfTarget(tdxHandleToObjectsTableElement h_ObjectsTablesElement
,unsigned short wTypeOfTarget)
{
h_ObjectsTablesElement->wTypeOfTarget = wTypeOfTarget;
}
/* *** h_Target*/
tdxHandleToVoid fn_hObjectsTableGetTarget(tdxHandleToObjectsTableElement h_ObjectsTablesElement)
{
return(h_ObjectsTablesElement->h_Target);
}
void fn_vObjectsTableSetTarget(tdxHandleToObjectsTableElement h_ObjectsTablesElement
,tdxHandleToVoid h_Target)
{
h_ObjectsTablesElement->h_Target = h_Target;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*
// MR0707
void fn_vSetObjectTableListDuplicate(tdxHandleToObjectsTablesList hObjTableList,BOOL bDuplicate)
{
hObjTableList->bDuplicateTable=bDuplicate;
}
BOOL fn_bGetObjectTableListDuplicate(tdxHandleToObjectsTablesList hObjTableList)
{
return hObjTableList->bDuplicateTable;
}
// End MR0707
*/
/* ANNECY AV {*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
ACP_tdxBool fn_bObjectTableHasZdd (tdxHandleToObjectsTablesList _hObjectTableList)
{
return (ACP_tdxBool) ((_hObjectTableList -> wZDxUsed & C_wObjectTableHasZdd) != 0);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
ACP_tdxBool fn_bObjectTableHasZde (tdxHandleToObjectsTablesList _hObjectTableList)
{
return (ACP_tdxBool) ((_hObjectTableList -> wZDxUsed & C_wObjectTableHasZde) != 0);
}
/* END ANNECY AV }*/

View File

@@ -0,0 +1,118 @@
/*=========================================================================
* CHLLoad.c : Loading CHL Files
*
* Version 1.0
* Creation date 29/05/97
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1997
*=======================================================================*/
#if defined (WIN32)
#include <stdio.h>
#endif /* WIN32 */
/* to be Friend*/
#define D_State_Define
#include "ToolsCPA.h"
/*#include "Options/Options.h"*/
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/3DOSLkTb.h"
#include "Structur/Objects.h"
#include "Structur/ErrGame.h"
#include "Structur/GameScpt.h"
#include "Structur/MemGame.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "Basic.h"
#include "Family.h"
#include "ObjType.h"
#include "ZeMem.h"
#include "CHLLoad.h"
/* global for CHL Link Table*/
SCR_tdst_Link_Table CHL_g_stLinkTable;
/*-----------------------------------------------------------------------------
* Description : initialize and close link table for CHL
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : 29/05/97 Author : Sebastien DAVID (G<>zmo)
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
SCR_tdst_Link_Table *CHL_fn_p_stGetLinkTable(void)
{
return(&CHL_g_stLinkTable);
}
void CHL_fn_vInitLinkTable(void)
{
SCR_fn_v_Link_InitTable(&CHL_g_stLinkTable);
}
void CHL_fn_vCloseLinkTable(void)
{
SCR_fn_v_Link_CloseTable(&CHL_g_stLinkTable);
}
/*-----------------------------------------------------------------------------
* Description : Used to register all script callback functions
*-----------------------------------------------------------------------------
* Creation date : 29/05/97 Author : Sebastien DAVID (G<>zmo)
*-----------------------------------------------------------------------------*/
void CHL_fn_vRegisterAllScriptSections(void)
{
SCR_fn_v_RdL0_RegisterCallback(C_Section_CHLGeneral, CHL_fn_eScriptCallBackGeneral,SCR_CRC_c_RdL0_ForSection);
}
/*-----------------------------------------------------------------------------
* Description : call-back for general section of CHL script file
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : 29/05/97 Author : Sebastien DAVID (G<>zmo)
*-----------------------------------------------------------------------------*/
SCR_tde_Anl_ReturnValue CHL_fn_eScriptCallBackGeneral(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;
char sz_ForLinkTable[MAX_PATH];
long lChannelNumber;
struct tdstFamilyList_ *p_stFamily;
if ( M_IsTitle )
{
SCR_M_RdL0_GetContextLong(C_ThisContext,0,struct tdstFamilyList_ *,p_stFamily);
p_stFamily->ulNumberOfChannels = fn_lAToI(_ap_szParams[0]);
SCR_M_RdL0_SetSectionLong(C_ThisSection,0,fn_lAToI(_p_szName));
SCR_M_RdL0_SetContextLong(C_ThisContext,1,0); /*counter*/
}
else if ( M_IsEntry )
{
SCR_M_RdL0_GetContextLong(C_ThisContext,0,struct tdstFamilyList_ *,p_stFamily);
strcpy(sz_ForLinkTable,fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType));
strcat(sz_ForLinkTable,"-");
strcat(sz_ForLinkTable,_ap_szParams[0]);
SCR_M_RdL0_GetContextLong(C_ThisContext,1,long,lChannelNumber);
SCR_fnp_st_Link_SetValue(&CHL_g_stLinkTable,sz_ForLinkTable,lChannelNumber);
lChannelNumber++;
SCR_M_RdL0_SetContextLong(C_ThisContext,1,lChannelNumber); /*counter*/
}
return ( eReturnValue );
}

View File

@@ -0,0 +1,230 @@
/*=========================================================================
* LoadAni.c : Loading Animations Files
* This is a part of the Game project.
*
* Version 1.0
* Creation date 18/10/96
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1996
*=======================================================================*/
#define D_ObjsTbls_Define
#include "ToolsCPA.h"
#include "Main.h"
#include "Options/Def_Snd.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Structur/Anim_s.h"
#include "Structur/ErrGame.h"
#include "Structur/GameScpt.h"
#include "Structur/MemGame.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "Structur/3DOSLkTb.h"
/* For interpolated animations*/
#include "ChanList.h"
#include "PlayAnim/Interpol/a3x_intn.h"
#include "PlayAnim/playevts.h"
#include "Family.h"
#include "ObjType.h"
#include "Basic.h"
#include "LoadAni.h"
#include "playanim/playanim.h"
#include "Macros.h"
#include "ZeMem.h"
#include "Physicol.h"
#include "PO.h"
#include "Structur/ObjsTbls.h"
#include "CHLLoad.h"
/* current animation file version*/
#define C_AnimationFileVersion 6
unsigned short g_uwCurrentFrame; /* MR2307*/
BOOL g_abActiveStatus[255]; /* MR2307*/
tdstAnim3d *g_p_stCurrentAnim; /* MR2908*/
ACP_tdxBool GAM_g_bIsFirstAnim=TRUE;
/*-----------------------------------------------------------------------------
* Description : initialize link table that will contain all link between
* animation name and pointer to animation
*-----------------------------------------------------------------------------
* Input : none
* Output : void
*-----------------------------------------------------------------------------
* Creation date : 25/02/97 Author : VL
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vInitAnimationLinkTable( void )
{
SCR_fn_v_Link_InitTable(&g_st3DOSLinkTable.stAnimation);
}
/*-----------------------------------------------------------------------------
* Description : Close link table
* animation name and pointer to animation
*-----------------------------------------------------------------------------
* Input : none
* Output : void
*-----------------------------------------------------------------------------
* Creation date : 29/05/97 Author : SD
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
void fn_vCloseAnimationLinkTable( void )
{
SCR_fn_v_Link_CloseTable(&g_st3DOSLinkTable.stAnimation);
}
void fn_vDeleteAnimationLinkTable(unsigned char ucMin,unsigned char ucMax)
{
SCR_fn_v_Link_DeleteEntryWithPriority(&g_st3DOSLinkTable.stAnimation,ucMin,ucMax);
}
/*-----------------------------------------------------------------------------
* Description : return Animation link table for use outside this module
*-----------------------------------------------------------------------------
* Input : none
* Output : SCR_tdst_Link_Table *
*-----------------------------------------------------------------------------
* Creation date : 25/02/97 Author : VL
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
SCR_tdst_Link_Table *fnp_stGetAnimationLinkTable( void )
{
return (&g_st3DOSLinkTable.stAnimation);
}
/*-----------------------------------------------------------------------------
* Description : Update the pointers into array of events of an animation
* Must be called after the load process of an A3i
* Sort Event to have Never Play at the beginning
*-----------------------------------------------------------------------------
* Input : _p_stAnim : The animation to process
* _h_ObjectsTablesListElement : The objects table containing
* the events
* Output :
*-----------------------------------------------------------------------------
* Creation date : Feb 98 Author : Al1
* Modif 08/10/98 : Sort Event - Carlos Torres
*-----------------------------------------------------------------------------*/
void GAM_fn_vUpdateEventArrayOfAnimation(struct tdstAnim3d_* _p_stAnim, tdxHandleToObjectsTablesList _h_ObjectsTablesListElement) {
int i;
tdstEvent * p_stEvent, * p_stEventNeverPlay;
/* set TBL Event & put Never Play Event at the beggining*/
for(i=0,p_stEvent=NULL,p_stEventNeverPlay=_p_stAnim->d_stAnimEvent;i<_p_stAnim->ucNumberOfEvents;++i,p_stEventNeverPlay++) {
/* set the tbl event*/
p_stEventNeverPlay->p_stfEventInTBL=
(tdstEventInTable*)_h_ObjectsTablesListElement->d_stObjectsTable[p_stEventNeverPlay->usEventNumberInTBL].h_Target;
/* blindage*/
#ifdef _DEBUG
if (!p_stEventNeverPlay->p_stfEventInTBL) {
char szMessage[50];
sprintf(szMessage,"Problem with event (element %d in TBL) - try to rebuild A3i file",p_stEventNeverPlay->usEventNumberInTBL+1);
Erm_M_UpdateLastError( Game, C_ucErmDefaultChannel, E_uwGameErrorWhileLoadingAnimation,
C_lErmNoDebugData,C_ucErmOpenInfoWindow, C_ucAllowStopForDebug,szMessage);
}
#endif
/* found first non never play event*/
if (!p_stEvent && (GAM_fn_ucGetFirstCallOfEvent(p_stEventNeverPlay) != C_ucNeverPlay))
p_stEvent = p_stEventNeverPlay;
/* found a never play */
else if (GAM_fn_ucGetFirstCallOfEvent(p_stEventNeverPlay) == C_ucNeverPlay) {
/* set the frame & channel to 0*/
p_stEventNeverPlay->uwChannelNumber = p_stEventNeverPlay->uwFrameNumber = 0;
/* there is a non never play before*/
if (p_stEvent) {
tdstEvent * p_stTmpEvent;
/* we move up the never play event until the first non never play*/
for(p_stTmpEvent = p_stEventNeverPlay-1;p_stTmpEvent >= p_stEvent;p_stTmpEvent--) {
/* permute Event*/
tdstEvent stEvent = *(p_stTmpEvent+1);
*(p_stTmpEvent+1) = *p_stTmpEvent;
*p_stTmpEvent = stEvent;
}
/* now the fisrt non never play has moved 1 place down*/
p_stEvent++;
}
}
}
}
/*----------------------------------------------------------------------------
// Description : fn_vAddAnimIntoA3bLinkTable
----------------------------------------------------------------------------//
// Methods : None
----------------------------------------------------------------------------//
// Input : _p_stAnim : pointer to the animation loaded
// _szAnimFileName : Name of the animation file
// Output :
----------------------------------------------------------------------------//
// Creation date : Jun 97 Author: Alain Robin
----------------------------------------------------------------------------//
// Modifications :
// Modification date : Modification author :
----------------------------------------------------------------------------*/
void fn_vAddAnimIntoA3bLinkTable(tdstAnim3d* _p_stAnim, char* _szAnimFileName)
{
char szCompleteName[256];
SCR_tdst_Link_Table* p_stAnimationLinkTable=NULL;
p_stAnimationLinkTable=fnp_stGetAnimationLinkTable();
strcpy(szCompleteName,_szAnimFileName);
szCompleteName[strlen(szCompleteName)-1]='d';
SCR_fnp_st_Link_SetValue(p_stAnimationLinkTable,szCompleteName,(unsigned long)_p_stAnim);
}
/*----------------------------------------------------------------------------
// Description : fn_p_stGetAnimIntoA3bLinkTable
----------------------------------------------------------------------------//
// Methods : None
----------------------------------------------------------------------------//
// Input : _szAnimFileName : Name of the animation file
// Output : NULL if the anim isn't already loaded the pointer instead
----------------------------------------------------------------------------//
// Creation date : Jun 97 Author: Alain Robin
----------------------------------------------------------------------------//
// Modifications :
// Modification date : Modification author :
----------------------------------------------------------------------------*/
tdstAnim3d* fn_p_stGetAnimIntoA3bLinkTable(char* _szAnimFileName)
{
SCR_tdst_Link_Value *p_stLinkValue;
SCR_tdst_Link_Table* p_stAnimationLinkTable=NULL;
char szCompleteName[256];
strcpy(szCompleteName,_szAnimFileName);
szCompleteName[strlen(szCompleteName)-1]='d';
p_stAnimationLinkTable=fnp_stGetAnimationLinkTable();
p_stLinkValue=SCR_fnp_st_Link_SearchKey(p_stAnimationLinkTable,szCompleteName);
if(p_stLinkValue!=NULL)
return (tdstAnim3d*)(p_stLinkValue->ulValue);
else
return NULL;
}

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,345 @@
#ifdef D_USE_LIPSYNC
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/3DOSLkTb.h"
#include "Structur/Objects.h"
#include "Structur/ErrGame.h"
#include "Structur/GameScpt.h"
#include "Structur/MemGame.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "Basic.h"
#include "Family.h"
#include "ZeMem.h"
#include "ObjType.h"
#include "CHLLoad.h"
#include "LipsSync.h"
#include "LoadLSyn.h"
/* MR0912*/
#include "LSMem.h"
/* For BIN*/
#include "SNA.h"
/* MR3006*/
tdxHandleOfLipsSynchroTable g_hLipsTable;
#if defined(ACTIVE_EDITOR)
SCR_tdst_Link_Table *fn_p_stGetLipsSynchroLinkTable()
{
return &g_st3DOSLinkTable.stLipsSynchroList;
}
#endif /* ACTIVE_EDITOR */
SCR_tde_Anl_ReturnValue fn_xLoadLSGeneral(SCR_tdst_File_Description *p_fFile, char *szAction, char *szParams[], SCR_tde_Anl_Action cType)
{
/* SCR_tdst_Cxt_Values *p_stValues;*/
tdxHandleOfLipsSynchroTable hLSTable;
char szForScript[_MAX_PATH];
char szFileName[_MAX_PATH];
char szSectionName[_MAX_PATH];
SND_tdstBlockEvent *p_stSndEvent;
#if defined(ACTIVE_EDITOR)
char a255_cLinkKey[255];
#endif /* ACTIVE_EDITOR */
switch (cType)
{
case SCR_EA_Anl_BeginSection:
hLSTable=fn_xAllocateLipsSynchroTable();
/* Fix the context*/
SCR_M_RdL0_SetSectionLong(0,0,(long)hLSTable);
SCR_M_RdL0_SetContextLong(0,0,(long)hLSTable);
/* Link table*/
strcpy(szSectionName,"*^");
strcat(szSectionName,C_SectionA3dLSData);
fn_v_File_ComputeFileSectionName(szSectionName,szFileName,szForScript/*+strlen(szForScript)*/);
#if defined(ACTIVE_EDITOR)
SCR_M_RdL0_ComputeOpenSectionNameR(0,a255_cLinkKey);
SCR_fnp_st_Link_CreateOrGetLinkFromKey( &g_st3DOSLinkTable.stLipsSynchroList, a255_cLinkKey);
SCR_fnp_st_Link_SetValue(&g_st3DOSLinkTable.stLipsSynchroList, a255_cLinkKey,(unsigned long)hLSTable);
#endif /* ACTIVE_EDITOR */
fn_vLSResetChannelSync(hLSTable);
break;
case SCR_EA_Anl_Entry:
/* Read the entries*/
SCR_M_RdL0_GetContextLong(0,0,tdxHandleOfLipsSynchroTable,hLSTable);
if (!stricmp(szAction,C_EntryNumberOfFrames))
{ int i;
hLSTable->lNumberOfFrames=(long)atoi(szParams[0]);
hLSTable->p_stTable=fn_xAllocateLipsSynchroEvents(hLSTable->lNumberOfFrames);
for (i=0;i<hLSTable->lNumberOfFrames;i++)
{ hLSTable->p_stTable[i].ucPhoneme=255;
hLSTable->p_stTable[i].ucIntensity=0;
hLSTable->p_stTable[i].ucExpression=0;
}
}
else if (!strcmp(szAction,C_EntryLSSpeed))
{
fn_vLSSetSpeed(hLSTable,(long)atoi(szParams[0]));
}
else if(!strcmp(szAction,C_EntryLSSound)) /* MR0107*/
{ SCR_tdst_Cxt_Values *p_stVal;
p_stVal = SCR_fnp_st_RdL0_AnalyseSection(szParams[0], SCR_CDF_uw_Anl_Normal);
p_stSndEvent=(SND_tdstBlockEvent*)SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
hLSTable->p_stSndEvent=p_stSndEvent;
}
else if(!strcmp(szAction,C_EntryLSStopSound)) /* MR0808*/
{
p_stSndEvent=(SND_tdstBlockEvent*)SCR_M_ul_RdL0_ExtractLongValue(((SCR_tdst_Cxt_Values**)szParams[1])[0], 0);
/* For BIN*/
if (SNA_fn_ucGetLoadType()==SNA_SAVE_SNAPSHOT) /* MR0912*/
/* we save the id of the sound event and the pointer on the structure that contains the id and the pointer of the sound event*/
SNA_fn_vWriteSoundEntryInSoundTableFile(SND_fn_ulGetEventBinIdFromPointer((SND_tdxHandleToSoundEvent)p_stSndEvent) ,(unsigned long)&(hLSTable->p_stSndEventStop));
hLSTable->p_stSndEventStop=p_stSndEvent;
}
else if(!strcmp(szAction,C_EntryLSChannelNumber)) /* MR0207*/
{ char sz_ForLinkTable[MAX_PATH];
struct tdstFamilyList_ *p_stFamily = NULL;
SCR_tdst_Link_Value * _p_stLinkValue;
short wChannelNumber = 0;
SCR_M_RdL0_GetContextLong(C_ThisContext,1,struct tdstFamilyList_ *,p_stFamily);
strcpy(sz_ForLinkTable,fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType));
strcat(sz_ForLinkTable,"-");
strcat(sz_ForLinkTable,szParams[0]);
_p_stLinkValue = SCR_fnp_st_Link_SearchKey(&CHL_g_stLinkTable,sz_ForLinkTable);
if(_p_stLinkValue)
{
wChannelNumber = (unsigned short)SCR_M_ul_Link_GetValue(_p_stLinkValue);
}
fn_vLSAddChannelSync(hLSTable,(unsigned char)wChannelNumber);
}
else if(!strcmp(szAction,C_EntryNumberOfActings)) /* MR2008*/
{ int i;
hLSTable->lNumberOfActings=(long)atoi(szParams[0]);
hLSTable->p_stActing=fn_xAllocateActing(hLSTable->lNumberOfActings);
for (i=0;i<hLSTable->lNumberOfActings;i++)
{ hLSTable->p_stActing[i].hNewState=NULL;
hLSTable->p_stActing[i].lFrameNumber=-1;
}
}
break;
case SCR_EA_Anl_EndSection:
break;
}
return SCR_ERV_Anl_NormalReturn;
}
SCR_tde_Anl_ReturnValue fn_xLoadLSData(SCR_tdst_File_Description *p_fFile, char *szAction, char *szParams[], SCR_tde_Anl_Action cType)
{
SCR_tdst_Cxt_Values *p_stValues;
tdxHandleOfLipsSynchroTable hLSTable;
char szSectionName[255];
unsigned char ucLastPhoneme = 0,ucLastIntensity = 0,ucLastExpression = 0;
int i;
switch (cType)
{
case SCR_EA_Anl_BeginSection:
strcpy(szSectionName,p_fFile->a_szFileName);
strcat(szSectionName,"^");
strcat(szSectionName,C_SectionA3dLSGeneral);
p_stValues = SCR_fnp_st_RdL0_AnalyseSection(szSectionName, SCR_CDF_uw_Anl_Normal);
hLSTable=(tdxHandleOfLipsSynchroTable)(p_stValues->a_ulValues[0]);
SCR_M_RdL0_SetSectionLong(0,0,(long)hLSTable);
SCR_M_RdL0_SetContextLong(0,0,(long)hLSTable);
break;
case SCR_EA_Anl_Entry:
/* Read the entries*/
SCR_M_RdL0_GetContextLong(0,0,tdxHandleOfLipsSynchroTable,hLSTable);
if (!stricmp(szAction,C_EntryLSMouth))
fn_vLSSetPhoneme(hLSTable,atoi(szParams[0]),(unsigned char)(szParams[1][0]-'A'));
else if (!strcmp(szAction,C_EntryLSIntensity))
fn_vLSSetIntensity(hLSTable,atoi(szParams[0]),(unsigned char)atoi(szParams[1]));
else if (!strcmp(szAction,C_EntryLSExpression))
if (!stricmp(szParams[1],"Neutral"))
fn_vLSSetExpression(hLSTable,atoi(szParams[0]),0);
break;
case SCR_EA_Anl_EndSection:
SCR_M_RdL0_GetContextLong(0,0,tdxHandleOfLipsSynchroTable,hLSTable);
/* MR1908*/
if (hLSTable->lNumberOfTexts)
SCR_fnp_st_RdL0_AnalyseSection("*^Text", SCR_CDF_uw_Anl_Normal);
if (hLSTable->lNumberOfActings)
SCR_fnp_st_RdL0_AnalyseSection("*^Acting", SCR_CDF_uw_Anl_Normal);
for (i=0;i<fn_lLSGetNumberOfFrame(hLSTable);i++)
if (fn_ucLSGetPhoneme(hLSTable,i)==255)
{ fn_vLSSetPhoneme(hLSTable,i,ucLastPhoneme);
fn_vLSSetIntensity(hLSTable,i,ucLastIntensity);
fn_vLSSetExpression(hLSTable,i,ucLastExpression);
}
else
{ ucLastPhoneme=fn_ucLSGetPhoneme(hLSTable,i);
ucLastIntensity=fn_ucLSGetIntensity(hLSTable,i);
ucLastExpression=fn_ucLSGetExpression(hLSTable,i);
}
break;
}
return SCR_ERV_Anl_NormalReturn;
}
SCR_tde_Anl_ReturnValue fn_xLoadLSTextDial(SCR_tdst_File_Description *p_fFile, char *szAction, char *szParams[], SCR_tde_Anl_Action cType)
{
SCR_tdst_Cxt_Values *p_stValues;
tdxHandleOfLipsSynchroTable hLSTable;
char szSectionName[255];
static int i=0;
struct tdstDialText_ *p_stText;
switch (cType)
{
case SCR_EA_Anl_Entry:
/* Read the entries*/
SCR_M_RdL0_GetContextLong(0,0,tdxHandleOfLipsSynchroTable,hLSTable);
if (!stricmp(szAction,C_EntryDisplayText))
{
strcpy(szSectionName,fn_szGetSyncLipsDataPath());
strcat(szSectionName,"\\Text\\");
strcat(szSectionName,szParams[1]);
p_stValues = SCR_fnp_st_RdL0_AnalyseSection(szSectionName, SCR_CDF_uw_Anl_Normal);
p_stText=(struct tdstDialText_ *)(p_stValues->a_ulValues[0]);
memcpy(&(hLSTable->p_stDialTexts[i]),p_stText,sizeof(struct tdstDialText_));
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeLipSynchro , 0 );
TMP_M_Free(p_stText);
hLSTable->p_stDialTexts[i].lFrameNumber=atoi(szParams[0]);
i++;
}
break;
case SCR_EA_Anl_EndSection:
i=0;
break;
}
return SCR_ERV_Anl_NormalReturn;
}
SCR_tde_Anl_ReturnValue fn_xLoadLSActing(SCR_tdst_File_Description *p_fFile, char *szAction, char *szParams[], SCR_tde_Anl_Action cType)
{
SCR_tdst_Cxt_Values *p_stValues;
tdxHandleOfLipsSynchroTable hLSTable;
char szSectionName[255];
static int i=0;
struct tdstActing_ *p_stActing;
switch (cType)
{
case SCR_EA_Anl_Entry:
/* Read the entries*/
SCR_M_RdL0_GetContextLong(0,0,tdxHandleOfLipsSynchroTable,hLSTable);
if (!stricmp(szAction,C_EntryActingFlag))
{
strcpy(szSectionName,fn_szGetSyncLipsDataPath());
strcat(szSectionName,"\\Acting\\");
strcat(szSectionName,szParams[1]);
p_stValues = SCR_fnp_st_RdL0_AnalyseSection(szSectionName, SCR_CDF_uw_Anl_Normal);
p_stActing=(struct tdstActing_ *)(p_stValues->a_ulValues[0]);
memcpy(&(hLSTable->p_stActing[i]),p_stActing,sizeof(struct tdstActing_));
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeLipSynchro , 0 );
TMP_M_Free(p_stActing);
hLSTable->p_stActing[i].lFrameNumber=atoi(szParams[0]);
i++;
}
break;
case SCR_EA_Anl_EndSection:
i=0;
break;
}
return SCR_ERV_Anl_NormalReturn;
}
SCR_tde_Anl_ReturnValue fn_xLoadTextDial(SCR_tdst_File_Description *p_fFile, char *szAction, char *szParams[], SCR_tde_Anl_Action cType)
/* read the DIA files*/
{
static int i=0;
struct tdstDialText_ *p_stText;
switch (cType)
{ case SCR_EA_Anl_BeginSection:
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeLipSynchro , 0 );
p_stText=TMP_M_p_Malloc(sizeof(struct tdstDialText_));
/* Fix the context*/
SCR_M_RdL0_SetSectionLong(0,0,(long)p_stText);
SCR_M_RdL0_SetContextLong(0,0,(long)p_stText);
break;
case SCR_EA_Anl_Entry:
/* Read the entries*/
SCR_M_RdL0_GetContextLong(0,0,struct tdstDialText_ *,p_stText);
if (!stricmp(szAction,C_EntryPosition))
{
p_stText->xPosX=(MTH_tdxReal)atof(szParams[0]);
p_stText->xPosY=(MTH_tdxReal)atof(szParams[1]);
}
break;
}
return SCR_ERV_Anl_NormalReturn;
}
/* End MR1908*/
SCR_tde_Anl_ReturnValue fn_xLoadActing(SCR_tdst_File_Description *p_fFile, char *szAction, char *szParams[], SCR_tde_Anl_Action cType)
/* read the ACT files*/
{
struct tdstActing_ *p_stActing;
switch (cType)
{ case SCR_EA_Anl_BeginSection:
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeLipSynchro , 0 );
p_stActing=TMP_M_p_Malloc(sizeof(struct tdstActing_));
/* Fix the context*/
SCR_M_RdL0_SetSectionLong(0,0,(long)p_stActing);
SCR_M_RdL0_SetContextLong(0,0,(long)p_stActing);
break;
case SCR_EA_Anl_Entry:
/* Read the entries*/
SCR_M_RdL0_GetContextLong(0,0,struct tdstActing_ *,p_stActing);
if (!stricmp(szAction,C_EntryNewState))
{ char szSectionName[255];
SCR_tdst_Link_Value * _p_stLinkValue;
strcpy(szSectionName,fn_szGetFamiliesDataPath());
strcat(szSectionName,"\\"); strcat(szSectionName,szParams[0]);
_p_stLinkValue = SCR_fnp_st_Link_SearchKey(&g_st3DOSLinkTable.stState,szSectionName);
p_stActing->hNewState = (tdxHandleToState)SCR_M_ul_Link_GetValue(_p_stLinkValue);
}
break;
}
return SCR_ERV_Anl_NormalReturn;
}
void fn_vLipsSynchroLoadInit()
{
SCR_fn_v_RdL0_RegisterCallback(C_SectionA3dLSGeneral, fn_xLoadLSGeneral, SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(C_SectionA3dLSData, fn_xLoadLSData, SCR_CRC_c_RdL0_ForSection);
/* MR1908*/
SCR_fn_v_RdL0_RegisterCallback(C_SectionTextDial, fn_xLoadLSTextDial, SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(C_SectionLSActing, fn_xLoadLSActing, SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(C_SectionDialogue, fn_xLoadTextDial, SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(C_SectionActing, fn_xLoadActing, SCR_CRC_c_RdL0_ForSection);
}
#endif /* D_USE_LIPSYNC*/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,831 @@
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "macros.h"
#include "Main.h"
#include "Actions/AllActs.h"
#include "Structur/GameScpt.h"
#include "Structur/ErrGame.h"
#include "Structur/Objects.h"
#include "Structur/MemGame.h"
#include "Structur/EngMode.h"
#include "Structur/Input_s.h"
#include "Engine.h"
#include "ZeMem.h"
#include "LoadGame.h"
#include "Input.h"
#include "Basic.h"
#include "GamOpt.h"
#include "LoadBin.h"
#include "sna.h"
#ifndef U64
extern char g_cCDROM;
extern int g_iComplete;
#endif
extern char g_sLanguage[255];
#define LDT_SCR_HYBRID_VERSION /* this is for script/ldt interfacing*/
/* MLT CC BEGIN 9/23/98 */
#ifdef CPA_USES_LDT
#include "ldt.h"
/*BEGIN FS 8/27/98*/
/*----------------------------------------------------------------------
* Description: Callback for DirectoriesDescription section from .dsc sript file
* This section describs the directories scripts
*----------------------------------------------------------------------
* Input:
* Output:
*----------------------------------------------------------------------
* Author: FS
* Creation date:8/27/98
* Modif date:
*----------------------------------------------------------------------*/
int LoadDirectoriesDescription( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
char szFileName[_MAX_PATH];
char szPath[_MAX_PATH];
static char szInventorDirectory[_MAX_PATH];
char a256_cDataDirectory[_MAX_PATH];
char *szEntryName;
/*Working for BeginSection*/
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteNoParamEntryToCurrentDscFile( SNA_C_ul_DirectoryDescTitle );
/* Working for Entries*/
result=LDT_GetNextEntry();
while( result!=ParseResult_EndSection )
{
szEntryName=LDT_szGetEntryName();
switch (*(long*)(szEntryName+ 11 /*"DirectoryOf"*/))
{
case 'ignE': /*"EngineDLL"*/
fn_vSetEngineDLLPath(LDT_szGetParam(1));
if (SNA_M_bTestSaveGameDesc())
SNA_fn_vWriteStringEntryToCurrentDscFile(SNA_C_ul_DirectoryOfEngineDLL,LDT_szGetParam(1));
break;
case 'emaG': /*"GameData"*/
/* MLT CC BEGIN 10/6/98 */
/* if(g_iComplete)*/
/* {*/
LDT_AddBaseDirectory(LDT_szGetParam(1));
LDT_AddBaseDirectory(gsz_Version);
LDT_AddBaseDirectory(gsz_Version1);
/* }*/
if(!g_iComplete)
{
sprintf(szPath,"%c:\\%s",g_cCDROM,LDT_szGetParam(1));
LDT_AddBaseDirectory(szPath);
sprintf(szPath,"%c:\\%s",g_cCDROM,gsz_Version);
LDT_AddBaseDirectory(szPath);
sprintf(szPath,"%c:\\%s",g_cCDROM,gsz_Version1);
LDT_AddBaseDirectory(szPath);
}
LDT_RegisterPath("", "DSC FIX PGB MEM TXT RND");
#ifdef LDT_SCR_HYBRID_VERSION
SCR_fn_v_RdL0_RegisterPath(LDT_szGetParam(1));
#endif
/* MLT CC END 10/6/98 */
if (SNA_M_bTestSaveGameDesc())
SNA_fn_vWriteStringEntryToCurrentDscFile(SNA_C_ul_DirectoryOfGameData,LDT_szGetParam(1));
break;
case 'txeT':
if ((*(long*)(szEntryName+12 /*"DirectoryOfT"*/))=='stxe')
{ /*"Texts"*/
/* MLT CC BEGIN 10/6/98 */
LDT_RegisterPath(LDT_szGetParam(1), "TXT");
sprintf(szPath,"%s\\%s",LDT_szGetParam(1),g_sLanguage);
LDT_RegisterPath(szPath, "TXT");
/* MLT CC END 10/6/98 */
#ifdef LDT_SCR_HYBRID_VERSION
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
strcat(a256_cDataDirectory,LDT_szGetParam(1));
fn_vSetTextsDataPath(a256_cDataDirectory);
SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);
sprintf(szPath,"%s\\%s",a256_cDataDirectory,g_sLanguage);
/*SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);*/
SCR_fn_v_RdL0_RegisterPath(szPath);
#endif
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteStringEntryToCurrentDscFile(SNA_C_ul_DirectoryOfTexts,LDT_szGetParam(1));
}
else
{ /*"Texture"*/
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
strcat(a256_cDataDirectory,LDT_szGetParam(1));
fn_vSetTexturesDataPath(a256_cDataDirectory);
GLI_vSetPathOfTexture(fn_szGetTexturesDataPath());
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteStringEntryToCurrentDscFile(SNA_C_ul_DirectoryOfTexture,LDT_szGetParam(1));
}
break;
case 'lroW': /*"World"*/
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
strcat(a256_cDataDirectory,LDT_szGetParam(1));
fn_vSetWorldDataPath(a256_cDataDirectory);
#ifdef LDT_SCR_HYBRID_VERSION
SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);
#endif
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteStringEntryToCurrentDscFile(SNA_C_ul_DirectoryOfWorld,LDT_szGetParam(1));
break;
case 'eveL': /*"Levels"*/
LDT_RegisterPath(LDT_szGetParam(1),"ALW CAR DSC GMT IPO LGT LVL MDF MEM MOD PGB PHY RLI SCT SPO SRF TEX VMT VSE WAY WP ZDX ZOO MDT");
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
strcat(a256_cDataDirectory,LDT_szGetParam(1));
fn_vSetLevelsDataPath(a256_cDataDirectory);
#ifdef LDT_SCR_HYBRID_VERSION
SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);
#endif
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteStringEntryToCurrentDscFile(SNA_C_ul_DirectoryOfLevels,LDT_szGetParam(1));
break;
case 'imaF': /*"Families"*/
LDT_RegisterPath(LDT_szGetParam(1),"ACE ACZ AI BDV CAR CHL DEC EDE EMA EMC ENL ERF ERU ESB GMT LGT MAC MOD PHY RFX RUL STA TEX TBL VMT VSE ZDX ZOO");
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
strcat(a256_cDataDirectory,LDT_szGetParam(1));
fn_vSetFamiliesDataPath(a256_cDataDirectory);
#ifdef LDT_SCR_HYBRID_VERSION
SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);
#endif
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteStringEntryToCurrentDscFile(SNA_C_ul_DirectoryOfFamilies,LDT_szGetParam(1));
break;
case 'rahC': /*"Characters"*/
LDT_RegisterPath(LDT_szGetParam(1),"CAR");
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
strcat(a256_cDataDirectory,LDT_szGetParam(1));
fn_vSetCharactersDataPath(a256_cDataDirectory);
#ifdef LDT_SCR_HYBRID_VERSION
SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);
#endif
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteStringEntryToCurrentDscFile(SNA_C_ul_DirectoryOfCharacters,LDT_szGetParam(1));
break;
case 'minA': /*"Animations"*/
LDT_RegisterPath(LDT_szGetParam(1),"A3D A3B");
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
strcat(a256_cDataDirectory,LDT_szGetParam(1));
fn_vSetAnimDataPath(a256_cDataDirectory);
#ifdef LDT_SCR_HYBRID_VERSION
SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);
#endif
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteStringEntryToCurrentDscFile(SNA_C_ul_DirectoryOfAnimations,LDT_szGetParam(1));
break;
case 'parG':
if ((*(long*)(szEntryName+19/*"DirectoryOfGraphics"*/))=='salC')
{ /*"GraphicsClasses"*/
LDT_RegisterPath(LDT_szGetParam(1),"GMT MOD PHY TBL TEX VMT VSE ZOO");
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
strcat(a256_cDataDirectory,LDT_szGetParam(1));
fn_vSetGraphicsClassesDataPath(a256_cDataDirectory);
#ifdef LDT_SCR_HYBRID_VERSION
SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);
#endif
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteStringEntryToCurrentDscFile(SNA_C_ul_DirectoryOfGraphicsClasses,LDT_szGetParam(1));
}
else
{ /*"GraphicsBanks"*/
LDT_RegisterPath(LDT_szGetParam(1),"AI ACE ACZ BDV CHL DEC EDE EMA EMO EMC ENL ERF ERU ESB GMT MAC MOD PHY RFX RLI RUL SPO STA TBL TEX VMT VSE ZDX ZOO");
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
strcat(a256_cDataDirectory,LDT_szGetParam(1));
fn_vSetGraphicsBanksDataPath(a256_cDataDirectory);
#ifdef LDT_SCR_HYBRID_VERSION
SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);
#endif
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteStringEntryToCurrentDscFile(SNA_C_ul_DirectoryOfGraphicsBanks,LDT_szGetParam(1));
}
break;
case 'hceM': /*"Mechanics"*/
LDT_RegisterPath(LDT_szGetParam(1),"MEC");
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
strcat(a256_cDataDirectory,LDT_szGetParam(1));
fn_vSetMechanicsDataPath(a256_cDataDirectory);
#ifdef LDT_SCR_HYBRID_VERSION
SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);
#endif
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteStringEntryToCurrentDscFile(SNA_C_ul_DirectoryOfMechanics,LDT_szGetParam(1));
break;
case 'nuoS': /*"Sound"*/
LDT_RegisterPath(LDT_szGetParam(1),"CSB LCB SIF");
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
strcat(a256_cDataDirectory,LDT_szGetParam(1));
fn_vSetGraphicsClassesDataPath(a256_cDataDirectory);
#ifdef LDT_SCR_HYBRID_VERSION
SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);
#endif
strcpy(szFileName, g_a64_cGameDataDirectory);
strcat(szFileName,LDT_szGetParam(1));
fn_vSetSoundDataPath(szFileName);
#ifdef LDT_SCR_HYBRID_VERSION
SCR_fn_v_RdL0_RegisterPath(szFileName);
#endif
strcat(szFileName,"\\");
SND_fn_vAddDataDirectory(szFileName);
sprintf(szPath,"%s%s\\",szFileName,g_sLanguage);
SND_fn_vAddDataDirectory(szPath);
if(!g_iComplete)
{
sprintf(szPath,"%c:\\%s",g_cCDROM,szFileName);
strcpy( szFileName, szPath);
SND_fn_vAddDataDirectory(szFileName);
sprintf(szPath,"%s%s\\",szFileName,g_sLanguage);
SND_fn_vAddDataDirectory(szPath);
}
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteStringEntryToCurrentDscFile(SNA_C_ul_DirectoryOfSound,LDT_szGetParam(1));
break;
case 'usiV': /*"Visuals"*/
LDT_RegisterPath(LDT_szGetParam(1),"VMT VSE TEX");
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
strcat(a256_cDataDirectory,LDT_szGetParam(1));
fn_vSetVisualMaterialDataPath(a256_cDataDirectory);
#ifdef LDT_SCR_HYBRID_VERSION
SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);
#endif
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteStringEntryToCurrentDscFile(SNA_C_ul_DirectoryOfVisuals,LDT_szGetParam(1));
break;
case 'ivnE': /*"Environment"*/
LDT_RegisterPath(LDT_szGetParam(1),"GEV MEV VEV");
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
strcat(a256_cDataDirectory,LDT_szGetParam(1));
fn_vSetEnvironmentDataPath(a256_cDataDirectory);
#ifdef LDT_SCR_HYBRID_VERSION
SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);
#endif
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteStringEntryToCurrentDscFile(SNA_C_ul_DirectoryOfEnvironment,LDT_szGetParam(1));
break;
case 'etaM': /*"Materials"*/
LDT_RegisterPath(LDT_szGetParam(1),"CMT EMC GMT MMT VMT");
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
strcat(a256_cDataDirectory,LDT_szGetParam(1));
fn_vSetCollideMaterialDataPath(a256_cDataDirectory);
fn_vSetSoundMaterialDataPath(a256_cDataDirectory);
fn_vSetMechanicsMaterialDataPath(a256_cDataDirectory);
fn_vSetGameMaterialDataPath(a256_cDataDirectory);
#ifdef LDT_SCR_HYBRID_VERSION
SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);
#endif
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteStringEntryToCurrentDscFile(SNA_C_ul_DirectoryOfMaterials,LDT_szGetParam(1));
break;
case 'evaS': /*"SaveGame"*/
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
strcat(a256_cDataDirectory,LDT_szGetParam(1));
fn_vSetSaveGameDataPath(a256_cDataDirectory);
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteStringEntryToCurrentDscFile(SNA_C_ul_DirectoryOfSaveGame,LDT_szGetParam(1));
break;
case 'rtxE': /*"Extras"*/
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
strcat(a256_cDataDirectory,LDT_szGetParam(1));
fn_vSetExtrasDataPath(a256_cDataDirectory);
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteStringEntryToCurrentDscFile(SNA_C_ul_DirectoryOfExtras,LDT_szGetParam(1));
break;
case 'ngiV': /*"Vignettes"*/
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
strcat(a256_cDataDirectory,LDT_szGetParam(1));
fn_vSetVignettesDataPath(a256_cDataDirectory);
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteStringEntryToCurrentDscFile(SNA_C_ul_DirectoryOfVignettes,LDT_szGetParam(1));
break;
case 'itpO': /*"Options"*/
LDT_RegisterPath(LDT_szGetParam(1),"IPT");
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
strcat(a256_cDataDirectory,LDT_szGetParam(1));
fn_vSetOptionsDataPath(a256_cDataDirectory);
#ifdef LDT_SCR_HYBRID_VERSION
SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);
#endif
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteStringEntryToCurrentDscFile(SNA_C_ul_DirectoryOfOptions,LDT_szGetParam(1));
break;
case 'spiL': /*"LipsSync"*/
/* LDT_RegisterPath(LDT_szGetParam(1),"");*/
/* sprintf(szPath,"%s\\%s",,LDT_szGetParam(1),g_sLanguage);*/
/* LDT_RegisterPath(szPath,"");*/
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
strcat(a256_cDataDirectory,LDT_szGetParam(1));
#ifdef LDT_SCR_HYBRID_VERSION
SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);
#endif
sprintf(szPath,"%s\\%s",a256_cDataDirectory,g_sLanguage);
fn_vSetSyncLipsDataPath(szPath);
#ifdef LDT_SCR_HYBRID_VERSION
SCR_fn_v_RdL0_RegisterPath(szPath);
#endif
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteStringEntryToCurrentDscFile(SNA_C_ul_DirectoryOfLipsSync,LDT_szGetParam(1));
break;
case 'xdZ': /*"Zdx"*/
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
strcat(a256_cDataDirectory,LDT_szGetParam(1));
fn_vSetZdxDataPath(a256_cDataDirectory);
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteStringEntryToCurrentDscFile(SNA_C_ul_DirectoryOfZdx,LDT_szGetParam(1));
break;
case 'effE': /*"Effects"*/
/* LDT_RegisterPath(LDT_szGetParam(1),"");*/
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
strcat(a256_cDataDirectory,LDT_szGetParam(1));
fn_vSetEffectsDataPath(a256_cDataDirectory);
#ifdef LDT_SCR_HYBRID_VERSION
SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);
#endif
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteStringEntryToCurrentDscFile(SNA_C_ul_DirectoryOfEffects,LDT_szGetParam(1));
} /* end switch*/
result=LDT_GetNextEntry();
} /*end while for entries*/
/* Working for EndSection*/
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteNoParamEntryToCurrentDscFile( SNA_C_ulEndOfDescSection );
#ifndef U64
#ifdef LDT_SCR_HYBRID_VERSION
if (!g_iComplete)
{
strcpy( szFileName, fn_szGetGameDataPath() );
sprintf(szPath,"%c:\\%s",g_cCDROM,szFileName);
SCR_fn_v_RdL0_RegisterPath(szPath);
strcpy( szFileName, fn_szGetWorldDataPath() );
sprintf(szPath,"%c:\\%s",g_cCDROM,szFileName);
SCR_fn_v_RdL0_RegisterPath(szPath);
strcpy( szFileName, fn_szGetTextsDataPath() );
sprintf(szPath,"%c:\\%s",g_cCDROM,szFileName);
SCR_fn_v_RdL0_RegisterPath(szPath);
sprintf(szFileName,"%s\\%s",szPath,g_sLanguage);
SCR_fn_v_RdL0_RegisterPath(szFileName);
strcpy( szFileName, fn_szGetFamiliesDataPath() );
sprintf(szPath,"%c:\\%s",g_cCDROM,szFileName);
SCR_fn_v_RdL0_RegisterPath(szPath);
strcpy( szFileName, fn_szGetCharactersDataPath() );
sprintf(szPath,"%c:\\%s",g_cCDROM,szFileName);
SCR_fn_v_RdL0_RegisterPath(szPath);
strcpy( szFileName, fn_szGetLevelsDataPath() );
sprintf(szPath,"%c:\\%s",g_cCDROM,szFileName);
SCR_fn_v_RdL0_RegisterPath(szPath);
strcpy( szFileName, fn_szGetAnimDataPath() );
sprintf(szPath,"%c:\\%s",g_cCDROM,szFileName);
SCR_fn_v_RdL0_RegisterPath(szPath);
strcpy( szFileName, fn_szGetGameMaterialDataPath() );
sprintf(szPath,"%c:\\%s",g_cCDROM,szFileName);
SCR_fn_v_RdL0_RegisterPath(szPath);
strcpy( szFileName, fn_szGetVisualMaterialDataPath() );
sprintf(szPath,"%c:\\%s",g_cCDROM,szFileName);
SCR_fn_v_RdL0_RegisterPath(szPath);
strcpy( szFileName, fn_szGetSoundDataPath() );
sprintf(szPath,"%c:\\%s",g_cCDROM,szFileName);
SCR_fn_v_RdL0_RegisterPath(szPath);
strcat(szPath,"\\");
SND_fn_vAddDataDirectory(szPath);
sprintf(szFileName,"%s%s",szPath,g_sLanguage);
SCR_fn_v_RdL0_RegisterPath(szFileName);
strcat(szFileName,"\\");
SND_fn_vAddDataDirectory(szFileName);
strcpy( szFileName, fn_szGetGraphicsClassesDataPath() );
sprintf(szPath,"%c:\\%s",g_cCDROM,szFileName);
SCR_fn_v_RdL0_RegisterPath(szPath);
strcpy( szFileName, fn_szGetGraphicsBanksDataPath() );
sprintf(szPath,"%c:\\%s",g_cCDROM,szFileName);
SCR_fn_v_RdL0_RegisterPath(szPath);
strcpy( szFileName, fn_szGetMechanicsDataPath() );
sprintf(szPath,"%c:\\%s",g_cCDROM,szFileName);
SCR_fn_v_RdL0_RegisterPath(szPath);
strcpy( szFileName, fn_szGetEnvironmentDataPath() );
sprintf(szPath,"%c:\\%s",g_cCDROM,szFileName);
SCR_fn_v_RdL0_RegisterPath(szPath);
strcpy( szFileName, fn_szGetOptionsDataPath() );
sprintf(szPath,"%c:\\%s",g_cCDROM,szFileName);
SCR_fn_v_RdL0_RegisterPath(szPath);
strcpy( szFileName, fn_szGetSyncLipsDataPath() );
sprintf(szPath,"%c:\\%s",g_cCDROM,szFileName);
SCR_fn_v_RdL0_RegisterPath(szPath);
strcpy( szFileName, fn_szGetEffectsDataPath() );
sprintf(szPath,"%c:\\%s",g_cCDROM,szFileName);
SCR_fn_v_RdL0_RegisterPath(szPath);
strcpy( szFileName, szInventorDirectory );
sprintf(szPath,"%c:\\%s",g_cCDROM,szFileName);
SCR_fn_v_RdL0_RegisterPath(szPath);
sprintf(szFileName,"%s\\%s",szPath,g_sLanguage);
SCR_fn_v_RdL0_RegisterPath(szFileName);
}
#endif
#endif
return 0;
}
/*END FS 8/27/98*/
/*BEGIN FS 9/2/98*/
/*----------------------------------------------------------------------
* Description: Callback InputDeviceManager section from .dsc sript file
*----------------------------------------------------------------------
* Input:
* Output:
*----------------------------------------------------------------------
* Author: FS
* Creation date:9/2/98
* Modif date:
*----------------------------------------------------------------------*/
int LoadInputDeviceManagerDescription( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
char *szEntryName;
/* Working for Entries*/
result=LDT_GetNextEntry();
while( result!=ParseResult_EndSection )
{
szEntryName=LDT_szGetEntryName();
switch (*(long*)(szEntryName))
{
case 'tinI': /*"InitInputDeviceManager"*/
IPT_fn_vInitInput((short)fn_lAToI(LDT_szGetParam(1)),fn_hGetApplicationInstance(),fn_hGetApplicationWindow());
break;
case 'IddA': /*"AddInputDeviceFile"*/
/* IPT_fn_vReadInputScript(LDT_szGetParam(1));*/
/*!!! functia de sus nu face decat instr. urmatoare*/
/* SCR_fnp_st_RdL0_AnalyseSection(LDT_szGetParam(1), SCR_CDF_uw_Anl_ForceAnalyse);*/
/*!!! introduc LDT_LoadSection doar dupa implementare .IPT-uri*/
LDT_LoadSection(LDT_szGetParam(1));
break;
} /* end switch*/
result=LDT_GetNextEntry();
} /*end while for entries*/
return 0;
}
/*END FS 9/2/98*/
/*BEGIN FS 9/2/98*/
/*----------------------------------------------------------------------
* Description: callback for RandomManagerDescription section from .dsc script file
*----------------------------------------------------------------------
* Input:
* Output:
*----------------------------------------------------------------------
* Author: FS
* Creation date:9/2/98
* Modif date:
*----------------------------------------------------------------------*/
int LoadRandomManagerDescription( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
char *szEntryName;
/* Working for Entries*/
result=LDT_GetNextEntry();
while( result!=ParseResult_EndSection )
{
szEntryName=LDT_szGetEntryName();
switch (*(long*)(szEntryName))
{
case 'tinI': /*"InitRandomManager"*/
RND_fn_vInitRandom();
/*!!! aici se va lucra pe LDT cand se va implementa si .RND*/
/*urmatoarea functie face un AnalyseSection la sectiunea al carui callback */
/* s-a inregistrat incarcat RND_fn_vInitRandom()*/
RND_fn_vReadRandomScript(LDT_szGetParam(1));
break;
} /* end switch*/
result=LDT_GetNextEntry();
} /*end while for entries*/
return 0;
}
/*END FS 9/2/98*/
/*BEGIN FS 9/2/98*/
/*----------------------------------------------------------------------
* Description: callback for GameOptionsFile section from .dsc sript file
*----------------------------------------------------------------------
* Input:
* Output:
*----------------------------------------------------------------------
* Author: FS
* Creation date:9/2/98
* Modif date:
*----------------------------------------------------------------------*/
int LoadGameOptionsFileDescription( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
char *szEntryName;
/* Working for BeginSection*/
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteNoParamEntryToCurrentDscFile( SNA_C_ul_GameOptionDescTitle );
/* Working for Entries*/
result=LDT_GetNextEntry();
while( result!=ParseResult_EndSection )
{
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteNoParamEntryToCurrentDscFile( SNA_C_ul_GameOptionDescTitle );
szEntryName=LDT_szGetEntryName();
switch (*(long*)(szEntryName))
{
/* case 'dreC': //"CreditsLevelName"*/
/* strcpy(g_stEngineStructure.szCreditsLevelName,LDT_szGetParam(1));*/
/* break;*/
/* case 'pikS': //"SkipMainMenu"*/
/* g_stEngineStructure.bSkipMainMenu = TRUE;*/
/* break;*/
case 'afeD': /*"DefaultFile"*/
fn_vSetDefaultGameOptionsFileName(LDT_szGetParam(1));
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteStringEntryToCurrentDscFile(SNA_C_ul_BigFileTextures,LDT_szGetParam(1));
break;
case 'rruC': /*"CurrentFile"*/
fn_vSetCurrentGameOptionsFileName(LDT_szGetParam(1));
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteStringEntryToCurrentDscFile(SNA_C_ul_BigFileTextures,LDT_szGetParam(1));
break;
case 'marF': /*"FrameSynchro"*/
/* ON/OFF, NbFrame (0 for hysteresis) and %limit for hysteresis*/
{
char a[50], b[100], c[100];
strcpy(a, LDT_szGetParam(1));
strcpy(b, LDT_szGetParam(2));
strcpy(c, LDT_szGetParam(3));
GLD_vSetFrameSynchro( a,b,c);
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWrite3StringsEntryToCurrentDscFile(SNA_C_ul_FrameSynchro, a,b,c);
}
} /* end switch*/
result=LDT_GetNextEntry();
} /*end while for entries*/
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteNoParamEntryToCurrentDscFile( SNA_C_ulEndOfDescSection );
return 0;
}
/*END FS 9/2/98*/
/*BEGIN FS 9/2/98*/
/*----------------------------------------------------------------------
* Description: callback for FirstLevelDescription from .dsc sript file
*----------------------------------------------------------------------
* Input:
* Output:
*----------------------------------------------------------------------
* Author: FS
* Creation date:9/2/98
* Modif date:
*----------------------------------------------------------------------*/
int LoadFirstLevelDescription( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
char *szEntryName;
/* Working for BeginSection*/
g_cChooseLevel = -1;
g_stEngineStructure.ucNumberOfLevels = 0;
g_stEngineStructure.ucCurrentLevel = (unsigned char) ((LDT_szGetParam(1)!=NULL ) ? atoi(LDT_szGetParam(1)) : 0);
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteLongEntryToCurrentDscFile(SNA_C_ul_LevelNameTitle,
g_stEngineStructure.ucCurrentLevel);
result=LDT_GetNextEntry();
/* Working for Entries*/
while( result!=ParseResult_EndSection )
{
szEntryName=LDT_szGetEntryName();
switch (*(long*)(szEntryName))
{
case 'eveL': /*"LevelName"*/
if (LDT_iGetNbParams()-1!=1)
M_GameFatalError(E_uwGameScriptBadNumberOfArg);
/* CGHT Bin*/
/*ANNECY TQ 09/04/98{*/
/*if(SNA_fn_ucGetLoadType()!=SNA_SAVE_SNAPSHOT)*/
/*ENDANNECY TQ}*/
if ( !g_cIsLevelOk )
{
if ( (g_stEngineStructure.ucNumberOfLevels == g_stEngineStructure.ucCurrentLevel) || (g_stEngineStructure.ucNumberOfLevels == 0) )
fn_vSetFirstLevelName(LDT_szGetParam(1));
}
strcpy( g_stEngineStructure.a_szLevelName[g_stEngineStructure.ucNumberOfLevels++],LDT_szGetParam(1));
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteStringEntryToCurrentDscFile (SNA_C_ul_LevelName,LDT_szGetParam(1));
break;
} /* end switch*/
result=LDT_GetNextEntry();
} /*end while for entries*/
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteNoParamEntryToCurrentDscFile ( SNA_C_ulEndOfDescSection );
return 0;
}
/*END FS 9/2/98*/
/*BEGIN FS 9/2/98*/
/*----------------------------------------------------------------------
* Description: Callback for Texts section from .dsc sript file
*----------------------------------------------------------------------
* Input:
* Output:
*----------------------------------------------------------------------
* Author: FS
* Creation date:9/2/98
* Modif date:
*----------------------------------------------------------------------*/
int LoadAddStringsFiles( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
char *szEntryName;
/* unsigned char ucOldACPModeMalloc;*/
/* Working for Entries*/
result=LDT_GetNextEntry();
while( result!=ParseResult_EndSection )
{
szEntryName=LDT_szGetEntryName();
switch (*(long*)(szEntryName))
{
case 'SddA': /*"AddStringsFile"*/
if (LDT_iGetNbParams()-1!=1)
M_GameFatalError(E_uwGameScriptBadNumberOfArg);
/* ucOldACPModeMalloc = GEO_M_ucGetMemMallocMode();*/
/* GEO_xSelectMemoryChannel(ACP_TextMemoryChannel);*/
/*!!! introduc LDT_LoadSection dupa introducere .TXT*/
LDT_LoadSection(LDT_szGetParam(1));
/* SCR_fnp_st_RdL0_AnalyseSection(LDT_szGetParam(1), SCR_CDF_uw_Anl_Normal);*/
/* GEO_xSelectMemoryChannel(ucOldACPModeMalloc);*/
fn_vGameTestMemory();
break;
case 'FddA': /*"AddFontFile"*/
/* if (LDT_iGetNbParams()-1!=1)
M_GameFatalError(E_uwGameScriptBadNumberOfArg);
if(SNA_fn_ucGetLoadType()!=SNA_LOAD_SNAPSHOT)
LDT_LoadSection(LDT_szGetParam(1));
fn_vGameTestMemory();*/
break;
} /* end switch*/
result=LDT_GetNextEntry();
} /*end while for entries*/
return 0;
}
/*END FS 9/2/98*/
/*BEGIN FS 8/27/98*/
/*----------------------------------------------------------------------
* Description: Callback for BigFiles section from .dsc sript file
*----------------------------------------------------------------------
* Input:
* Output:
*----------------------------------------------------------------------
* Author: FS
* Creation date:8/27/98
* Modif date:
*----------------------------------------------------------------------*/
int LoadBigFile( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
char *szEntryName;
char a256_cGameMemoryFile[256];
/* Working for BeginSection*/
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteNoParamEntryToCurrentDscFile( SNA_C_ul_BigFileDescTitle );
/* Working for Entries*/
result=LDT_GetNextEntry();
while( result!=ParseResult_EndSection )
{
szEntryName=LDT_szGetEntryName();
switch (*(long*)(szEntryName))
{
case 'txeT': /*"Textures"*/
if (LDT_iGetNbParams()-1!=1)
M_GameFatalError(E_uwGameScriptBadNumberOfArg);
GLI_fn_vCloseBigFileTextures();
strcpy(a256_cGameMemoryFile,g_a64_cGameDataDirectory);
strcat(a256_cGameMemoryFile,LDT_szGetParam(1));
GLI_fn_vOpenBigFileTextures(a256_cGameMemoryFile);
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteStringEntryToCurrentDscFile(SNA_C_ul_BigFileTextures,LDT_szGetParam(1));
break;
case 'ngiV': /*"Vignettes"*/
if (LDT_iGetNbParams()-1!=1)
M_GameFatalError(E_uwGameScriptBadNumberOfArg);
VIG_fn_vCloseBigFileVignette();
strcpy(a256_cGameMemoryFile,g_a64_cGameDataDirectory);
strcat(a256_cGameMemoryFile,LDT_szGetParam(1));
VIG_fn_vOpenBigFileVignette(a256_cGameMemoryFile);
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteStringEntryToCurrentDscFile(SNA_C_ul_BigFileVignettes,LDT_szGetParam(1));
}/* end switch*/
result=LDT_GetNextEntry();
}/*end while for entries*/
if ( SNA_M_bTestSaveGameDesc() )
SNA_fn_vWriteNoParamEntryToCurrentDscFile( SNA_C_ulEndOfDescSection );
return 0;
}
/*END FS 8/27/98*/
/*****************************************************************
Function name : fn_iCreateLanguage
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iCreateLanguage( LDT_tdst_Link *pLink )
{
g_stEngineStructure.ucNbLanguages =(unsigned char) ((LDT_szGetParam(1) != NULL ) ? atoi( LDT_szGetParam(1) ) : 0);
g_stEngineStructure.p_stLanguageTable = M_p_GameMallocInHLM( g_stEngineStructure.ucNbLanguages * sizeof(tdstLanguageStructure));
return 0;
}
/*****************************************************************
Function name : fn_iLoadLanguage
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iLoadLanguage( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
static ucLanguage;
ucLanguage = 0;
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(long*)szEntry)
{
case 'LddA' : /* */
{
if (ucLanguage < g_stEngineStructure.ucNbLanguages)
{
strcpy( g_stEngineStructure.p_stLanguageTable[ucLanguage].szLanguageCode, LDT_szGetParam(1) );
strcpy( g_stEngineStructure.p_stLanguageTable[ucLanguage].szLanguageText, LDT_szGetParam(2) );
ucLanguage ++;
}
}
break;
default:
M_GameFatalError(E_uwGameLanguage);
}
}
}
}
return 0;
}
#endif /* CPA_USES_LDT */
/* MLT CC END 9/23/98 */

View File

@@ -0,0 +1,50 @@
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Structur\EngMode.h"
#include "SnapShot.h"
#if defined(USE_PROFILER) && !defined(PRESS_DEMO)
extern void GAM_fn_vShowRasters();
#endif /* PRESS_DEMO */
#define C_NumberOfBytesPerPoint 3L
#define C_NumberOfBytesPerPointForGLI 3L
unsigned long g_ulNumberOfSnapShot = 0;
/*************************************************************************/
/* 14/04/98 Carlos Torres don't overwrite old snapshot*/
void fn_vGetAndSaveSnapShotOfScreenAsBMP(void)
{
char szFileName[_MAX_PATH];
unsigned char *p_ucBitmap;
DWORD dwWidth;
DWORD dwHeight;
dwWidth = g_stEngineStructure.stViewportAttr.dwWidth; /* 640*/
dwHeight = g_stEngineStructure.stViewportAttr.dwHeight; /* 480*/
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeSnapShot , 0 );
p_ucBitmap = TMP_M_p_Malloc( C_NumberOfBytesPerPointForGLI * dwHeight * dwWidth);
#if defined(USE_PROFILER) && !defined(PRESS_DEMO)
GAM_fn_vShowRasters();
#endif
GLD_vGetFrontBufferIn24BitsAA(g_stEngineStructure.hGLDDevice, g_stEngineStructure.hGLDViewport, dwWidth, dwHeight, p_ucBitmap);
do {
sprintf(szFileName,"SnapShot\\Snap%04d.bmp",g_ulNumberOfSnapShot++);
} while (FIL_fn_bIsFileExist(szFileName));
FIL_fn_vSaveBMPInFile(szFileName,p_ucBitmap, dwWidth, dwHeight, C_NumberOfBytesPerPoint, C_NumberOfBytesPerPointForGLI);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeSnapShot , 0 );
TMP_M_Free(p_ucBitmap);
}
/*************************************************************************/

View File

@@ -0,0 +1,14 @@
#if !defined(__SNAPSHOT_H__)
#define __SNAPSHOT_H__
/******************************************/
#if _MSC_VER >= 1000
#pragma once
#endif /* _MSC_VER >= 1000 */
/******************************************/
#include "GAM/Header.h"
void fn_vGetAndSaveSnapShotOfScreenAsBMP(void);
#endif /* __SNAPSHOT_H__ */

View File

@@ -0,0 +1,689 @@
/*=========================================================================
* TBLLoad.c : Loading TBL Files
*
* Version 1.0
* Creation date 29/05/97
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1997
*=======================================================================*/
#if defined (WIN32)
#include <stdio.h>
#endif /* WIN32 */
/* to be Friend*/
#define D_ObjsTbls_Define
#define D_State_Define
#include "ToolsCPA.h"
#include "Sna.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/3DOSLkTb.h"
#include "Structur/Objects.h"
#include "Structur/ErrGame.h"
#include "Structur/GameScpt.h"
#include "Structur/MemGame.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "ObjType.h"
#include "Basic.h"
#include "Family.h"
#include "ZeMem.h"
#include "Structur/ObjsTbls.h"
#include "TBLLoad.h"
#include "Structur/anim_s.h"
extern SCR_tdst_Link_Table CHL_g_stLinkTable;
/* global for TBL Link Table*/
SCR_tdst_Link_Table TBL_g_stLinkTable;
#define MAX_TBL_SIZE 64*1024
/*-----------------------------------------------------------------------------
* Description : initialize and close link table for TBL
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : 29/05/97 Author : Sebastien DAVID (G<>zmo)
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
SCR_tdst_Link_Table *TBL_fn_p_stGetLinkTable(void)
{
return(&TBL_g_stLinkTable);
}
void TBL_fn_vInitLinkTable(void)
{
SCR_fn_v_Link_InitTable(&TBL_g_stLinkTable);
}
void TBL_fn_vCloseLinkTable(void)
{
SCR_fn_v_Link_CloseTable(&TBL_g_stLinkTable);
}
/*
void TBL_fn_vDeleteLinkTable(unsigned char ucMin,unsigned char ucMax)
{
SCR_fn_v_Link_DeleteEntryWithPriority(&TBL_g_stLinkTable,ucMin,ucMax);
}
*/
/*-----------------------------------------------------------------------------
* Description : Used to register all script callback functions
*-----------------------------------------------------------------------------
* Creation date : 29/05/97 Author : Sebastien DAVID (G<>zmo)
*-----------------------------------------------------------------------------*/
void TBL_fn_vRegisterAllScriptSections(void)
{
SCR_fn_v_RdL0_RegisterCallback(C_Section_TBLHeader, TBL_fn_eScriptCallBackHeader,SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(C_Section_TBLGeneral, TBL_fn_eScriptCallBackGeneral,SCR_CRC_c_RdL0_ForSection);
SCR_fn_v_RdL0_RegisterCallback(C_Section_EVTGeneral,TBL_fn_eScriptCallBackEvent,SCR_CRC_c_RdL0_ForSection);
/*BEGIN OS 23-Mar-98*/
/* SCR_fn_v_RdL0_RegisterCallback(C_Section_TBLHeader, TBL_fn_eScriptCallBackBinHeader,SCR_CRC_c_RdL0_ForBinSection);
SCR_fn_v_RdL0_RegisterCallback(C_Section_TBLGeneral, TBL_fn_eScriptCallBackBinGeneral,SCR_CRC_c_RdL0_ForBinSection);
*/
/*END OS 23-Mar-98*/
}
/*-----------------------------------------------------------------------------
* Description : call-back for header section of TBL script file
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : 29/05/97 Author : Sebastien DAVID (G<>zmo)
*-----------------------------------------------------------------------------*/
SCR_tde_Anl_ReturnValue TBL_fn_eScriptCallBackHeader(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;
/*char sz_LongPathForLinkTable[MAX_PATH];*/
tdxHandleToObjectsTablesList h_ObjectsTablesListElement;
if ( M_IsEntry )
{
if ( M_ActionIs( C_Entry_FileVersion ) )
{
/* not used yet*/
/*gs_wTBLFileVersion = (short)fn_lAToI( _ap_szParams[0] );*/
}
else if ( M_ActionIs( C_Entry_MaximumIndex ) )
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeTBLList , 0 );
h_ObjectsTablesListElement = fn_hObjectsTablesListAlloc();
SCR_M_RdL0_SetSectionLong(C_ThisSection,0,h_ObjectsTablesListElement);
SCR_M_RdL0_SetSectionLong(C_ParentSection,0,h_ObjectsTablesListElement);
SCR_M_RdL0_SetContextLong(C_ParentContext,1,0); /* flag Duplicate*/
MMG_fn_vBeginMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeTBLElement , h_ObjectsTablesListElement );
fn_vObjectsTablesAlloc(h_ObjectsTablesListElement,(unsigned short)fn_lAToI(_ap_szParams[0]));
MMG_fn_vEndMemoryInfo();
SCR_fnp_st_Link_SetValue(&TBL_g_stLinkTable, SCR_M_RdL0_GetOpenFileNameR(0), (unsigned long)h_ObjectsTablesListElement);
/* ANNECY AV {*/
h_ObjectsTablesListElement -> wZDxUsed = 0; /* For the moment, no Zdd and no Zde*/
/* END ANNECY AV }*/
}
/* MR0707*/
else if ( M_ActionIs( C_Entry_Duplicate ) )
{
SCR_M_RdL0_SetContextLong(C_ParentContext,1,1); /* flag Duplicate*/
}
}
return ( eReturnValue );
}
/*-----------------------------------------------------------------------------
* Description : call-back for general section of TBL script file
*-----------------------------------------------------------------------------
*-----------------------------------------------------------------------------
* Creation date : 29/05/97 Author : Sebastien DAVID (G<>zmo)
*-----------------------------------------------------------------------------*/
SCR_tde_Anl_ReturnValue TBL_fn_eScriptCallBackGeneral(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;
/*SCR_tdst_Cxt_Values *p_stVal;*/
tdxHandleToObjectsTablesList h_ObjectsTablesListElement;
long l_NumberInTable;
/*char s[80];*/
if ( M_IsTitle )
{
// Shaitan => module list in the level
tdxHandleToFamilyList hFamily;
SCR_M_RdL0_GetContextLong(C_ThisContext,1,tdxHandleToFamilyList,hFamily);
if (!hFamily)
{
char szFamilyName[SCR_CV_ui_Cfg_MaxLenName];
char *p_szFamilyName;
tdObjectType otFamily;
strcpy(szFamilyName,SCR_M_RdL0_GetFileNameR(0));
p_szFamilyName = strchr(szFamilyName, '\\');
strcpy(p_szFamilyName, "");
p_szFamilyName = strchr(szFamilyName, '\\');
if (p_szFamilyName)
strcpy(szFamilyName, p_szFamilyName);
otFamily = fn_otFindOrAddFamilyTypeOfFamilyTypeName(szFamilyName);
hFamily = fn_hFindOrAddFAmily(otFamily);
SCR_M_RdL0_SetContextLong(C_ThisContext,1,hFamily);
}
// End Shaitan => module list in the level
SCR_M_RdL0_SetContextLong(C_ThisContext,0,fn_lAToI(_p_szName));
/*
strcpy(s,SCR_M_RdL0_GetCompleteSectionNameR(0));
strcat(s,"\n");
OutputDebugString(s);
*/
}
else if ( M_IsEntry )
{
// Shaitan => module list in the level
tdxHandleToFamilyList hFamily;
SCR_M_RdL0_GetContextLong(C_ThisContext,1,tdxHandleToFamilyList,hFamily);
// End Shaitan => module list in the level
SCR_M_RdL0_GetSectionLong(C_ParentSection,0,tdxHandleToObjectsTablesList,h_ObjectsTablesListElement);
SCR_M_RdL0_GetContextLong(C_ThisContext,0,long,l_NumberInTable);
if ( M_ActionIs( C_Entry_PHY ) )
{
/* ANNECY AV {*/
PO_tdxHandleToPhysicalObject hPO;
// Shaitan => module list in the level
if (hFamily && hFamily->ucOptimized)
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].h_Target = hPO = CS_fn_xFindPhysicalObject(_ap_szParams[0]);
else
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].h_Target = hPO = CS_fn_xLoadPhysicalObject(_ap_szParams[0]);
if (hPO)
{
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].wTypeOfTarget = C_wTdO_PhysicalObject;
if (PO_fn_hGetCollideSet (hPO))
{
if (PCS_fn_hGetGeoObjOfPhysicalCollSet (C_ucTypeZdd , PO_fn_hGetCollideSet (hPO))) h_ObjectsTablesListElement->wZDxUsed |= C_wObjectTableHasZdd;
if (PCS_fn_hGetGeoObjOfPhysicalCollSet (C_ucTypeZde , PO_fn_hGetCollideSet (hPO))) h_ObjectsTablesListElement->wZDxUsed |= C_wObjectTableHasZde;
}
}
else
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].wTypeOfTarget = C_wTdO_Undefined;
/*
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].wTypeOfTarget = C_wTdO_PhysicalObject;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].h_Target = hPO = CS_fn_xLoadPhysicalObject(_ap_szParams[0]);
if (PO_fn_hGetCollideSet (hPO))
{
if (PCS_fn_hGetGeoObjOfPhysicalCollSet (C_ucTypeZdd , PO_fn_hGetCollideSet (hPO))) h_ObjectsTablesListElement->wZDxUsed |= C_wObjectTableHasZdd;
if (PCS_fn_hGetGeoObjOfPhysicalCollSet (C_ucTypeZde , PO_fn_hGetCollideSet (hPO))) h_ObjectsTablesListElement->wZDxUsed |= C_wObjectTableHasZde;
}
*/
// End Shaitan => module list in the level
/* END ANNECY AV }*/
/*AR980820*/
/* p_stVal = SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[0], SCR_CDF_uw_Anl_Normal);
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].wTypeOfTarget = C_wTdO_PhysicalObject;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].h_Target = (tdxHandleToVoid) SCR_M_ul_RdL0_ExtractLongValue(p_stVal,0);
*/
/* MR3006*/
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].uwChannelNumber=255;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].ucPhoneme=255;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].ucIntensity=255;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].ucExpression=255;
/* End MR3006*/
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].p_stCustomZoom=NULL;
#ifdef _DEBUG
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].wCounter=0;
#endif
}
if ( M_ActionIs( C_Entry_MIRROR ) )
{
// Shaitan => module list in the level
tdxHandleToFamilyList hFamily;
SCR_M_RdL0_GetContextLong(C_ThisContext,1,tdxHandleToFamilyList,hFamily);
if (hFamily && hFamily->ucOptimized)
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].h_Target = CS_fn_xFindPhysicalObject(_ap_szParams[0]);
else
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].h_Target = CS_fn_xLoadPhysicalObject(_ap_szParams[0]);
if (h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].h_Target)
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].wTypeOfTarget = C_wTdO_PhysicalObject;
else
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].wTypeOfTarget = C_wTdO_Undefined;
/*
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].wTypeOfTarget = C_wTdO_Mirror;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].h_Target = CS_fn_xLoadPhysicalObject(_ap_szParams[0]);
*/
// End Shaitan => module list in the level
/* MR3006*/
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].uwChannelNumber=255;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].ucPhoneme=255;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].ucIntensity=255;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].ucExpression=255;
/* End MR3006*/
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].p_stCustomZoom=NULL;
#ifdef _DEBUG
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].wCounter=0;
#endif
}
else if ( M_ActionIs( C_Entry_LipsSynchro ) )
{
/* MR1508*/
/*h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].uwChannelNumber=(unsigned short)(atoi(_ap_szParams[0])-1);*/
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeTBLElement , h_ObjectsTablesListElement );
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].uwChannelNumber=(unsigned long)TMP_M_p_Malloc(strlen(_ap_szParams[0])+1);
strcpy((char *)h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].uwChannelNumber,_ap_szParams[0]);
/* End MR1508*/
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].ucPhoneme=(unsigned char)(_ap_szParams[1][0]-'A');
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].ucIntensity=(unsigned char)atoi(_ap_szParams[2]);
if (!stricmp("Neutral",_ap_szParams[3]))
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].ucExpression=0;
/* End MR2706*/
#ifdef _DEBUG
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].wCounter=0;
#endif
}
else if ( M_ActionIs( C_Entry_CustomZoom ) )
{
float f0,f4,f8;
f0 = fn_fAToF(_ap_szParams[0]);
f4 = fn_fAToF(_ap_szParams[4]);
f8 = fn_fAToF(_ap_szParams[8]);
if( f0!=1.0f || f4!=1.0f || f8!=1.0f )
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeTBLElement , h_ObjectsTablesListElement );
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].p_stCustomZoom = (MTH3D_tdstVector *)M_p_GameMallocInHLM(sizeof(struct MTH3D_tdstVector_));
MTH3D_M_vSetVectorElements(h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].p_stCustomZoom,f0,f4,f8);
}
}
}
else if( M_IsEnd )
{
long l_FlagDuplicate;
SCR_M_RdL0_GetSectionLong(C_ParentSection,0,tdxHandleToObjectsTablesList,h_ObjectsTablesListElement);
SCR_M_RdL0_GetContextLong(C_ParentContext,1,long,l_FlagDuplicate);
if(l_FlagDuplicate) fn_vDuplicateObjectTable(h_ObjectsTablesListElement);
}
return ( eReturnValue );
}
/*-----------------------------------------------------------------------------
* Description : Create an event pointed in TBL (V6 format)
*-----------------------------------------------------------------------------
* Input :
* Output : pointer to the event
*-----------------------------------------------------------------------------
* Creation date : Jan 98 Author : Alain Robin
*---------------------------------------------------------------------------*/
struct tdstEventInTable_* GAM_fn_p_stCreateEventInTBL()
{
struct tdstEventInTable_* p_stEvent;
p_stEvent=(struct tdstEventInTable_*)M_p_GameMallocInHLM(sizeof(struct tdstEventInTable_));
p_stEvent->p_xEvent=0;
/* p_stEvent->ulBinaryEventId=SND_INVALID_BINID;*/
return p_stEvent;
}
/*-----------------------------------------------------------------------------
* Description : Script callback for the V6 events
*-----------------------------------------------------------------------------
* Input : script inputs
* Output : script outputs
*-----------------------------------------------------------------------------
* Creation date : Jan 98 Author : Alain Robin
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
SCR_tde_Anl_ReturnValue TBL_fn_eScriptCallBackEvent(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;
tdxHandleToObjectsTablesList h_ObjectsTablesListElement;
long l_NumberInTable;
if ( M_IsTitle )
{
l_NumberInTable=fn_lAToI(_p_szName);
SCR_M_RdL0_SetContextLong(C_ThisContext,0,l_NumberInTable);
SCR_M_RdL0_GetSectionLong(C_ParentSection,0,tdxHandleToObjectsTablesList,h_ObjectsTablesListElement);
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].wTypeOfTarget=C_wTdO_Event;
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeTBLEvent , h_ObjectsTablesListElement );
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].h_Target=(void*)GAM_fn_p_stCreateEventInTBL();
}
else if ( M_IsEntry )
{
tdstEventInTable* p_stEvent;
SCR_M_RdL0_GetSectionLong(C_ParentSection,0,tdxHandleToObjectsTablesList,h_ObjectsTablesListElement);
SCR_M_RdL0_GetContextLong(C_ThisContext,0,long,l_NumberInTable);
p_stEvent=(tdstEventInTable*)h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].h_Target;
if ( M_ActionIs( C_Entry_ObjectType ) ) /* Type of the event*/
{
if (!stricmp("GenericEvent",_ap_szParams[0]))
{
p_stEvent->ucTypeOfEvent=C_ucGENERIC_EVENT;
}
else if(!stricmp("MechanicEvent",_ap_szParams[0]))
{
p_stEvent->ucTypeOfEvent=C_ucMECHANIC_EVENT;
}
else if(!stricmp("SoundEvent",_ap_szParams[0]))
{
p_stEvent->ucTypeOfEvent=C_ucSOUND_EVENT;
}
else if(!stricmp("GenerateEvent",_ap_szParams[0]))
{
p_stEvent->ucTypeOfEvent=C_ucGENERATE_EVENT;
}
}
else if ( M_ActionIs( C_Entry_GenericEvent ) ) /* Type of generic event*/
{
long lEvent;
lEvent=(long)p_stEvent->p_xEvent;
if (!strcmp(_ap_szParams[0],"TakeObjectEvent"))
{
lEvent|=C_ucTAKE_OBJECT_EVENT;
}
else
if (!strcmp(_ap_szParams[0],"TakeInObjectEvent"))
{
lEvent|=C_ucTAKE_IN_OBJECT_EVENT;
}
else
if (!strcmp(_ap_szParams[0],"TakeOutObjectEvent"))
{
lEvent|=C_ucTAKE_OUT_OBJECT_EVENT;
}
else
if (!strcmp(_ap_szParams[0],"DropObjectEvent"))
{
lEvent|=C_ucDROP_OBJECT_EVENT;
}
else
if (!strcmp(_ap_szParams[0],"ThrowObjectEvent"))
{
lEvent|=C_ucTHROW_OBJECT_EVENT;
}
else if ( (strncmp( _ap_szParams[0],"User", 4 ) == 0) && (_ap_szParams[0][5] == 0) )
{
unsigned char ucUserEvent;
ucUserEvent = (unsigned char) (_ap_szParams[0][4] - '0');
if (ucUserEvent < 8)
lEvent |= (unsigned char) (C_ucEvent_User0 + ucUserEvent);
}
p_stEvent->p_xEvent=(void*)lEvent;
}
/* else if ( M_ActionIs( C_Entry_MechanicEvent ) ) // Type of mechanic event
{
if (!strcmp(_ap_szParams[0],"TurnUp"))
p_stEvent->p_xEvent = (void *)LRM_eRequest_TurnUp;
else if (!strcmp(_ap_szParams[0],"TurnDown"))
p_stEvent->p_xEvent = (void *)LRM_eRequest_TurnDown;
else if (!strcmp(_ap_szParams[0],"TurnLeft"))
p_stEvent->p_xEvent = (void *)LRM_eRequest_TurnLeft;
else if (!strcmp(_ap_szParams[0],"JumpAbsolute"))
p_stEvent->p_xEvent = (void *)LRM_eRequest_JumpAbsolute;
else if (!strcmp(_ap_szParams[0],"JumpWithoutAddingSpeed"))
p_stEvent->p_xEvent = (void *)LRM_eRequest_JumpWithoutAddingSpeed;
else if (!strcmp(_ap_szParams[0],"TurnAbsolute"))
p_stEvent->p_xEvent = (void *)LRM_eRequest_TurnAbsolute;
else if (!strcmp(_ap_szParams[0],"Jump"))
p_stEvent->p_xEvent = (void *)LRM_eRequest_Jump;
else if (!strcmp(_ap_szParams[0],"Accelerate"))
p_stEvent->p_xEvent = (void *)LRM_eRequest_Accelerate;
else if (!strcmp(_ap_szParams[0],"Pulse"))
p_stEvent->p_xEvent = (void *)LRM_eRequest_Pulse;
else if (!strcmp(_ap_szParams[0],"Brake"))
p_stEvent->p_xEvent = (void *)LRM_eRequest_Brake;
else if (!strcmp(_ap_szParams[0],"GoRelative"))
p_stEvent->p_xEvent = (void *)LRM_eRequest_GoRelative;
else if (!strcmp(_ap_szParams[0],"GoAbsolute"))
p_stEvent->p_xEvent = (void *)LRM_eRequest_GoAbsolute;
}*/
else if ( M_ActionIs( C_Entry_SoundEvent ) ) /* Sound event -> analyse the event section*/
{
SCR_tdst_Cxt_Values* p_stValue;
p_stValue=SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[0], SCR_CDF_uw_Anl_Normal);
p_stEvent->p_xEvent=(void*)SCR_M_ul_RdL0_ExtractLongValue(p_stValue, 0);
p_stEvent->ulBinaryEventId=SCR_M_ul_RdL0_ExtractLongValue(p_stValue, 1); /* used for the binarisation only*/
/* we save the id of the sound event and the pointer on the structure that contains the id and the pointer of the sound event */
SNA_fn_vWriteSoundEntryInSoundTableFile(SND_fn_ulGetEventBinIdFromPointer(p_stEvent->p_xEvent),(unsigned long)p_stEvent);
p_stEvent->ulBinaryEventId=SND_fn_ulGetEventBinIdFromPointer(p_stEvent->p_xEvent);
}
else if ( M_ActionIs( C_Entry_FirstCall ) )
{
p_stEvent->ucFirstCall=(unsigned char)fn_lAToI(_ap_szParams[0]);
}
else if ( M_ActionIs( C_Entry_Period ) )
{
p_stEvent->ucPeriod=(unsigned char)fn_lAToI(_ap_szParams[0]);
}
else if ( M_ActionIs( C_Entry_Priority ) )
{
p_stEvent->ucPriority=(unsigned char)fn_lAToI(_ap_szParams[0]);
}
}
else if( M_IsEnd )
{
}
return ( eReturnValue );
}
/****************************
Binarisation functions
****************************/
/*
BEGIN OS 02.03.98
Callbacks for bin files.
*/
/*-----------------------------------------------------------------------------
* Description : call-back for header section of TBL script file
*-----------------------------------------------------------------------------*/
/*
SCR_tde_Anl_ReturnValue TBL_fn_eScriptCallBackBinHeader(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;
tdxHandleToObjectsTablesList h_ObjectsTablesListElement;
char chTag;
if( _eAction != SCR_EA_Anl_BeginSection )
{
// do whatever ...
return SCR_ERV_Anl_NormalReturn;
}
SCR_fn_v_Bin_BeginSection(_p_stFile);
do{
chTag=SCR_fn_ch_Bin_GetCHAR( _p_stFile );
switch (chTag)
{
case 0: //VersionNumber
{
SCR_fn_s_Bin_GetSHORT( _p_stFile );
}
break;
case 1: //MaximumIndex
{
//MaximumIndex
h_ObjectsTablesListElement = fn_hObjectsTablesListAlloc();
SCR_M_RdL0_SetSectionLong(C_ThisSection,0,h_ObjectsTablesListElement);
SCR_M_RdL0_SetSectionLong(C_ParentSection,0,h_ObjectsTablesListElement);
SCR_M_RdL0_SetContextLong(C_ParentContext,1,0); // flag Duplicate
fn_vObjectsTablesAlloc(h_ObjectsTablesListElement, SCR_fn_us_Bin_GetUSHORT( _p_stFile ) );
SCR_fnp_st_Link_SetValue(&TBL_g_stLinkTable, SCR_M_RdL0_GetOpenFileNameR(0), (unsigned long)h_ObjectsTablesListElement);
}
break;
case 2: //Duplicate
{
SCR_M_RdL0_SetContextLong(C_ParentContext,1,1); // flag Duplicate
}
break;
}
}while (chTag!=-1);
SCR_fn_v_Bin_EndSection(_p_stFile);
return ( eReturnValue );
}
*/
/*-----------------------------------------------------------------------------
* Description : call-back for general section of TBL script file
*-----------------------------------------------------------------------------*/
/*
SCR_tde_Anl_ReturnValue TBL_fn_eScriptCallBackBinGeneral(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;
//SCR_tdst_Cxt_Values *p_stVal;
tdxHandleToObjectsTablesList h_ObjectsTablesListElement;
long l_NumberInTable;
char chTag;
if( _eAction != SCR_EA_Anl_BeginSection )
{
// do whatever ...
return SCR_ERV_Anl_NormalReturn;
}
SCR_fn_v_Bin_BeginSection(_p_stFile);
SCR_M_RdL0_SetContextLong(C_ThisContext,0,fn_lAToI(_p_szName));
do{
SCR_M_RdL0_GetSectionLong(C_ParentSection,0,tdxHandleToObjectsTablesList,h_ObjectsTablesListElement);
SCR_M_RdL0_GetContextLong(C_ThisContext,0,long,l_NumberInTable);
chTag=SCR_fn_ch_Bin_GetCHAR( _p_stFile );
switch (chTag)
{
case 0: //PHY
{
char szP0[MAX_PATH];
SCR_fn_sz_Bin_GetREFERENCE2Buffer( _p_stFile, szP0 );
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].wTypeOfTarget = C_wTdO_PhysicalObject;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].h_Target = CS_fn_xLoadBinPhysicalObject(szP0);
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].uwChannelNumber=255;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].ucPhoneme=255;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].ucIntensity=255;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].ucExpression=255;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].p_stCustomZoom=NULL;
#ifdef _DEBUG
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].wCounter=0;
#endif
}
break;
case 1: //MIRROR
{
char szP0[MAX_PATH];
SCR_fn_sz_Bin_GetREFERENCE2Buffer( _p_stFile, szP0 );
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].wTypeOfTarget = C_wTdO_Mirror;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].h_Target = CS_fn_xLoadBinPhysicalObject(szP0);
// MR3006
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].uwChannelNumber=255;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].ucPhoneme=255;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].ucIntensity=255;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].ucExpression=255;
// End MR3006
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].p_stCustomZoom=NULL;
#ifdef _DEBUG
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].wCounter=0;
#endif
}
break;
case 2: //LipsSynchro
{
char szP0[MAX_PATH];
SCR_fn_sz_Bin_GetSTRING2Buffer( _p_stFile, szP0 );
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].uwChannelNumber=(unsigned long)TMP_M_p_Malloc(strlen(szP0)+1);
strcpy((char *)h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].uwChannelNumber, szP0);
// End MR1508
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].ucPhoneme=(unsigned char)(SCR_fn_uch_Bin_GetUCHAR( _p_stFile )-'A');
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].ucIntensity=SCR_fn_uch_Bin_GetUCHAR( _p_stFile );
SCR_fn_sz_Bin_GetSTRING2Buffer( _p_stFile, szP0 );
if (!stricmp("Neutral", szP0))
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].ucExpression=0;
// End MR2706
#ifdef _DEBUG
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].wCounter=0;
#endif
}
break;
case 3: //CustomZoom
{
float f0,f4,f8;
f0 = SCR_fn_f_Bin_GetFLOAT( _p_stFile );
f4 = SCR_fn_f_Bin_GetFLOAT( _p_stFile );
f8 = SCR_fn_f_Bin_GetFLOAT( _p_stFile );
if( f0!=1.0f || f4!=1.0f || f8!=1.0f )
{
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].p_stCustomZoom = (MTH3D_tdstVector *)M_p_GameMallocInHLM(sizeof(struct MTH3D_tdstVector_));
MTH3D_M_vSetVectorElements(h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].p_stCustomZoom,f0,f4,f8);
}
}
break;
}
}while (chTag!=-1);
// end section
{
long l_FlagDuplicate;
SCR_M_RdL0_GetSectionLong(C_ParentSection,0,tdxHandleToObjectsTablesList,h_ObjectsTablesListElement);
SCR_M_RdL0_GetContextLong(C_ParentContext,1,long,l_FlagDuplicate);
if(l_FlagDuplicate) fn_vDuplicateObjectTable(h_ObjectsTablesListElement);
}
SCR_fn_v_Bin_EndSection(_p_stFile);
return ( eReturnValue );
}
*/
/*
END OS 02.03.98
Callbacks for bin files.
*/

View File

@@ -0,0 +1,110 @@
#if defined (WIN32)
#include <stdio.h>
#endif /* WIN32 */
/* to be Friend*/
#define D_State_Define
#define D_ObjsTbls_Define
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/3DOSLkTb.h"
#include "Structur/Objects.h"
#include "Structur/ErrGame.h"
#include "Structur/GameScpt.h"
#include "Structur/MemGame.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "Basic.h"
#include "Family.h"
#include "ObjType.h"
#include "ZeMem.h"
#include "CHLLoad.h"
#include "ldt.h"
/* global for CHL Link Table*/
extern SCR_tdst_Link_Table CHL_g_stLinkTable;
/*****************************************************************
Function name : fn_iCreateCHL
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iCreateCHL( LDT_tdst_Link *pLink )
{
struct tdstFamilyList_ *p_stFamily;
p_stFamily = (struct tdstFamilyList_ *)LDT_GetLinkValue(pLink->pParent);
LDT_SetLinkValue(pLink->pParent, (unsigned long)p_stFamily);
p_stFamily->ulNumberOfChannels = atoi(LDT_szGetParam(1));
return 0;
}
/*****************************************************************
Function name : fn_iLoadCHL
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iLoadCHL( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
long lChannelNumber = 0;
struct tdstFamilyList_ *p_stFamily;
char sz_ForLinkTable[MAX_PATH];
/* int i, j;*/
/* tdxHandleToObjectsTablesList hObjectsTable;*/
/* -> OS : THIS CODE SHOULD BE CHANGED 07-Jul-98*/
/* p_stFamily = (struct tdstFamilyList_ *)LDT_GetTempLong( 0 ); */
/* <- OS : THIS CODE SHOULD BE CHANGED 07-Jul-98*/
p_stFamily = (struct tdstFamilyList_ *)LDT_GetLinkValue(pLink->pParent);
LDT_SetLinkValue(pLink->pParent, (unsigned long)p_stFamily);
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry : AddChannelName*/
{
strcpy(sz_ForLinkTable, fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType));
strcat(sz_ForLinkTable, "-");
strcat(sz_ForLinkTable, LDT_szGetParam(1));
SCR_fnp_st_Link_SetValue(&CHL_g_stLinkTable, sz_ForLinkTable, lChannelNumber);
lChannelNumber++;
}
}
}
return 0;
}

View File

@@ -0,0 +1,635 @@
/*=========================================================================
* LoadFmlCB.cpp : This module contain all functions used to load
* a family type, this states, and all over
* This is a part of the Game project.
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1996-1998
*=======================================================================*/
#if defined (WIN32)
#include <stdio.h>
#endif /* WIN32 */
#define D_State_Define
#define D_ObjsTbls_Define
#include "ToolsCPA.h"
#include "structur\ObjsTbls.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/3DOSLkTb.h"
#include "Structur/Objects.h"
#include "Structur/ErrGame.h"
#include "Structur/GameScpt.h"
#include "Structur/MemGame.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "PlayAnim/PLA_dbg.h"
#include "Structur/State.h"
#include "Structur/Anim_s.h"
#include "LoadLvl.h"
#include "Basic.h"
#include "Family.h"
#include "LoadAni.h"
#include "LoadFml.h"
#include "ObjType.h"
#include "ZeMem.h"
/*#include "LoadA3B.h"*/
extern ACP_tdxBool g_xA3bOff;
#include "Structur/ObjsTbls.h"
#include "TBLLoad.h"
#include "CHLLoad.h"
#include "ChanList.h"
#include "LoadBin.h"
/* anim interpolated*/
#include "PlayAnim/Interpol/a3x_mem.h"
#include "PlayAnim/Interpol/a3x_intn.h"
#include "PlayAnim/Interpol/a3x_load.h"
#define _USE_BINARY_ANIM_BUFFER
#define MAX_FAMILY_ELEMENT_SIZE 128*1024
#define C_szConvertA3dToA3i "MakeAnim"
#include <direct.h>
#include "ldt.h"
#define lTagAnimation 'minA'
#define lTagNextState 'txeN'
#define lTagSpeed 'eepS'
#define lTagRepeat 'epeR'
#define lTagTransitionStatusFlag 'narT'
#define lTagProhibitedTargetState 'horP'
#define lTagAddTargetState 'TddA'
#define lTagLinkMechanics 'kniL'
#define lTagTestPointsList 'tseT'
#define OS_CB
#define MP_LDT_CB
HREF hRefBDV;
HREF g_hRefSTA;
/*****************************************************************
Function name : fn_iLoadStateFile
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iLoadStateFile( LDT_tdst_Link *pLink ) /* for .sta files*/
{
LDT_tdeParseResult result=ParseResult_BeginSection;
struct tdstFamilyList_ * p_stFamily;
char szFileName[_MAX_PATH];
tdxHandleToState h_State;
tdxHandleToTransition h_Transition;
tdxHandleToProhibit h_Prohibit;
char szSectionName[_MAX_PATH];
char szSectionPreName[_MAX_PATH];
SCR_tdst_Link_Value * _p_stLinkValue;
long i,j;
p_stFamily = (struct tdstFamilyList_ *)LDT_GetLinkValue(pLink);
LDT_SetFileLong( 11, (unsigned long)p_stFamily );
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_BeginSection: /* a subsection - CreateNewState*/
{
LDT_LoadSection( NULL );
}
break;
}
}
sprintf(szFileName,"%s\\%s.sta",fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType),fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType));
LST2_M_StaticForEachElementOf(&p_stFamily->hForStateArray,h_State,i)
{
/* Init handle to NextState ***********/
SCR_fn_v_RdL0_ComputeSectionName(szSectionPreName,szFileName,C_SectionCreateNewState,(char *)(h_State->h_NextState));
strcpy(szSectionName,fn_szGetFamiliesDataPath());
strcat(szSectionName,"\\"); strcat(szSectionName,szSectionPreName);
_p_stLinkValue = SCR_fnp_st_Link_SearchKey(&g_st3DOSLinkTable.stState,szSectionName);
fn_vGameTestMemory();
if(_p_stLinkValue != NULL)
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeState , p_stFamily);
TMP_M_Free(h_State->h_NextState);
h_State->h_NextState = (tdxHandleToState)SCR_M_ul_Link_GetValue(_p_stLinkValue);
}
else
{
if( !strcmpi(C_szNoState,(char *)(h_State->h_NextState)) )
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeState , p_stFamily);
TMP_M_Free(h_State->h_NextState);
h_State->h_NextState = NULL; /* NoState_EndOfAction*/
}
else
{
/* TMP_M_Free(h_State->h_NextState);*/
M_GameFatalError(E_uwGameScriptCallBackCreateNewStateBadNextState);
}
}
/* ************************************/
/* Init All handles To Transitions ****/
LST2_M_StaticForEachElementOf(&h_State->hForTransitionArray,h_Transition,j)
{
/* Target State*/
SCR_fn_v_RdL0_ComputeSectionName(szSectionPreName,szFileName,C_SectionCreateNewState,(char *)(h_Transition->h_TargetState));
strcpy(szSectionName,fn_szGetFamiliesDataPath());
strcat(szSectionName,"\\"); strcat(szSectionName,szSectionPreName);
_p_stLinkValue = SCR_fnp_st_Link_SearchKey(&g_st3DOSLinkTable.stState,szSectionName);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeState , p_stFamily);
TMP_M_Free(h_Transition->h_TargetState);
if(_p_stLinkValue != NULL)
{
h_Transition->h_TargetState = (tdxHandleToState)SCR_M_ul_Link_GetValue(_p_stLinkValue);
}
else
{
M_GameFatalError(E_uwGameScriptCallBackCreateNewStateBadTargetState);
}
/* State To Go*/
SCR_fn_v_RdL0_ComputeSectionName(szSectionPreName,szFileName,C_SectionCreateNewState,(char *)(h_Transition->h_StateToGo));
strcpy(szSectionName,fn_szGetFamiliesDataPath());
strcat(szSectionName,"\\"); strcat(szSectionName,szSectionPreName);
_p_stLinkValue = SCR_fnp_st_Link_SearchKey(&g_st3DOSLinkTable.stState,szSectionName);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeState , p_stFamily);
TMP_M_Free(h_Transition->h_StateToGo);
if(_p_stLinkValue != NULL)
{
h_Transition->h_StateToGo = (tdxHandleToState)SCR_M_ul_Link_GetValue(_p_stLinkValue);
}
else
{
M_GameFatalError(E_uwGameScriptCallBackCreateNewStateBadStateToGo);
}
}
/* ************************************/
/* Init All handles To Prohibited States ****/
LST2_M_StaticForEachElementOf(&h_State->hForProhibitArray,h_Prohibit,j)
{
/* Prohibited State*/
SCR_fn_v_RdL0_ComputeSectionName(szSectionPreName,szFileName,C_SectionCreateNewState,(char *)(h_Prohibit->h_ProhibitedState));
strcpy(szSectionName,fn_szGetFamiliesDataPath());
strcat(szSectionName,"\\"); strcat(szSectionName,szSectionPreName);
_p_stLinkValue = SCR_fnp_st_Link_SearchKey(&g_st3DOSLinkTable.stState,szSectionName);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeState , p_stFamily);
TMP_M_Free(h_Prohibit->h_ProhibitedState);
if(_p_stLinkValue != NULL)
{
h_Prohibit->h_ProhibitedState = (tdxHandleToState)SCR_M_ul_Link_GetValue(_p_stLinkValue);
}
else
{
M_GameFatalError(E_uwGameScriptCallBackCreateNewStateBadTargetState);
}
}
}
return 0;
}
/*****************************************************************
Function name : fn_iCreateNewState
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iCreateNewState( LDT_tdst_Link *pLink )
{
tdxHandleToState h_State;
struct tdstFamilyList_ * p_stFamily;
VIG_fn_vAddToProgressBar(1);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeState , p_stFamily );
h_State = fn_h_StateAlloc();
pLink->pObject = h_State;
p_stFamily = (struct tdstFamilyList_ *)LDT_GetFileLong(11);
LST2_M_StaticAddTail(&p_stFamily->hForStateArray, h_State);
#ifdef _DEBUG_STRING_FOR_PLA_
strcpy(h_State->szStateName,fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType));
strcat(h_State->szStateName," - ");
strcat(h_State->szStateName, pLink->szName);
#endif
return 0;
}
extern tdstAnim3d * fn_p_stLoadAnimationFile(char * szFileName,struct tdstFamilyList_ *p_stFamily);
/*****************************************************************
Function name : fn_iLoadNewState
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iLoadNewState( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
DNM_tdeMechanicsID eKindOfMechanics = DNM_eMIC_Error;
struct tdstFamilyList_ *p_stFamily;
tdxHandleToState h_State,h_NextState;
char szSectionName[_MAX_PATH];
tdxHandleToTransition h_Transition;
tdxHandleToProhibit h_Prohibit;
int nLen;
struct tdstEngineObject_ *p_stEngineObject=(struct tdstEngineObject_ *)pLink->pParent->pParent->pParent->pObject;
tdxHandleToState h_InitialState=NULL;
#if 0
static int i = 0;
char s[180], s1[300];
LDT_ComputeSectionName( pLink , s1 );
i++;
sprintf(s, "%d.%s\n", i, s1);
OutputDebugString(s);
#endif
h_State = (tdxHandleToState)pLink->pObject;
p_stFamily = (struct tdstFamilyList_ *)LDT_GetFileLong(11);
nLen = LDT_ComputeSectionName(pLink, szSectionName);
SCR_M_v_Link_SetAdditionalLong(SCR_fnp_st_Link_SetValue(&g_st3DOSLinkTable.stState, szSectionName, (unsigned long)h_State), 1, nLen);
/*
h_InitialState = fn_h3dDataGetInitialState(p_stEngineObject->h_3dData);
if(h_InitialState)
{
if (!strcmpi(h_InitialState->szStateName, szSectionName))
{
TMP_M_Free(h_InitialState);
fn_v3dDataSetInitialState(p_stEngineObject->h_3dData, h_State);
}
}
*/
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(long*)szEntry)
{
case lTagAnimation : /* */
{
/* OS Note : animation files should be loaded only after .tbl files*/
/* Maybe I should move this loading in PostProcess.*/
char* szAnimFile = (char*)LDT_M_malloc(_MAX_PATH+2);
/**** load the animation file ****/
strcpy(szSectionName,fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType));
strcat(szSectionName,"\\");
strcat(szSectionName, LDT_szGetParam(1));
strcpy(szAnimFile, szSectionName);
LDT_AddToRefsTable( g_hRefSTA, (void *)pLink, 0, 2, szAnimFile, p_stFamily);
}
break;
case lTagNextState : /* */
{
char * szP;
szP = LDT_szGetParam(1);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeState , p_stFamily);
h_NextState = (tdxHandleToState) TMP_M_p_Malloc(strlen(szP)+1);
strcpy((char *)h_NextState, szP);
fn_vSetNextStateInState(h_State,h_NextState);
}
break;
case lTagSpeed : /* */
{
fn_vSetSpeedInState(h_State,(signed char)atoi(LDT_szGetParam(1)));
}
break;
case lTagRepeat : /* */
{
fn_vSetRepeatAnimationInState(h_State,(unsigned char)(atoi(LDT_szGetParam(1)) - 1) );
}
break;
case lTagTransitionStatusFlag : /* */
{
if(!strcmpi(LDT_szGetParam(1), C_Value_TransitionAllowedByDefault))
{
fn_vSetTransitionStatusFlagInState(h_State,0);
}
else
{
fn_vSetTransitionStatusFlagInState(h_State,1);
}
}
break;
case lTagAddTargetState : /* */
{
char * szP;
h_Transition = fn_h_TransitionAlloc();
LST2_M_StaticInitElement(h_Transition);
szP = LDT_szGetParam(1);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeState , p_stFamily);
h_Transition->h_TargetState = (tdxHandleToState) TMP_M_p_Malloc(strlen(szP)+1);
strcpy((char *)h_Transition->h_TargetState, szP);
szP = LDT_szGetParam(2);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeState , p_stFamily);
h_Transition->h_StateToGo = (tdxHandleToState) TMP_M_p_Malloc(strlen(szP)+1);
strcpy((char *)h_Transition->h_StateToGo, szP);
if(LDT_iGetNbParams() > 3)
fn_vSetLinkingTypeInTransition(h_Transition,(unsigned char)atoi(LDT_szGetParam(3)));
else
fn_vSetLinkingTypeInTransition(h_Transition,C_ucStandardLink);
LST2_M_StaticAddTail(&h_State->hForTransitionArray, h_Transition);
}
break;
case lTagProhibitedTargetState : /* */
{
char * szP;
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeProhibit , p_stFamily );
h_Prohibit = fn_h_ProhibitAlloc();
LST2_M_StaticInitElement(h_Prohibit);
szP = LDT_szGetParam(1);
h_Prohibit->h_ProhibitedState = (tdxHandleToState) TMP_M_p_Malloc(strlen(szP)+1);
strcpy((char *)h_Prohibit->h_ProhibitedState, szP);
LST2_M_StaticAddTail(&h_State->hForProhibitArray, h_Prohibit);
}
break;
case lTagLinkMechanics : /* */
{
h_State->h_LinkedMechanicsIdCard = LDT_LoadSection(LDT_szGetParam(1));
}
break;
}
}
}
}
return 0;
}
/*****************************************************************
Function name : fn_vSTAPostProcessLDT
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : void
Argument : HREF hRef
*****************************************************************/
void fn_vSTAPostProcessLDT( HREF hRef )
{
LDT_tdst_Link *pLink;
LDT_tdst_Link *pGetFrom;
int iType;
short xCount;
long *pVal;
struct tdstFamilyList_ *p_stFamily;
char* szAnimFile;
tdxHandleToState h_State;
while( LDT_GetRefFromTable( hRef, &pLink, &pGetFrom, &iType, &xCount, &pVal )==0 )
{
h_State = (tdxHandleToState)pLink->pObject;
szAnimFile = (char*)(*pVal);
p_stFamily = (struct tdstFamilyList_ *)(*(pVal+1));
fn_vSetAnimInState(h_State,fn_p_stLoadAnimationFile(szAnimFile,p_stFamily));
if ((h_State->scSpeedAnim<=1)&&h_State->p_stAnim)
{
h_State->scSpeedAnim = h_State->p_stAnim->ucFrameRate;
}
LDT_M_free(szAnimFile);
LDT_FreeRefValues( pVal );
}
}
/*****************************************************************
Function name : fn_vLoadFamilyLDT
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : void
Argument : struct tdstFamilyList_ *p_stFamily
*****************************************************************/
void fn_vLoadFamilyLDT(struct tdstFamilyList_ *p_stFamily)
{
char szFileName[_MAX_PATH];
/*char szSectionName[_MAX_PATH];*/
/*SCR_tdst_Link_Value * _p_stLinkValue;*/
LDT_tdst_Link* pLink;
/* load of the default Objects table for this family*/
sprintf(szFileName,"%s\\%s.tbl",fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType),fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType));
/* if (SCR_fn_c_RdL0_IsSectionExists(szFileName))*/
if (!LDT_SearchFile(szFileName, NULL))
{
pLink = LDT_GetLink(szFileName);
if (pLink)
{
p_stFamily->h_DefaultObjectsTable = (tdxHandleToObjectsTablesList)pLink->pObject;
}
else
{
void* p_vLS;
p_vLS = LDT_LoadSection(szFileName);
p_stFamily->h_DefaultObjectsTable = (tdxHandleToObjectsTablesList) p_vLS;
fn_vAddAnObjectsTablesInList( p_stFamily,p_stFamily->h_DefaultObjectsTable);
}
}
/* load of the channel references for this family*/
sprintf(szFileName,"%s\\%s.chl",fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType),fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType));
/* if (SCR_fn_c_RdL0_IsSectionExists(szFileName))*/
if (!LDT_SearchFile(szFileName, NULL))
{
LDT_LoadSection(szFileName);
LDT_SetLinkValue(LDT_GetLink(szFileName), (unsigned long)p_stFamily);
}
else
{
/*M_GameFatalError(E_uwGameScriptCallBackCreateNewStateBadTargetState);*/
}
/**** Load All states ****/
sprintf(szFileName,"%s\\%s.sta",fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType),fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType));
/* if (SCR_fn_c_RdL0_IsSectionExists(szFileName))*/
if (!LDT_SearchFile(szFileName, NULL))
{
LDT_tdst_Link* pLink;
LDT_LoadSection(szFileName);
pLink = LDT_GetLink(szFileName);
LDT_SetLinkValue(pLink, (unsigned long)p_stFamily);
}
/* CGHT 14/05/97*/
/**** Load Bounding Volume ****/
sprintf(szFileName,"%s\\%s.bdv",fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType),fn_szFindFamilyTypeNameOfFamilyType(p_stFamily->otObjectFamilyType));
/* if (SCR_fn_c_RdL0_IsSectionExists(szFileName))*/
if (!LDT_SearchFile(szFileName, NULL))
{
#ifndef MP_LDT_CB
SCR_M_RdL0_SetContextLong(C_GrandChildContext, 0, (long)p_stFamily);
SCR_fnp_st_RdL0_AnalyseSection(szFileName, SCR_CDF_uw_Anl_Normal);
#else
LDT_LoadSection( szFileName ); /* MP*/
LDT_SetLinkValue(LDT_GetLink(szFileName), (unsigned long)p_stFamily);
#endif
}
}
/*****************************************************************
Name:
Description: Load callback for LDT
Author: Mircea Petrescu
Date: 7/7/98
Modified:
*****************************************************************/
int fn_iCreateSetBoundingVolume( LDT_tdst_Link *pLink )
{
LDT_SetLinkValue( pLink, LDT_GetLinkValue( pLink->pParent ));
return 0;
}
/*****************************************************************
Name:
Description: Load callback for LDT
Author: Mircea Petrescu
Date: 7/7/98
Modified:
*****************************************************************/
int fn_iLoadSetBoundingVolume( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
struct tdstFamilyList_ * p_stFamily=(struct tdstFamilyList_ *)LDT_GetLinkValue( pLink );
VIG_fn_vAddToProgressBar(1);
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(long*)szEntry)
{
case 'nuoB' : /* BoundingVolume */
case 'BteS' : /* SetBoundingVolume */
#if defined (ACTIVE_EDITOR)
p_stFamily->hGeometricSphere = (ACP_tdxHandleOfObject)LDT_LoadSection( LDT_szGetParam( 1 ) );
#else
LDT_LoadSection( LDT_szGetParam( 1 ) );
#endif
LDT_AddToRefsTable( hRefBDV, pLink, 0 , 0 );
}
}
}
}
return 0;
}
void GAM_vPostProcessLDT( HREF hRef )
{
LDT_tdst_Link *pLink;
LDT_tdst_Link *pGetFrom;
int iType;
short xCount;
long *pVal;
MTH3D_tdstVector stCenter;
MTH_tdxReal xRadius;
ACP_tdxHandleOfObject hGeometricSphere;
while( LDT_GetRefFromTable( hRef, &pLink, &pGetFrom, &iType, &xCount, &pVal )==0 )
{
struct tdstFamilyList_ * p_stFamily=(struct tdstFamilyList_ *)LDT_GetLinkValue( pLink );
hGeometricSphere=(ACP_tdxHandleOfObject)pGetFrom->pObject;
GEO_fn_vGetInfoFromGeometricSphere(&stCenter, &xRadius, hGeometricSphere);
GEO_fn_vCreateBoundingSphere(&p_stFamily->hBoundingSphere);
GEO_fn_vSetBoundingSphere(p_stFamily->hBoundingSphere, &stCenter, xRadius);
}
}

View File

@@ -0,0 +1,937 @@
#if defined (WIN32)
#include <direct.h>
#endif /* WIN32 */
#define D_Dynam_StructureDefine
#include "ToolsCPA.h"
#include "Main.h"
#include "Options/Options.h"
#include "macros.h"
#include "Main.h"
#include "Actions/AllActs.h"
#include "Structur/3DOSLkTb.h"
#include "Structur/GameScpt.h"
#include "Structur/ErrGame.h"
#include "Structur/MemGame.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "Structur/Objects.h"
#include "PlayAnim/PlayAnim.h"
#include "Engine.h"
#include "Always.h"
#include "Basic.h"
#include "DspFix.h"
#include "Family.h"
#include "GameEng.h"
#include "GamSave.h"
#include "ia_dnm.h"
#include "InitEng.h"
#include "LoadAni.h"
#include "LoadFml.h"
#include "LoadLvl.h"
#include "MainChar.h"
#include "micros.h"
#include "ObjInit.h"
#include "ObjType.h"
#include "Zemem.h"
#include "LoadBin.h"
#include "TBLLoad.h"
#include "CHLLoad.h"
#include "Structur/Anim_s.h"
#include "toolmatr.h"
#include "AlwAct.h"
#include "LoadGame.h"
#include "options\Specif\SubMapPs.h"
#ifndef U64
#include "sna.h"
/*
extern tdstEngineObject *g_a20_stSNAObjectsInFix[20];
extern unsigned long g_ulSNANbObjectsInFix;
*/
#endif
/* ANNECY AV DEMO {*/
#ifndef U64
#include "Specif/Demos.h"
#endif
/* END ANNECY AV }*/
#ifdef ACTIVE_EDITOR
extern ACP_tdxBool g_bUseSAIWithEditor;
#endif /* ACTIVE_EDITOR */
#include "ldt.h"
/* need for game installations with no sound on hard drive*/
extern int g_iSoundOnHD;
#define lTagNumberOfAlways 'bmuN'
#define lTagLoadSoundEvent 'daoL'
#define lTagBeginMapSoundEvent 'igeB'
#define lTagLinkCharacter 'tcar'
#define lTagMatrixTranslation 'snar'
#define lTagMatrixRotation 'tato'
#define lTagMatrixScale 'elac'
#define lTagInitialState 'tatS'
#define lTagCharacterIsAlwaysActive 'sIre'
#define lTagCharacterFlags 'lFre'
#define lTagTransparency 'cner'
#define lTagLinkCharacter2 'kniL'
#define lTagInitialState2 'tinI'
HREF g_hRefCharacters1;
HREF g_hRefCharacters2;
HREF g_hRefCharacters3;
HREF g_hRefCharacters4;
HREF g_hRefAlways;
/*****************************************************************
Function name : fn_iCreateLevelDescription
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iCreateLevelDescription( LDT_tdst_Link *pLink )
{
g_bBeginMapSoundEventFlag = FALSE;
return 0;
}
/*****************************************************************
Function name : fn_iLoadLevelDescription
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iLoadLevelDescription( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
SND_tduRefEvt stSndThemeEvent;
if ( SNA_M_bTestSaveLevelDesc() )
SNA_fn_vWriteNoParamEntryToCurrentDscFile( SNA_C_ul_LevelDscTitle );
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(long*)szEntry)
{
case lTagNumberOfAlways : /* */
{
g_stAlways.ulMaxNumberOfAlways = atoi(LDT_szGetParam(1));
if ( SNA_M_bTestSaveLevelDesc() )
SNA_fn_vWriteLongEntryToCurrentDscFile( SNA_C_ul_NumberOfAlways, atoi(LDT_szGetParam(1)) );
}
break;
case lTagLoadSoundEvent : /* */
{
/* OS NOTE : never get here*/
#ifndef U64
if (g_iSoundOnHD)
#endif
{
/* play theme while level loading only if the sound is on the Hard Drive*/
/* Load theme event for this level:*/
stSndThemeEvent.pstPtr=(SND_tdstBlockEvent *)LDT_LoadSection(LDT_szGetParam(1));
/* OS NOTE : this should be moved in postprocess ???*/
SND_fn_lSendRequestSound(/*C_SOUNDOBJECT_MUSIC*/SND_C_OBJET_FANTOME,g_lSoundObjectTypeMusic,stSndThemeEvent,0/*prio*/,NULL/*Proc=NULL*/);
}
}
break;
case lTagBeginMapSoundEvent : /* */
{
/* OS NOTE : never get here*/
g_stBeginMapSoundEvent.pstPtr=(SND_tdstBlockEvent *)LDT_LoadSection(LDT_szGetParam(1));
g_bBeginMapSoundEventFlag = TRUE;
}
break;
}
}
}
}
if ( SNA_M_bTestSaveLevelDesc() )
SNA_fn_vWriteNoParamEntryToCurrentDscFile( SNA_C_ulEndOfDescSection );
return 0;
}
/*****************************************************************
Function name : fn_iCreateCharacters
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iCreateCharacters( LDT_tdst_Link *pLink ) /* CB for 'InsertCharacter' section of '.lvl' files*/
{
pLink->pObject = NULL;
return 0;
}
/*****************************************************************
Function name : fn_iLoadCharacters
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iLoadCharacters( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
HIE_tdxHandleToSuperObject h_SupObject = (HIE_tdxHandleToSuperObject)pLink->pObject;
tdstEngineObject *p_stEngineObject = NULL;
int nNoP, i;
char *szParam;
char g_szCharacterSection[MAX_PATH];
ACP_tdxBool g_bMainCharacter,g_bMainCamera;
ACP_tdxBool g_bLaunchingSound;
nNoP = LDT_iGetNbParams();
g_bLaunchingSound = g_bMainCharacter = g_bMainCamera = FALSE;
for (i = 1; i < nNoP; i++)
{
szParam = LDT_szGetParam(i);
if( !g_bMainCharacter )
if( stricmp(szParam,C_LevelPrincipalCharacter) == 0 )
{ g_bMainCharacter = TRUE; continue; }
if( !g_bLaunchingSound )
if( stricmp(szParam,C_LevelCharacterLauchingSounds) == 0 ||
stricmp(szParam,C_LevelCharacterLaunchingSounds) == 0 )
{ g_bLaunchingSound = TRUE; continue; }
if( !g_bMainCamera )
if( stricmp(szParam,C_LevelStandardCamera) == 0 )
g_bMainCamera = TRUE;
}
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(long*)(szEntry+7))
{
case lTagLinkCharacter : /* */
{
VIG_fn_vAddToProgressBar(1);
strcpy( g_szCharacterSection, LDT_szGetParam(1));
/* Chars in the fix are created here (actually only a part of the creation is done).*/
if( GAM_fn_bIsEngineInFixMode() )
{
/* Here is where FIX's chars are created*/
h_SupObject=HIE_fn_hCreateSuperObject();
pLink->pObject = (void*)h_SupObject;
/* ANNECY AV DEMO {*/
/* DEMO_fn_vPutCharacterInList (h_SupObject);*/
/* END ANNECY AV }*/
/* Rq : it's useless to set the SectionLong with this handle, */
/* because the current section is in Game.fix and we need to access */
/* the handle at level loading time...*/
/* Parse char scripts and create it's engine object.*/
p_stEngineObject=(tdstEngineObject *)LDT_LoadSection(LDT_szGetParam(1));
LDT_AddToRefsTable( g_hRefCharacters1, (void *)pLink, 0, 0 );
}
}
break;
case lTagMatrixTranslation : /* */
{
if (!GAM_fn_bIsEngineInFixMode())
{
char *szCharacterSection = (char*)LDT_M_malloc(MAX_PATH);
MTH3D_tdstVector* stTempMatrixTranslation = (MTH3D_tdstVector*)LDT_M_malloc(sizeof(MTH3D_tdstVector));
HIE_tdxHandleToSuperObject h_SOSector;
strcpy(szCharacterSection, g_szCharacterSection);
/* ANNECY MT - 08/09/98 {*/
if( (fn_lGetSubMapNumber()!=0) && g_stEngineStructure.bResurection && (g_bMainCamera || g_bMainCharacter))
{
if(g_bMainCamera)
POS_fn_vGetTranslationVector(&g_stEngineStructure.stMainCameraPosition, stTempMatrixTranslation);
else if(g_bMainCharacter)
POS_fn_vGetTranslationVector(&g_stEngineStructure.stMainCharacterPosition, stTempMatrixTranslation);
}
else
{
MTH3D_M_vSetVectorElements(stTempMatrixTranslation,
(float)atof (LDT_szGetParam(1)), (float)atof (LDT_szGetParam(2)), (float)atof (LDT_szGetParam(3)) );
}
/* END ANNECY MT }*/
/**/
h_SOSector=SECT_fn_hResearchInWhatSectorIAm(SECT_hFatherSector, stTempMatrixTranslation);
p_stEngineObject=(tdstEngineObject *)LDT_LoadSection(g_szCharacterSection);
LDT_AddToRefsTable( g_hRefCharacters2, (void *)pLink, 1, 5, stTempMatrixTranslation, g_bMainCharacter, g_bMainCamera, g_bLaunchingSound, szCharacterSection);
}
}
break;
case lTagMatrixRotation : /* */
{
MTH3D_tdstVector *stTempRotationVX, *stTempRotationVY, *stTempRotationVZ;
stTempRotationVX = (MTH3D_tdstVector*)LDT_M_malloc(sizeof(MTH3D_tdstVector));
stTempRotationVY = (MTH3D_tdstVector*)LDT_M_malloc(sizeof(MTH3D_tdstVector));
stTempRotationVZ = (MTH3D_tdstVector*)LDT_M_malloc(sizeof(MTH3D_tdstVector));
if( (fn_lGetSubMapNumber()!=0) && g_stEngineStructure.bResurection && (g_bMainCamera || g_bMainCharacter))
{
if(g_bMainCamera)
POS_fn_vGetRotationMatrix(&g_stEngineStructure.stMainCameraPosition,stTempRotationVX,stTempRotationVY,stTempRotationVZ);
else if(g_bMainCharacter)
POS_fn_vGetRotationMatrix(&g_stEngineStructure.stMainCharacterPosition,stTempRotationVX,stTempRotationVY,stTempRotationVZ);
}
else
{
MTH3D_M_vSetVectorElements(stTempRotationVX,
(float)atof (LDT_szGetParam(1)), (float)atof (LDT_szGetParam(2)), (float)atof (LDT_szGetParam(3)) );
MTH3D_M_vSetVectorElements(stTempRotationVY,
(float)atof (LDT_szGetParam(4)), (float)atof (LDT_szGetParam(5)), (float)atof (LDT_szGetParam(6)) );
MTH3D_M_vSetVectorElements(stTempRotationVZ,
(float)atof (LDT_szGetParam(7)), (float)atof (LDT_szGetParam(8)), (float)atof (LDT_szGetParam(9)) );
}
LDT_AddToRefsTable( g_hRefCharacters3, (void *)pLink, 2, 3, stTempRotationVX, stTempRotationVY, stTempRotationVZ);
}
break;
case lTagMatrixScale : /* */
{
MTH3D_tdstVector *stTempScaleVX, *stTempScaleVY, *stTempScaleVZ;
stTempScaleVX = (MTH3D_tdstVector*)LDT_M_malloc(sizeof(MTH3D_tdstVector));
stTempScaleVY = (MTH3D_tdstVector*)LDT_M_malloc(sizeof(MTH3D_tdstVector));
stTempScaleVZ = (MTH3D_tdstVector*)LDT_M_malloc(sizeof(MTH3D_tdstVector));
if( (fn_lGetSubMapNumber()!=0) && g_stEngineStructure.bResurection && (g_bMainCamera || g_bMainCharacter))
{
if(g_bMainCamera)
POS_fn_vGetScaleMatrix(&g_stEngineStructure.stMainCameraPosition,stTempScaleVX,stTempScaleVY,stTempScaleVZ);
else if(g_bMainCharacter)
POS_fn_vGetScaleMatrix(&g_stEngineStructure.stMainCharacterPosition,stTempScaleVX,stTempScaleVY,stTempScaleVZ);
}
else
{
MTH3D_M_vSetVectorElements(stTempScaleVX,
(float)atof (LDT_szGetParam(1)), (float)atof (LDT_szGetParam(2)), (float)atof (LDT_szGetParam(3)) );
MTH3D_M_vSetVectorElements(stTempScaleVY,
(float)atof (LDT_szGetParam(4)), (float)atof (LDT_szGetParam(5)), (float)atof (LDT_szGetParam(6)) );
MTH3D_M_vSetVectorElements(stTempScaleVZ,
(float)atof (LDT_szGetParam(7)), (float)atof (LDT_szGetParam(8)), (float)atof (LDT_szGetParam(9)) );
}
LDT_AddToRefsTable( g_hRefCharacters3, (void *)pLink, 3, 3, stTempScaleVX, stTempScaleVY, stTempScaleVZ);
}
break;
case lTagInitialState : /* */
{
if (!GAM_fn_bIsEngineInFixMode())
{
char *szP1 = (char*)LDT_M_malloc(_MAX_PATH);
strcpy(szP1, LDT_szGetParam(1));
LDT_AddToRefsTable( g_hRefCharacters3, (void *)pLink, 4, 1, szP1);
}
}
break;
case lTagCharacterIsAlwaysActive : /* */
{
if (!GAM_fn_bIsEngineInFixMode())
{
LDT_AddToRefsTable( g_hRefCharacters3, (void *)pLink, 5, 0);
}
}
break;
case lTagCharacterFlags : /* */
{
if (!GAM_fn_bIsEngineInFixMode())
{
unsigned long ulFlags;
ulFlags = atol( LDT_szGetParam(1) );
ulFlags &= ~HIE_C_Flag_ulSuperimposed;
LDT_AddToRefsTable( g_hRefCharacters3, (void *)pLink, 6, 1, ulFlags);
/*HIE_fn_SO_vSetFlags(h_SupObject, ulFlags);*/
}
}
break;
case lTagTransparency : /* */
{
float* fTransparenceLevel = (float*)LDT_M_malloc(sizeof(float));
*fTransparenceLevel = (float) atof( LDT_szGetParam(1) ) ;
LDT_AddToRefsTable( g_hRefCharacters3, (void *)pLink, 7, 1, fTransparenceLevel);
/*HIE_fn_vSetSuperObjectTransparenceLevel( h_SupObject, (float) atof( LDT_szGetParam(1) ) );*/
}
break;
}
}
}
}
if (!GAM_fn_bIsEngineInFixMode())
{
LDT_AddToRefsTable( g_hRefCharacters4, (void *)pLink, 6, 1, p_stEngineObject);
}
return 0;
}
/*****************************************************************
Function name : fn_vCharactersPostProcessLDT1
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : void
Argument : HREF hRef
*****************************************************************/
void fn_vCharactersPostProcessLDT1( 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 )
{
HIE_tdxHandleToSuperObject h_SupObject = (HIE_tdxHandleToSuperObject)pLink->pObject;
tdstEngineObject *p_stEngineObject = (tdstEngineObject *)pGetFrom->pObject;
HIE_fn_vSetSuperObjectObjectAndType(h_SupObject,(void *)p_stEngineObject,HIE_C_ulActor);
M_SetSuperObject(p_stEngineObject, h_SupObject);
/* Actors have zoom instead of scale*/
HIE_fn_SO_vSetFlags (h_SupObject, HIE_fn_SO_ulGetFlags (h_SupObject) | HIE_C_Flag_ulZoomInsteadOfScale);
HIE_fn_vSetSuperObjectMatrix(h_SupObject,fn_p_st3dDataGetMatrix(M_GetMSHandle(h_SupObject,3dData)));
SNA_g_stFixInfo.a20_stObjects[SNA_g_stFixInfo.ulNbObject]=p_stEngineObject;
SNA_g_stFixInfo.ulNbObject++;
}
}
/*****************************************************************
Function name : fn_vCharactersPostProcessLDT2
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : void
Argument : HREF hRef
*****************************************************************/
void fn_vCharactersPostProcessLDT2( 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 1:
{
tdstEngineObject *p_stEngineObject = (tdstEngineObject *)(pGetFrom->pObject);
MTH3D_tdstVector* stTempMatrixTranslation = (MTH3D_tdstVector*)(pVal[0]);
ACP_tdxBool bMainCharacter = (ACP_tdxBool)(pVal[1]);
ACP_tdxBool bMainCamera = (ACP_tdxBool)(pVal[2]);
ACP_tdxBool bLaunchingSound = (ACP_tdxBool)(pVal[3]);
char *szCharacterSection = (char*)(*(pVal+4));
HIE_tdxHandleToSuperObject h_SupObject;
/* Get the SuperObject of the EngineObject.*/
h_SupObject=M_GetSuperObject(p_stEngineObject);
/* Test if SuperObject has already been created*/
/* (if so, char is in the fix (good),or is loaded twice in a level(bad!)).*/
if( ! h_SupObject )
{
/* SuperObject does not exists, create it and do the init*/
/* Here is where LEVEL's chars are created*/
h_SupObject=HIE_fn_hCreateSuperObject();
/* ANNECY AV DEMO {*/
/* DEMO_fn_vPutCharacterInList (h_SupObject);*/
/* END ANNECY AV }*/
HIE_fn_vSetSuperObjectObjectAndType(h_SupObject,(void *)p_stEngineObject,HIE_C_ulActor);
M_SetSuperObject(p_stEngineObject,h_SupObject);
/* Actors have zoom instead of scale*/
HIE_fn_SO_vSetFlags (h_SupObject, HIE_fn_SO_ulGetFlags (h_SupObject) | HIE_C_Flag_ulZoomInsteadOfScale);
}
pLink->pObject = (void*)h_SupObject;
if ( fn_ucStandardGameGetPlatFormType(M_GetMSHandle(h_SupObject,StandardGame)) )
{
HIE_fn_vSuperObjectAddHead(gp_stDynamicWorld,h_SupObject);
}
else
{
HIE_fn_vSuperObjectAddTail(gp_stDynamicWorld,h_SupObject);
}
HIE_fn_vSetSuperObjectMatrix(h_SupObject,fn_p_st3dDataGetMatrix(M_GetMSHandle(h_SupObject,3dData)));
POS_fn_vSetTranslationVector(fn_p_st3dDataGetMatrix(M_GetMSHandle(h_SupObject,3dData)),stTempMatrixTranslation);
/* Now take care of its flags defined in the title :*/
if( bMainCharacter )
MC_fn_vAddCharacterInMainCharacterList(h_SupObject);
if( bLaunchingSound )
fn_vSectInfoSetCharacterLauchingEvents( h_SupObject );
if( bMainCamera )
g_stEngineStructure.h_StdCamCaracter = h_SupObject;
LDT_M_free(stTempMatrixTranslation);
LDT_M_free(szCharacterSection);
LDT_FreeRefValues( pVal );
}
break;
}
}
}
/*****************************************************************
Function name : fn_vCharactersPostProcessLDT3
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : void
Argument : HREF hRef
*****************************************************************/
void fn_vCharactersPostProcessLDT3( 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 )
{
HIE_tdxHandleToSuperObject h_SupObject = (HIE_tdxHandleToSuperObject)pLink->pObject;
switch (iType)
{
case 2:
{
MTH3D_tdstVector *stTempRotationVX, *stTempRotationVY, *stTempRotationVZ;
stTempRotationVX = (MTH3D_tdstVector*)(*pVal);
stTempRotationVY = (MTH3D_tdstVector*)(*(pVal+1));
stTempRotationVZ = (MTH3D_tdstVector*)(*(pVal+2));
POS_fn_vSetRotationMatrix(fn_p_st3dDataGetMatrix(M_GetMSHandle(h_SupObject,3dData)),
stTempRotationVX,stTempRotationVY,stTempRotationVZ ) ;
LDT_M_free(stTempRotationVX);
LDT_M_free(stTempRotationVY);
LDT_M_free(stTempRotationVZ);
LDT_FreeRefValues( pVal );
}
break;
case 3:
{
MTH3D_tdstVector *stTempScaleVX, *stTempScaleVY, *stTempScaleVZ;
stTempScaleVX = (MTH3D_tdstVector*)(*pVal);
stTempScaleVY = (MTH3D_tdstVector*)(*(pVal+1));
stTempScaleVZ = (MTH3D_tdstVector*)(*(pVal+2));
POS_fn_vSetScaleMatrix (fn_p_st3dDataGetMatrix(M_GetMSHandle(h_SupObject,3dData)),
stTempScaleVX,stTempScaleVY,stTempScaleVZ ) ;
LDT_M_free(stTempScaleVX);
LDT_M_free(stTempScaleVY);
LDT_M_free(stTempScaleVZ);
LDT_FreeRefValues( pVal );
}
break;
case 4:
{
char *szP1 = (char*)(*pVal);
char szCompletFileName[_MAX_PATH];
SCR_tdst_Link_Value *p_xIndex;
strcpy(szCompletFileName,fn_szGetFamiliesDataPath());
strcat(szCompletFileName,"\\");
strcat(szCompletFileName, szP1);
p_xIndex = SCR_fnp_st_Link_SearchKey(&g_st3DOSLinkTable.stState,szCompletFileName);
if (p_xIndex!=NULL&&p_xIndex->eState==SCR_ELS_Link_Initialized)
fn_v3dDataSetInitialState(M_GetMSHandle(h_SupObject,3dData),(tdxHandleToState)(p_xIndex->ulValue));
LDT_M_free(szP1);
LDT_FreeRefValues( pVal );
}
break;
case 5:
{
fn_vAddCharacterInAlwaysActiveCharacterList(h_SupObject);
}
break;
case 6:
{
HIE_fn_SO_vSetFlags(h_SupObject, (unsigned long)(*pVal));
LDT_FreeRefValues( pVal );
}
break;
case 7:
{
float *fTransparenceLevel = (float*)(*pVal);
HIE_fn_vSetSuperObjectTransparenceLevel( h_SupObject, *fTransparenceLevel);
LDT_M_free(fTransparenceLevel);
LDT_FreeRefValues( pVal );
}
}
}
}
/*****************************************************************
Function name : fn_vCharactersPostProcessLDT4
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : void
Argument : HREF hRef
*****************************************************************/
void fn_vCharactersPostProcessLDT4( 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 )
{
HIE_tdxHandleToSuperObject h_SupObject = (HIE_tdxHandleToSuperObject)pLink->pObject;
tdstEngineObject *p_stEngineObject = (tdstEngineObject *)(*pVal);
POS_fn_vUpdateMatrixType( fn_p_st3dDataGetMatrix(M_GetMSHandle(h_SupObject,3dData)) );
LDT_FreeRefValues(pVal);
}
}
/*****************************************************************
Function name : fn_iLoadLevelAlways
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iLoadLevelAlways( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
tdstEngineObject *p_stEngineObject = NULL;
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(long*)szEntry)
{
case lTagLinkCharacter2 : /* */
{
VIG_fn_vAddToProgressBar(1);
p_stEngineObject=(tdstEngineObject *)LDT_LoadSection(LDT_szGetParam(1));
LDT_AddToRefsTable( g_hRefAlways, (void *)pLink, 0, 1, p_stEngineObject);
}
break;
case lTagInitialState2 : /* */
{
char* szP1 = (char*)LDT_M_malloc(_MAX_PATH);
strcpy(szP1, LDT_szGetParam(1));
LDT_AddToRefsTable( g_hRefAlways, (void *)pLink, 1, 2, szP1, p_stEngineObject);
}
break;
}
}
}
}
return 0;
}
/*****************************************************************
Function name : fn_vAlwaysPostProcessLDT
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : void
Argument : HREF hRef
*****************************************************************/
void fn_vAlwaysPostProcessLDT( 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:
{
tdstEngineObject *p_stEngineObject=(tdstEngineObject *)(*pVal);
if( !fn_ucIsAnAlwaysModel( p_stEngineObject ) )
fn_vAddAnAlwaysModel(p_stEngineObject);
if( GAM_fn_bIsEngineInFixMode() )
{
SNA_g_stFixInfo.a20_stObjects[SNA_g_stFixInfo.ulNbObject]=p_stEngineObject;
SNA_g_stFixInfo.ulNbObject++;
SNA_g_stFixInfo.h_LastAlwaysInTheFix = LST2_M_DynamicGetLastElement(&(g_stAlways.ALW_h_LstAlwaysModel));
}
LDT_FreeRefValues(pVal);
}
break;
case 1:
{
char *szP1 = (char*)(*pVal);
char szCompletFileName[_MAX_PATH];
SCR_tdst_Link_Value *p_xIndex;
tdstEngineObject *p_stEngineObject=(tdstEngineObject *)(*(pVal+1));
strcpy(szCompletFileName,fn_szGetFamiliesDataPath());
strcat(szCompletFileName,"\\");
strcat(szCompletFileName, szP1);
p_xIndex = SCR_fnp_st_Link_SearchKey(&g_st3DOSLinkTable.stState,szCompletFileName);
if (p_xIndex!=NULL&&p_xIndex->eState==SCR_ELS_Link_Initialized)
fn_v3dDataSetInitialState(p_stEngineObject->h_3dData, (tdxHandleToState)(p_xIndex->ulValue));
LDT_M_free(szP1);
LDT_FreeRefValues( pVal );
}
break;
}
}
}
extern HREF hRefCSB;
/*BEGIN FS 9/11/98*/
/*----------------------------------------------------------------------
* Description: callback for LevelSoundBank from .FIX sript file
*----------------------------------------------------------------------
* Input:
* Output:
*----------------------------------------------------------------------
* Author: FS
* Creation date:9/11/98
* Modif date:
*----------------------------------------------------------------------*/
int LoadLevelSoundBank( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
char *szEntryName;
int iBankId;
/* int iLoadSoundBankBlocks;*/
/*Working for BeginSection*/
/* gs_ucLoadCondSoundBlocksFlag = TRUE;*/
if (SNA_M_bTestSaveGameDesc() || SNA_M_bTestSaveLevelDesc())
SNA_fn_vWriteNoParamEntryToCurrentDscFile( SNA_C_ul_LevelDscLevelSoundBanks );
SND_fn_bStartLoadBanks();
/* Working for Entries*/
result=LDT_GetNextEntry();
while( result!=ParseResult_EndSection )
{
if (result!=ParseResult_BeginSection)
{ /*Entries*/
szEntryName=LDT_szGetEntryName();
switch (*(long*)(szEntryName+4/*+"Load"*/))
{
case 'paM': /*"LoadMap"*/
if (SCR_fn_c_RdL0_IsSectionExists(LDT_szGetParam(1)))
{
LDT_LoadSection(LDT_szGetParam(1));
if ( SNA_M_bTestSaveGameDesc() || SNA_M_bTestSaveLevelDesc() )
{
SNA_fn_vWriteStringEntryToCurrentDscFile(SNA_C_ul_LevelLoadMap,LDT_szGetParam(1));
}
}
break;
case 'nuoS': /*"LoadSoundBank"*/
iBankId=atoi(LDT_szGetParam(1));
if ( SNA_M_bTestSaveGameDesc() || SNA_M_bTestSaveLevelDesc() )
{
SNA_fn_vWriteLongEntryToCurrentDscFile(SNA_C_ul_LevelLoadSoundBank,(long)iBankId);
}
SND_fn_bInitBank(iBankId);
break;
}/*end switch*/
}
else
{ /*SubSection*/
szEntryName=LDT_szGetEntryName();
switch (*(long*)(szEntryName))
{
case 'nuoS': /*"SoundBanksBlock" -- not used*/
LDT_LoadSection(NULL);
}/*end switch*/
}
result=LDT_GetNextEntry();
}/*end while*/
/*Working for EndSection*/
if ( SNA_M_bTestSaveGameDesc() || SNA_M_bTestSaveLevelDesc() )
SNA_fn_vWriteNoParamEntryToCurrentDscFile( SNA_C_ulEndOfDescSection );
LDT_AddToRefsTable( hRefCSB, pLink, 10, 0);
return 0;
}
/*END FS 9/11/98*/
/*BEGIN FS 9/11/98*/
/*----------------------------------------------------------------------
* Description: callback for LevelSoundBankBlock section from .FIX sript file
*----------------------------------------------------------------------
* Input:
* Output:
*----------------------------------------------------------------------
* Author: FS
* Creation date:9/11/98
* Modif date:
*----------------------------------------------------------------------*/
int LoadLevelSoundBankBlock( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
char *szEntryName;
int iBlockValue,iBankId;
/*Working for BeginSection*/
iBlockValue=atoi(LDT_szGetParam(1));
/* Working for Entries*/
result=LDT_GetNextEntry();
while( result!=ParseResult_EndSection )
{
szEntryName=LDT_szGetEntryName();
switch (*(long*)(szEntryName))
{
case 'daoL': /*"LoadSoundBank"*/
iBankId=atoi(LDT_szGetParam(1));
SND_fn_bInitBank(iBankId);
break;
}/*end switch*/
result=LDT_GetNextEntry();
}/*end while*/
return 0;
}
/*END FS 9/11/98*/

View File

@@ -0,0 +1,472 @@
#if defined (WIN32)
#include <stdio.h>
#endif /* WIN32 */
/* to be Friend*/
#define D_ObjsTbls_Define
#define D_State_Define
#include "ToolsCPA.h"
#include "Sna.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/3DOSLkTb.h"
#include "Structur/Objects.h"
#include "Structur/ErrGame.h"
#include "Structur/GameScpt.h"
#include "Structur/MemGame.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "ObjType.h"
#include "Basic.h"
#include "Family.h"
#include "ZeMem.h"
#include "Structur/ObjsTbls.h"
#include "TBLLoad.h"
#include "Structur/anim_s.h"
#include "ldt.h"
#define lTagVersionNumber 'sreV'
#define lTagMaximumIndex 'ixaM'
#define lTagDuplicate 'lpuD'
#define lTagPHY 'HP'
#define lTagMIRROR 'RRIM'
#define lTagLipsSynchro 'spiL'
#define lTagCustomZoom 'tsuC'
#define lTagObjectType 'ejbO'
#define lTagGenericEvent 'eneG'
#define lTagFirstCall 'sriF'
#define lTagPeriod 'ireP'
#define lTagPriority 'oirP'
#define lTagSoundEvent 'nuoS'
/* global for TBL Link Table*/
extern SCR_tdst_Link_Table TBL_g_stLinkTable;
HREF g_hRefTBL;
#define iTBLGeneral 1
/*****************************************************************
Function name : fn_iCreateTBLFile
Description : call-back for header section of TBL script file
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iCreateTBLFile( LDT_tdst_Link *pLink ) /* for .tbl files*/
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeTBLList , 0 );
pLink->pObject = (void*)fn_hObjectsTablesListAlloc();
return 0;
}
/*****************************************************************
Function name : fn_iLoadTBLHeader
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iLoadTBLHeader( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
char szSectionName[_MAX_PATH];
tdxHandleToObjectsTablesList h_ObjectsTablesListElement = (tdxHandleToObjectsTablesList)pLink->pParent->pObject;
LDT_SetFileLong(10, 0); /* flag Duplicate*/
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(long*)szEntry)
{
case lTagVersionNumber : /* VersionNumber */
{
/* not used yet*/
/*gs_wTBLFileVersion = (short)atoi(LDT_szGetParam(1));*/
}
break;
case lTagMaximumIndex : /* MaximumIndex */
{
MMG_fn_vBeginMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeTBLElement , h_ObjectsTablesListElement );
fn_vObjectsTablesAlloc(h_ObjectsTablesListElement, (unsigned short)atoi(LDT_szGetParam(1)) );
MMG_fn_vEndMemoryInfo();
strcpy (szSectionName, fn_szGetFamiliesDataPath());
strcat(szSectionName, "\\");
strcat(szSectionName, pLink->szFile);
SCR_fnp_st_Link_SetValue(&TBL_g_stLinkTable, szSectionName, (unsigned long)h_ObjectsTablesListElement);
h_ObjectsTablesListElement -> wZDxUsed = 0; /* For the moment, no Zdd and no Zde*/
}
break;
case lTagDuplicate : /* Duplicate */
{
LDT_SetFileLong(10, 1); /* flag Duplicate*/
}
break;
}
}
}
}
return 0;
}
/*****************************************************************
Function name : fn_iLoadTBLGeneral
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iLoadTBLGeneral( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
long l_NumberInTable;
tdxHandleToObjectsTablesList h_ObjectsTablesListElement = (tdxHandleToObjectsTablesList)pLink->pParent->pObject;
long l_FlagDuplicate;
/* static int i = 0;*/
/* char s[180], s1[300];*/
l_NumberInTable = atoi(LDT_szGetSectionName());
pLink->pObject = pLink->pParent->pObject;
l_FlagDuplicate = LDT_GetFileLong(10);
/* LDT_ComputeSectionName( pLink , s1 );*/
/* i++;*/
/* sprintf(s, "%d.%s\n", i, s1);*/
/* OutputDebugString(s);*/
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
if ( *(short *)szEntry == lTagPHY )
{
PO_tdxHandleToPhysicalObject hPO;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].wTypeOfTarget = C_wTdO_PhysicalObject;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].h_Target = hPO = CS_fn_xLoadPhysicalObject(LDT_szGetParam(1));
LDT_AddToRefsTable( g_hRefTBL, (void *)pLink, iTBLGeneral, 2, l_FlagDuplicate, hPO );
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].uwChannelNumber=255;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].ucPhoneme=255;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].ucIntensity=255;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].ucExpression=255;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].p_stCustomZoom=NULL;
#ifdef _DEBUG
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].wCounter=0;
#endif
}
else if ( *(long *)szEntry == lTagMIRROR)
{
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].wTypeOfTarget = C_wTdO_Mirror;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].h_Target = CS_fn_xLoadPhysicalObject(LDT_szGetParam(1));
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].uwChannelNumber=255;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].ucPhoneme=255;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].ucIntensity=255;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].ucExpression=255;
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].p_stCustomZoom=NULL;
#ifdef _DEBUG
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].wCounter=0;
#endif
}
else if ( *(long *)szEntry == lTagLipsSynchro)
{
char * szP2;
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeTBLElement , h_ObjectsTablesListElement );
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].uwChannelNumber=(unsigned long)TMP_M_p_Malloc(strlen(LDT_szGetParam(1))+1);
strcpy((char *)h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].uwChannelNumber, LDT_szGetParam(1));
szP2 = LDT_szGetParam(2);
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].ucPhoneme=(unsigned char)(szP2[0]-'A');
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].ucIntensity=(unsigned char)atoi(LDT_szGetParam(3));
if (!stricmp("Neutral", LDT_szGetParam(4)))
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].ucExpression=0;
#ifdef _DEBUG
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].wCounter=0;
#endif
}
else if ( *(long *)szEntry == lTagCustomZoom)
{
float f0,f4,f8;
f0 = (float)atof(LDT_szGetParam(1));
f4 = (float)atof(LDT_szGetParam(5));
f8 = (float)atof(LDT_szGetParam(9));
if( f0!=1.0f || f4!=1.0f || f8!=1.0f )
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeTBLElement , h_ObjectsTablesListElement );
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].p_stCustomZoom = (MTH3D_tdstVector *)M_p_GameMallocInHLM(sizeof(struct MTH3D_tdstVector_));
MTH3D_M_vSetVectorElements(h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].p_stCustomZoom, f0, f4, f8);
}
}
}
}
}
return 0;
}
/*****************************************************************
Function name : fn_vTBLPostProcessLDT
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : void
Argument : HREF hRef
*****************************************************************/
void fn_vTBLPostProcessLDT( 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 iTBLGeneral:
{
tdxHandleToObjectsTablesList h_ObjectsTablesListElement = (tdxHandleToObjectsTablesList)pLink->pObject;
PO_tdxHandleToPhysicalObject hPO = (PO_tdxHandleToPhysicalObject)pVal[1];
if (PO_fn_hGetCollideSet (hPO))
{
if (PCS_fn_hGetGeoObjOfPhysicalCollSet (C_ucTypeZdd , PO_fn_hGetCollideSet (hPO)))
h_ObjectsTablesListElement->wZDxUsed |= C_wObjectTableHasZdd;
if (PCS_fn_hGetGeoObjOfPhysicalCollSet (C_ucTypeZde , PO_fn_hGetCollideSet (hPO)))
h_ObjectsTablesListElement->wZDxUsed |= C_wObjectTableHasZde;
}
if((long)(*pVal))
fn_vDuplicateObjectTable(h_ObjectsTablesListElement);
LDT_FreeRefValues(pVal);
}
break;
}
}
}
extern HREF hRefCSB;
void fn_PostProcess1CSB(HREF hRefCSB);
extern struct tdstEventInTable_* GAM_fn_p_stCreateEventInTBL();
/*****************************************************************
Function name : fn_iLoadTBLEvent
Description :
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
Creation Date : 13-Oct-98
Modified :
Return type : int
Argument : LDT_tdst_Link *pLink
*****************************************************************/
int fn_iLoadTBLEvent( LDT_tdst_Link *pLink )
{
LDT_tdeParseResult result=ParseResult_BeginSection;
tdxHandleToObjectsTablesList h_ObjectsTablesListElement = (tdxHandleToObjectsTablesList)pLink->pParent->pObject;
long l_NumberInTable;
tdstEventInTable* p_stEvent;
l_NumberInTable = atoi(LDT_szGetSectionName());
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].wTypeOfTarget=C_wTdO_Event;
MMG_fn_vAddMemoryInfo( MMG_C_lTypeFamily , MMG_C_lSubTypeTBLElement , h_ObjectsTablesListElement );
p_stEvent = GAM_fn_p_stCreateEventInTBL();
h_ObjectsTablesListElement->d_stObjectsTable[l_NumberInTable-1].h_Target=(void*)p_stEvent;
while( result!=ParseResult_EndSection )
{
result=LDT_GetNextEntry();
switch( result )
{
case ParseResult_Entry: /* an entry */
{
char *szEntry=LDT_szGetEntryName();
switch (*(long*)szEntry)
{
case lTagObjectType : /* ObjectType */
{
if (!stricmp("GenericEvent",LDT_szGetParam(1)))
{
p_stEvent->ucTypeOfEvent=C_ucGENERIC_EVENT;
}
else if(!stricmp("MechanicEvent",LDT_szGetParam(1)))
{
p_stEvent->ucTypeOfEvent=C_ucMECHANIC_EVENT;
}
else if(!stricmp("SoundEvent",LDT_szGetParam(1)))
{
p_stEvent->ucTypeOfEvent=C_ucSOUND_EVENT;
}
else if(!stricmp("GenerateEvent",LDT_szGetParam(1)))
{
p_stEvent->ucTypeOfEvent=C_ucGENERATE_EVENT;
}
}
break;
case lTagGenericEvent : /* GenericEvent */
{
long lEvent;
char * szP1 = LDT_szGetParam(1);
lEvent=(long)p_stEvent->p_xEvent;
if (!strcmp(szP1,"TakeObjectEvent"))
{
lEvent|=C_ucTAKE_OBJECT_EVENT;
}
else
if (!strcmp(szP1,"TakeInObjectEvent"))
{
lEvent|=C_ucTAKE_IN_OBJECT_EVENT;
}
else
if (!strcmp(szP1,"TakeOutObjectEvent"))
{
lEvent|=C_ucTAKE_OUT_OBJECT_EVENT;
}
else
if (!strcmp(szP1,"DropObjectEvent"))
{
lEvent|=C_ucDROP_OBJECT_EVENT;
}
else
if (!strcmp(szP1,"ThrowObjectEvent"))
{
lEvent|=C_ucTHROW_OBJECT_EVENT;
}
else if ( (strncmp( szP1,"User", 4 ) == 0) && (szP1[5] == 0) )
{
unsigned char ucUserEvent;
ucUserEvent = (unsigned char) (szP1[4] - '0');
if (ucUserEvent < 8)
lEvent |= (unsigned char) (C_ucEvent_User0 + ucUserEvent);
}
p_stEvent->p_xEvent=(void*)lEvent;
}
break;
case lTagFirstCall : /* FirstCall */
{
p_stEvent->ucFirstCall = (unsigned char)atoi(LDT_szGetParam(1));
}
break;
case lTagPeriod : /* Period */
{
p_stEvent->ucPeriod = (unsigned char)atoi(LDT_szGetParam(1));
}
break;
case lTagPriority : /* Priority */
{
p_stEvent->ucPriority = (unsigned char)atoi(LDT_szGetParam(1));
}
break;
case lTagSoundEvent : /* SoundEvent */
{
LDT_LoadSection(LDT_szGetParam(1));
LDT_AddToRefsTable(hRefCSB,pLink,1,1,p_stEvent);
/* -> OS : THIS CODE SHOULD BE CHANGED 27-Aug-98 (is not used)*/
/* SCR_tdst_Cxt_Values* p_stValue;*/
/**/
/* p_stValue=SCR_fnp_st_RdL0_AnalyseSection(LDT_szGetParam(1), SCR_CDF_uw_Anl_Normal);*/
/* p_stEvent->p_xEvent=(void*)SCR_M_ul_RdL0_ExtractLongValue(p_stValue, 0);*/
/* p_stEvent->ulBinaryEventId=SCR_M_ul_RdL0_ExtractLongValue(p_stValue, 1); // used for the binarisation only*/
/* <- OS : THIS CODE SHOULD BE CHANGED 27-Aug-98*/
/* we save the id of the sound event and the pointer on the structure that contains the id and the pointer of the sound event */
/* SNA_fn_vWriteSoundEntryInSoundTableFile(SND_fn_ulGetEventBinIdFromPointer(p_stEvent->p_xEvent),(unsigned long)p_stEvent);*/
/* p_stEvent->ulBinaryEventId=SND_fn_ulGetEventBinIdFromPointer(p_stEvent->p_xEvent);*/
}
break;
}
}
}
}
return 0;
}
/*BEGIN FS 10/7/98*/
void fn_PostProcess1CSB(HREF hRefCSB)
{
tdstEventInTable* p_stEvent;
int iType=1;
short shCount=1;
long *pVal;
LDT_tdst_Link *pObj, *pGetFrom;
while (!(LDT_GetRefFromTable(hRefCSB, &pObj, &pGetFrom, &iType, &shCount, &pVal )))
{
switch(iType)
{
case 10:
SND_fn_bEndLoadBanks();
break;
case 1:
p_stEvent=(tdstEventInTable*)pVal[0];
LDT_FreeRefValues(pVal);
p_stEvent->p_xEvent=(void*)pGetFrom->pObject;
p_stEvent->ulBinaryEventId=(unsigned long)LDT_RemoveLinkValue(pGetFrom); /* used for the binarisation only*/
SNA_fn_vWriteSoundEntryInSoundTableFile(SND_fn_ulGetEventBinIdFromPointer(p_stEvent->p_xEvent),(unsigned long)p_stEvent);
p_stEvent->ulBinaryEventId=SND_fn_ulGetEventBinIdFromPointer(p_stEvent->p_xEvent);
}
}
}
/*END FS 10/7/98*/

View File

@@ -0,0 +1,139 @@
/*ANNECY CT 20/02/98{*/
#include "TOOLSCPA.h"
#include "GAM.H"
#include "PlayAnim/Anim.h"
#include "ZeMem.h"
#include "GAM\STRUCTUR\anim_s.h"
#include "gam/actions/3ddata.h"
/*******************************************************/
/* Function : fn_vFreeJustStructAnim*/
/* Input : Animation*/
/**/
/* Free just the structure (pointer fields are not freed)*/
/**/
/* Create : 20/02/98 Carlos Torres*/
/*******************************************************/
/*void fn_vFreeJustStructAnim(tdstAnim3d * p_stAnim) {
M_GameFreeInHLM(p_stAnim);
}*/
/*******************************************************/
/* Function : fn_vFreeSubStructAnim*/
/* Input : Animation*/
/**/
/* Free sub structure in the animation structure*/
/* the structre tdstAnim3d is not freed*/
/**/
/* Create : 20/02/98 Carlos Torres*/
/* Modif : Free Morphing table (Carlos Torres) 06/03/98*/
/*******************************************************/
/*void fn_vFreeSubStructAnim(tdstAnim3d * p_stAnim)
{
int iFrame,j;
if (!p_stAnim)
return;
// free Frame Table
if (p_stAnim->d_stFrame3d) {
tdstFrame3d * p_stFrame3d;
MTH3D_tdstVector * p_stPreviousLinearSpeedVector=NULL;
MTH3D_tdstMatrix * p_stPreviousAngularSpeedMatrix=NULL;
tdstPLA_Hierarchy * p_stPreviousHierarchy=NULL;
// free all frames
for(iFrame=0,p_stFrame3d=p_stAnim->d_stFrame3d;iFrame<p_stAnim->uwNumberOfFrames;iFrame++,p_stFrame3d++) {
tdstElement3d * p_stElement3d;
// Free Element table
for(j=0,p_stElement3d=p_stFrame3d->p_stArrayOfElts3d;j<p_stAnim->ucMaxNumberOfElements;j++,p_stElement3d++)
{
if (iFrame==1)
{
M_GameFreeInHLM(p_stElement3d->stMatrix);
}
else if (!POS_fn_vIsMatrixIdentityConst(p_stElement3d->stMatrix))
{
POS_M_GameFree(p_stElement3d->stMatrix);
}
}
//del table of element
M_GameFreeInHLM(p_stFrame3d->p_stArrayOfElts3d);
// free speed if different from the previous
if (p_stFrame3d->p_stAngularSpeedMatrix != p_stPreviousAngularSpeedMatrix) {
p_stPreviousAngularSpeedMatrix = p_stFrame3d->p_stAngularSpeedMatrix;
M_GameFreeInHLM(p_stFrame3d->p_stAngularSpeedMatrix);
}
if (p_stFrame3d->p_stLinearSpeedVector != p_stPreviousLinearSpeedVector) {
p_stPreviousLinearSpeedVector = p_stFrame3d->p_stLinearSpeedVector;
M_GameFreeInHLM(p_stFrame3d->p_stLinearSpeedVector);
}
// free hierarchy if different from the previous
if (p_stFrame3d->p_stHierarchy != p_stPreviousHierarchy) {
p_stPreviousHierarchy = p_stFrame3d->p_stHierarchy;
M_GameFreeInHLM(p_stFrame3d->p_stHierarchy->d_stCouples);
M_GameFreeInHLM(p_stFrame3d->p_stHierarchy);
}
}
M_GameFreeInHLM(p_stAnim->d_stFrame3d);
}
// Free Event Table
if (p_stAnim->d_stAnimEvent) {
M_GameFreeInHLM(p_stAnim->d_stAnimEvent);
}
// Free light Table
if (p_stAnim->p_stLights) {
GLI_tdstLight ** p_p_stLight;
for(j=0,p_p_stLight=p_stAnim->p_stLights->a_p_stLights;j<p_stAnim->p_stLights->uwNumberOfLights;j++,p_p_stLight++)
M_GameFreeInHLM(*p_p_stLight);
M_GameFreeInHLM(p_stAnim->p_stLights->a_p_stLights);
M_GameFreeInHLM(p_stAnim->p_stLights->a_hLightsInSector);
M_GameFreeInHLM(p_stAnim->p_stLights);
}
}*/
/*ENDANNECY CT}*/
/*******************************************************/
/* Function : ANI_fn_vFreeze*/
/* Input : Super Object*/
/**/
/* Freeze tha animation of the character*/
/* no more treat by the anim player*/
/**/
/* Create : 13/03/98 Carlos Torres*/
/*******************************************************/
void ANI_fn_vFreeze(HIE_tdxHandleToSuperObject hSuperObjPerso) {
MS_tdxHandleTo3dData h_Current3dData = M_GetMSHandle(hSuperObjPerso,3dData);
/* set speed to zero (if not freeze)*/
if (fn_uc3dDataGetFrameRate(h_Current3dData))
fn_v3dDataSetFrameRate(h_Current3dData,0);
}
/*******************************************************/
/* Function : ANI_fn_vUnFreeze*/
/* Input : Super Object*/
/**/
/* UnFreeze tha animation of the character*/
/* animation restart at the freezed frame*/
/**/
/* Create : 13/03/98 Carlos Torres*/
/*******************************************************/
void ANI_fn_vUnFreeze(HIE_tdxHandleToSuperObject hSuperObjPerso) {
MS_tdxHandleTo3dData h_Current3dData = M_GetMSHandle(hSuperObjPerso,3dData);
if (!fn_uc3dDataGetFrameRate(h_Current3dData)) {
/* reset speed*/
fn_v3dDataSetFrameRate(h_Current3dData,fn_scGetSpeedInState(fn_h3dDataGetCurrentState(h_Current3dData)));
/* reinit current frame*/
PLA_fn_vSetCurrFrame(hSuperObjPerso,(short)(fn_uw3dDataGetCurrentFrame(h_Current3dData)+1));
}
}

View File

@@ -0,0 +1,843 @@
/* ***********************************************************************************/
/* * "a3x_cach.c" **/
/* * Written by : S<>bastien Rubens **/
/* * Tabulations : 4 char **/
/* ***********************************************************************************/
#define A3X_CACH_C
/* ***********************************************************************************/
/* Included files*/
#include "PlayAnim/Interpol/specif/a3x_pref.h"
/*#define LST2_StaticIsOptimised*/
#include "TOOLSCPA.h"
#include "cpa_std.h"
#include "STRUCTUR/Anim_s.h"
#include "STRUCTUR/Engmode.h"
#ifdef A3X_N64
#include "u_dma.h"
#include "memload.h"
#include "ZeMem.h"
#endif
#include "PlayAnim/Interpol/a3x_glob.h"
#include "PlayAnim/Interpol/a3x_load.h"
#include "PlayAnim/Interpol/a3x_mem.h"
#include "PlayAnim/Interpol/a3x_cach.h"
#define UseCompressedAnimations
#ifdef U64
#include "RastMem.h"
#endif /* U64 */
/* ***************************************************************************************************/
#ifdef UseCompressedAnimations
extern void slidstart( unsigned char *, unsigned char * );
#endif
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
unsigned short uwMaxInStackFrame3d= 0, uwMaxInStackElement3d= 0;
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
char *p_cLoadAnimBuf;
char *p_cCompressedAnimBuf;
/*AR9901 For debug -> to be removed !*/
#ifdef ANIM_DEBUG
char* g_p_cSecurityMalloc;
#endif /*ANIM_DEBUG*/
/* ***************************************************************************************************/
unsigned short uwMaxNumberOfAnims= 2000;
/* Input cache*/
#ifdef A3X_CacheIsUsed
#define NbCacheLists 5
#endif
/* Output cache*/
#define uwMaxInTabFrame3d 100
#define uwMaxInTabElement3d 1000
#ifdef A3X_N64
extern char _animsSegmentRomStart[];
extern char _animsSegmentRomEnd[];
#ifndef FORCE_REAL_TIME_LOAD
extern char _anims_rawSegmentRomStart[];
extern char _anims_rawSegmentRomEnd[];
#endif
extern char _shortAnimsSegmentRomStart[];
extern char _shortAnimsSegmentRomEnd[];
extern char _a3dheaderSegmentRomStart[];
extern char _a3dheaderSegmentRomEnd[];
#ifdef A3X_CUT
extern char _cuttableSegmentRomStart[];
extern char _cuttableSegmentRomEnd[];
#endif
#endif
/* Max size of cutted animation*/
#define MaxSizeOfList (MaxRAMSizeOfAnim/1024)
/* ***************************************************************************************************/
/* Input cache*/
#ifdef A3X_N64
unsigned long ulNbIntAnims;
unsigned long *p_ulAnimOffsets;
#endif
#ifdef A3X_CacheIsUsed
unsigned long ulMaxRamSizeOfAnim, ulMaxRomSizeOfAnim;
char *p_cBigMalloc;
tdstCacheLine *p_stCacheLine;
tdstA3dHeader *p_stA3dHeaders;
char *p_cMemBlocs;
unsigned short ax_uwCacheList[NbCacheLists]; /* Tete de liste*/
unsigned short ax_uwCacheListNbElt[]= /* Nombre de cases par zone*/
{
25, /* Zone 1*/
8,
7,
7,
10
};
unsigned short ax_uwCacheListSize[]=
{
1,
3,
5,
7,
10,
(MaxSizeOfList+1)
};
unsigned short ax_uwSizeToList[MaxSizeOfList];
unsigned long ulNumberOfCacheLines;
#endif
/* ***************************************************************************************************/
unsigned short *p_uwLastA3dGENERAL;
/* ***************************************************************************************************/
/* Output cache*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
unsigned long ulLastEngineFrame= 0xFFFFFFFF;
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*tdstOutputCacheLine ax_stOutputCacheLine[uwMaxInTabFrame3d]; // Useless now... AR9808*/
#ifdef A3X_N64
/* Global variables used by loading functions*/
char* g_p_cROMAnimBlocStart=_animsSegmentRomStart;
#ifdef ANIM_DEBUG
char* g_p_cROMAnimBlocStop=_animsSegmentRomEnd;
#endif
#endif
#ifndef FORCE_REAL_TIME_LOAD
int g_bRealTimeAnimationLoad = FALSE;
#endif
#ifdef A3X_N64
/*-----------------------------------------------------------------------------
* Name : fn_vInitROMLoad
*-----------------------------------------------------------------------------
* Description : Initialise the ROM loading system for the animation
* (Real time load or use memory extension)
*-----------------------------------------------------------------------------
* Input :
* Output :
*-----------------------------------------------------------------------------
* Creation date : Oct 98 Author : Al1
*-----------------------------------------------------------------------------*/
#ifndef FORCE_REAL_TIME_LOAD
void fn_vInitROMLoad(void)
{
#ifdef A3X_REAL_TIME_LOAD
g_p_cROMAnimBlocStart=_animsSegmentRomStart;
g_p_cROMAnimBlocStop=_animsSegmentRomEnd;
g_bRealTimeAnimationLoad=TRUE;
return;
#endif /*A3X_REAL_TIME_LOAD*/
if(osMemSize>4194304) /* memory available > 4M*/
{
/* Here we can load all the animation in RAM*/
g_p_cROMAnimBlocStart=_anims_rawSegmentRomStart;
g_p_cROMAnimBlocStop=_anims_rawSegmentRomEnd;
g_bRealTimeAnimationLoad=FALSE;
}
else
{
/* Here we must use real time load system*/
g_p_cROMAnimBlocStart=_animsSegmentRomStart;
g_p_cROMAnimBlocStop=_animsSegmentRomEnd;
g_bRealTimeAnimationLoad=TRUE;
}
}
#endif
#endif /*A3X_N64*/
/* ***************************************************************************************************/
#ifdef A3X_N64
void *fn_p_ReadAnimFromROM( unsigned short _uwNumOfIntAnim )
{
#ifdef A3X_N64
#ifdef ANIM_DEBUG
if ( _uwNumOfIntAnim >= ulNbIntAnims )
{
osSyncPrintf("fn_p_ReadAnimFromROM1 : num<75>ro d'animation trop grand\n");
osSyncPrintf("fn_p_ReadAnimFromROM1 : _uwNumOfIntAnim = %d\n", _uwNumOfIntAnim );
ASM_BREAK;
}
if ( g_p_cROMAnimBlocStart + (0x7FFFFFFF & p_ulAnimOffsets[_uwNumOfIntAnim + 1]) > g_p_cROMAnimBlocStop )
{
osSyncPrintf("fn_p_ReadAnimFromROM2 : chargement d'anims trop grand\n");
osSyncPrintf("fn_p_ReadAnimFromROM2 : _uwNumOfIntAnim = %d\n", _uwNumOfIntAnim );
ASM_BREAK;
}
#endif /*ANIM_DEBUG*/
#endif
#ifdef UseCompressedAnimations
if (p_ulAnimOffsets[_uwNumOfIntAnim] & 0x80000000)
{
LDR_fn_vLoadFromROM( ( g_p_cROMAnimBlocStart + (0x7FFFFFFF & p_ulAnimOffsets[_uwNumOfIntAnim] )),
( g_p_cROMAnimBlocStart + (0x7FFFFFFF & p_ulAnimOffsets[_uwNumOfIntAnim + 1]) ),
p_cCompressedAnimBuf,
MSG_BLOCK );
slidstart(p_cCompressedAnimBuf, p_cLoadAnimBuf);
}
else
#endif
LDR_fn_vLoadFromROM( ( g_p_cROMAnimBlocStart + p_ulAnimOffsets[_uwNumOfIntAnim] ),
( g_p_cROMAnimBlocStart + (0x7FFFFFFF & p_ulAnimOffsets[_uwNumOfIntAnim + 1]) ),
p_cLoadAnimBuf,
MSG_BLOCK );
return ((void *) p_cLoadAnimBuf);
}
#endif
/* ***************************************************************************************************/
#ifdef A3X_CUT
tdstShortA3dGENERAL *fn_p_ReadShortAnimFromROM( unsigned short _uwNumOfIntAnim )
{
LDR_fn_vLoadFromROM( ( _shortAnimsSegmentRomStart + _uwNumOfIntAnim * sizeof(tdstShortA3dGENERAL) ),
( _shortAnimsSegmentRomStart + (_uwNumOfIntAnim + 1) * sizeof(tdstShortA3dGENERAL) ),
p_cLoadAnimBuf,
MSG_BLOCK );
return ((tdstShortA3dGENERAL *) p_cLoadAnimBuf);
}
/* ***************************************************************************************************/
#endif
#ifdef A3X_CacheIsUsed
void *fn_p_Align16( void *p_vPointer )
{
if ( (((unsigned long) p_vPointer) & 0x0000000F) != 0x00000000 )
return ( (void *) ((((unsigned long) p_vPointer) & 0xFFFFFFF0) + 0x00000010) );
else return p_vPointer;
}
#endif
/* ***************************************************************************************************/
#ifdef A3X_CacheIsUsed
void fn_v_CacheAllocation( void )
{
/* p_stOutputCacheLine= (tdstOutputCacheLine *) fn_p_Align16( p_cBigMalloc );*/
p_stCacheLine= (tdstCacheLine *) fn_p_Align16( p_cBigMalloc );
p_ulAnimOffsets= (unsigned long *) fn_p_Align16( &p_stCacheLine[ulNumberOfCacheLines] );
/*HP980806*/
/* p_stFrame3d= (tdstFrame3d *) fn_p_Align16( &p_ulAnimOffsets[1 + ulNbIntAnims] );*/
/* p_p_stElement3d= (tdstElement3d* *) fn_p_Align16( &p_stFrame3d[uwMaxInTabFrame3d] );*/
/* p_stAngularSpeedMatrix= (MTH3D_tdstMatrix *) fn_p_Align16( &p_p_stElement3d[uwMaxInTabElement3d] );*/
/* p_stHierarchy= (tdstPLA_Hierarchy *) fn_p_Align16( &p_stAngularSpeedMatrix[uwMaxInTabFrame3d] );*/
/* p_stElement3d= (tdstElement3d *) fn_p_Align16( &p_stHierarchy[uwMaxInTabFrame3d] );*/
/* p_stPosMatrix= (POS_tdstCompletePosition *) fn_p_Align16( &p_stElement3d[uwMaxInTabElement3d] ); */
/* p_cLoadAnimBuf= (char *) fn_p_Align16( &p_stPosMatrix[uwMaxInTabElement3d] );*/
p_cLoadAnimBuf= (char *) fn_p_Align16( &p_ulAnimOffsets[1 + ulNbIntAnims] );
/* p_cCompressedAnimBuf= (char *) fn_p_Align16( &p_cLoadAnimBuf[ulMaxRamSizeOfAnim] );*/
p_stA3dHeaders= (tdstA3dHeader *) fn_p_Align16( &p_cLoadAnimBuf[ulMaxRamSizeOfAnim] );
#ifdef A3X_CUT
p_uwLastA3dGENERAL= (unsigned short *) fn_p_Align16( &p_stA3dHeaders[ulNbIntAnims] );
p_stCuttedAnim= (tdstCuttedAnim *) fn_p_Align16( &p_uwLastA3dGENERAL[ulNbIntAnims] );
p_cMemBlocs= (char *) fn_p_Align16( &p_stCuttedAnim[ulNbIntAnims] );
#else
p_cMemBlocs= (char *) fn_p_Align16( &p_stA3dHeaders[ulNbIntAnims] );
#endif
}
#endif
#ifdef A3X_CacheIsUsed
/* ***************************************************************************************************/
void fn_v_InitCache( void )
{
unsigned long ulNumOfAnim;
unsigned long ulStart, ulNumInSizeToList, ulOld, ulCnt2;
unsigned long ulNbElem, ulNumOfBloc;
unsigned long ulCnt1;
#ifndef FORCE_REAL_TIME_LOAD
if(g_bRealTimeAnimationLoad)
{
#endif
#if defined(FINAL_VERSION) && !defined(FINAL_VERSION_FOR_TESTERS)
/* When we are in final version mode, we can increase the anim cache */
if(osMemSize>C_4Megs) /* RAM xtension detected */
{
ax_uwCacheListNbElt[0]+=250;
ax_uwCacheListNbElt[1]+=80;
ax_uwCacheListNbElt[2]+=100;
ax_uwCacheListNbElt[3]+=140;
ax_uwCacheListNbElt[4]+=180;
}
#endif /* defined(FINAL_VERSION) && !defined(FINAL_VERSION_FOR_TESTERS) */
/* ----------------------------------------------------------------------------------------------*/
/* Init ax_uwSizeToList table*/
ulNumInSizeToList= 0;
ulOld= 0;
for ( ulCnt1=0 ; ulCnt1<NbCacheLists ; ulCnt1++ )
{
for ( ulCnt2=ulOld ; ulCnt2<ax_uwCacheListSize[ulCnt1] ; ulCnt2++ )
ax_uwSizeToList[ulNumInSizeToList++]= (unsigned short) ulCnt1;
ulOld= ax_uwCacheListSize[ulCnt1];
}
/* ----------------------------------------------------------------------------------------------*/
/* Init p_stCacheLine table*/
ulNumberOfCacheLines= 0;
for ( ulCnt1=0 ; ulCnt1<NbCacheLists ; ulCnt1++ )
ulNumberOfCacheLines+= ax_uwCacheListNbElt[ulCnt1];
/* ----------------------------------------------------------------------------------------------*/
/* p_cBigMalloc= (char *) M_p_GameMallocInHLM( (uwMaxNumberOfAnims+1L)*sizeof(unsigned long) ); // WithoutFree !!!*/
p_cBigMalloc= (char *) fn_pvAllocTmp( (uwMaxNumberOfAnims+1L)*sizeof(unsigned long), 16 ); /* WithFree*/
/* Read number of animations*/
p_ulAnimOffsets= (unsigned long *) fn_p_Align16( p_cBigMalloc );
LDR_fn_vLoadFromROM( ( g_p_cROMAnimBlocStart ),
( g_p_cROMAnimBlocStart + 3*sizeof(unsigned long) ),
(char *) p_ulAnimOffsets,
MSG_BLOCK );
ulNbIntAnims= *((unsigned long *) &p_ulAnimOffsets[0]);
ulMaxRamSizeOfAnim= *((unsigned long *) &p_ulAnimOffsets[1]);
ulMaxRomSizeOfAnim= *((unsigned long *) &p_ulAnimOffsets[2]);
fn_vFreeRomTmp( (void *)p_cBigMalloc ); /* Oliv'*/
#ifdef UseCompressedAnimations
GEO_M_CPAMalloc(p_cCompressedAnimBuf,char *,ulMaxRomSizeOfAnim+16,E_uwGEONotEnoughtMemory);
p_cCompressedAnimBuf=(char*)fn_p_Align16(p_cCompressedAnimBuf); /* 16 bytes aligned for DMA transferts*/
#endif /*UseCompressedAnimations*/
/* ----------------------------------------------------------------------------------------------*/
/* Set relatives pointers*/
p_cBigMalloc= NULL;
fn_v_CacheAllocation();
/* Calculate memory size to allocate*/
ulNumOfAnim= ((unsigned long) p_cMemBlocs) - ((unsigned long) p_cBigMalloc);
for ( ulCnt1=0 ; ulCnt1<NbCacheLists ; ulCnt1++ )
ulNumOfAnim+= ax_uwCacheListSize[ulCnt1] * 1024L * ax_uwCacheListNbElt[ulCnt1];
/* Allocate memory*/
#ifdef U64
RM_fn_vInitAddInfo();
#endif /* U64 */
GEO_M_CPAMalloc(p_cBigMalloc,char *,ulNumOfAnim+16,E_uwGEONotEnoughtMemory); /* +16 because the address allocated can be not aligned to 16 chars !*/
#ifdef U64
RM_fn_vAddInfo(eAnimPlayerCach,eSubAnimPlayerCach,eGeo);
#endif /* U64 */
fn_v_CacheAllocation();
M_PrintfN64((" Malloc animations = %d octets\n", ulNumOfAnim));
#ifdef ANIM_DEBUG
/* 1Ko added For security ! AR9901*/
GEO_M_CPAMalloc(g_p_cSecurityMalloc,char *,1024,E_uwGEONotEnoughtMemory);
memset(g_p_cSecurityMalloc,0xA1,1024);
#endif /*ANIM_DEBUG*/
/* ----------------------------------------------------------------------------------------------*/
/* Used in fn_p_GetEventsAddress to get last cutted animation A3dGENERAL (avoid first cutted animation loading)*/
for ( ulCnt1=0 ; ulCnt1<ulNbIntAnims ; ulCnt1++ )
p_uwLastA3dGENERAL[ulCnt1]= (unsigned short) ulCnt1;
/* ----------------------------------------------------------------------------------------------*/
/* Init p_stCacheLine table*/
ulNumOfBloc= 0;
ulStart= 0;
for ( ulCnt1=0 ; ulCnt1<NbCacheLists ; ulCnt1++ )
{ ax_uwCacheList[ulCnt1]= (unsigned short) ulStart; /* Beginning of list*/
ulNbElem= ax_uwCacheListNbElt[ulCnt1];
for ( ulCnt2=0 ; ulCnt2<ulNbElem ; ulCnt2++ )
{
p_stCacheLine[ulStart + ulCnt2].slCacheValue= -4096;
p_stCacheLine[ulStart + ulCnt2].uwNumOfA3dHeader= SEB_Invalid;
p_stCacheLine[ulStart + ulCnt2].uwNumOfMemBloc= (unsigned short) ulNumOfBloc;
p_stCacheLine[ulStart + ulCnt2].uwNext= (unsigned short) (ulStart + ulCnt2 + 1);
p_stCacheLine[ulStart + ulCnt2].uwPrev= (unsigned short) (ulStart + ulCnt2 - 1);
ulNumOfBloc+= ax_uwCacheListSize[ulCnt1];
}
p_stCacheLine[ulStart].uwPrev= (unsigned short) (ulStart + ulNbElem - 1);
p_stCacheLine[ulStart + ulNbElem - 1].uwNext= (unsigned short) ulStart;
ulStart+= ulNbElem;
}
/* ----------------------------------------------------------------------------------------------*/
/* Read all animations offsets (p_ulAnimOffsets table)*/
LDR_fn_vLoadFromROM( ( g_p_cROMAnimBlocStart + 4*sizeof(unsigned long) ),
( g_p_cROMAnimBlocStart + ((5 + ulNbIntAnims) * sizeof(unsigned long)) ),
(char *) p_ulAnimOffsets,
MSG_BLOCK );
/* Init p_stA3dHeaders table*/
/* for ( ulCnt1=0 ; ulCnt1<ulNbIntAnims ; ulCnt1++ )
{ tdstFileA3dAnimationGENERAL *p_stFileA3dAnimationGENERAL;
unsigned long ulSizeOfAnim;
fn_p_ReadAnimFromROM(ulCnt1);
p_stFileA3dAnimationGENERAL= (tdstFileA3dAnimationGENERAL *) p_cLoadAnimBuf;
ulSizeOfAnim= sizeof(tdstA3dGENERAL) +
sizeof(tdxVector3) * (unsigned long) p_stFileA3dAnimationGENERAL->uwNumberOfVectors +
sizeof(tdxSShortQuater4)* (unsigned long) p_stFileA3dAnimationGENERAL->uwNumberOfQuaternions +
sizeof(tdstHierarchy) * (unsigned long) p_stFileA3dAnimationGENERAL->uwNumberOfHierarchies +
sizeof(tdstNTTO) * (unsigned long) p_stFileA3dAnimationGENERAL->uwNumberOfSavedNTTO +
sizeof(tdstOnlyFrame) * (unsigned long) (p_stFileA3dAnimationGENERAL->uwEndFrame - p_stFileA3dAnimationGENERAL->uwStartFrame) +
sizeof(tdstChannel) * (unsigned long) p_stFileA3dAnimationGENERAL->uwNumberOfChannels +
sizeof(tdstFrame) * (unsigned long) p_stFileA3dAnimationGENERAL->uwNumberOfSavedFrames *
(unsigned long) p_stFileA3dAnimationGENERAL->uwNumberOfChannels +
sizeof(tdstFrameKF) * (unsigned long) (p_stFileA3dAnimationGENERAL->uwEndFrame - p_stFileA3dAnimationGENERAL->uwStartFrame) *
(unsigned long) p_stFileA3dAnimationGENERAL->uwNumberOfChannels;
if ( ((ulSizeOfAnim) & 0x0002) != 0x0000 )
ulSizeOfAnim+= 2;
ulSizeOfAnim+= sizeof(tdstKeyFrame) * (unsigned long) p_stFileA3dAnimationGENERAL->uwNumberOfKeyFrames +
sizeof(tdstEvent) * (unsigned long) p_stFileA3dAnimationGENERAL->uwNumberOfEvents;
/* alignment*/
/* while ( ((ulSizeOfAnim) % 4) != 0 )
ulSizeOfAnim++;
ulSizeOfAnim+= sizeof(tdstMorphData) * (unsigned long) p_stFileA3dAnimationGENERAL->uwNumberOfMorphData; /*AR9804*/
/*#ifdef ANIM_DEBUG
/* if (ulSizeOfAnim > MaxRAMSizeOfAnim)
{
osSyncPrintf("fn_v_InitCache (ulCnt1= %d) : ulSizeOfAnim (%d) > %d\n", ulCnt1, ulSizeOfAnim, MaxRAMSizeOfAnim);
osSyncPrintf(" uwNumberOfVectors = %4d\n", p_stFileA3dAnimationGENERAL->uwNumberOfVectors);
osSyncPrintf(" uwNumberOfQuaternions= %4d\n", p_stFileA3dAnimationGENERAL->uwNumberOfQuaternions);
osSyncPrintf(" uwNumberOfHierarchies= %4d\n", p_stFileA3dAnimationGENERAL->uwNumberOfHierarchies);
osSyncPrintf(" uwNumberOfNTTO = %4d\n", p_stFileA3dAnimationGENERAL->uwNumberOfSavedNTTO);
osSyncPrintf(" uwNumberOfOnlyFrames = %4d\n", (p_stFileA3dAnimationGENERAL->uwEndFrame - p_stFileA3dAnimationGENERAL->uwStartFrame));
osSyncPrintf(" uwNumberOfChannels = %4d\n", p_stFileA3dAnimationGENERAL->uwNumberOfChannels);
osSyncPrintf(" uwNumberOfSavedFrames= %4d\n", p_stFileA3dAnimationGENERAL->uwNumberOfSavedFrames);
osSyncPrintf(" uwNumberOfKeyFrames = %4d\n", p_stFileA3dAnimationGENERAL->uwNumberOfKeyFrames);
osSyncPrintf(" uwNumberOfEvents = %4d\n", p_stFileA3dAnimationGENERAL->uwNumberOfEvents);
osSyncPrintf(" uwNumberOfMorphData = %4d\n", p_stFileA3dAnimationGENERAL->uwNumberOfMorphData);
osSyncPrintf(" uwStartFrame = %4d\n", p_stFileA3dAnimationGENERAL->uwStartFrame);
osSyncPrintf(" uwEndFrame = %4d\n", p_stFileA3dAnimationGENERAL->uwEndFrame);
ASM_BREAK;
}
#endif /*ANIM_DEBUG*/
/* ANTIBUG -------------------------------------------------*/
// AR9904 : Optimisation. Read the a3dheader from the rom
LDR_fn_vLoadFromROM(_a3dheaderSegmentRomStart,_a3dheaderSegmentRomStart+ulNbIntAnims*sizeof(tdstA3dHeader),(char *)p_stA3dHeaders,MSG_BLOCK);
for ( ulCnt1=0 ; ulCnt1<ulNbIntAnims ; ulCnt1++ )
{
unsigned long ulSizeOfAnim;
ulSizeOfAnim=(unsigned long)p_stA3dHeaders[ulCnt1].uwCacheList;
#ifdef ANIM_DEBUG
if (ulSizeOfAnim > MaxRAMSizeOfAnim)
{
osSyncPrintf("Size for %d =%d\n",ulCnt1,ulSizeOfAnim);
ASM_BREAK;
}
#endif /*ANIM_DEBUG*/
if ( (ulSizeOfAnim & 0x03FF) == 0 ) /* mod 1024*/
ulSizeOfAnim= (ulSizeOfAnim >> 10) - 1; /* div 1024 - 1*/
else
ulSizeOfAnim= (ulSizeOfAnim >> 10); /* div 1024*/
p_stA3dHeaders[ulCnt1].uwCacheList= ax_uwSizeToList[ulSizeOfAnim];
}
// }
#ifdef A3X_CUT
LDR_fn_vLoadFromROM( _cuttableSegmentRomStart,
_cuttableSegmentRomEnd,
(char *) p_stCuttedAnim,
MSG_BLOCK );
#endif
#ifndef FORCE_REAL_TIME_LOAD
}
#endif
}
#endif
/* ***************************************************************************************************/
void fn_v_UpdateCache( unsigned short _uwNumOfA3dGENERAL,
unsigned long _ulFrameNumber )
{
#ifdef A3X_CacheIsUsed
register unsigned short uwOffset, uwNumOfCacheList, uwFirstOfCacheList;
#ifdef A3X_N64
#ifdef ANIM_DEBUG
if ( _uwNumOfA3dGENERAL >= ulNbIntAnims )
{
osSyncPrintf("fn_v_UpdateCache : _uwNumOfA3dGENERAL trop grand\n");
osSyncPrintf("_uwNumOfA3dGENERAL = %d\n",_uwNumOfA3dGENERAL);
ASM_BREAK;
}
#endif /*ANIM_DEBUG*/
#endif
uwNumOfCacheList= p_stA3dHeaders[ _uwNumOfA3dGENERAL ].uwCacheList; /* Number of Cache list (static value !)*/
uwOffset= p_stA3dHeaders[ _uwNumOfA3dGENERAL ].uwNumOfCacheEntry; /* NumOfCacheEntry*/
uwFirstOfCacheList= ax_uwCacheList[ uwNumOfCacheList ]; /* First element of the cache list*/
p_stCacheLine[ uwOffset ].slCacheValue= _ulFrameNumber; /* ulFrameNumber*/
if ( uwOffset != uwFirstOfCacheList )
{
while ( ((signed long) _ulFrameNumber > p_stCacheLine[ p_stCacheLine[uwOffset].uwPrev ].slCacheValue) &&
(p_stCacheLine[uwOffset].uwNext != uwFirstOfCacheList) )
{ register unsigned short uwFirst, uwSecond, uwQuat; /* And uwOffset (as third)*/
uwSecond= p_stCacheLine[uwOffset].uwPrev;
uwFirst= p_stCacheLine[uwSecond].uwPrev;
uwQuat= p_stCacheLine[uwOffset].uwNext;
/* And now, we have uwFirst, uwOffset (as second) and uwSecond (as third)*/
p_stCacheLine[uwFirst].uwNext= uwOffset;
p_stCacheLine[uwSecond].uwPrev= uwOffset;
p_stCacheLine[uwSecond].uwNext= uwQuat;
p_stCacheLine[uwOffset].uwPrev= uwFirst;
p_stCacheLine[uwOffset].uwNext= uwSecond;
p_stCacheLine[uwQuat].uwPrev= uwSecond;
}
/* Change first element of CacheList*/
if (p_stCacheLine[uwOffset].uwNext == uwFirstOfCacheList) /* If next element is the old first element*/
ax_uwCacheList[ uwNumOfCacheList ]= uwOffset;
}
#endif
}
/* ***************************************************************************************************/
tdstA3dGENERAL *fn_p_GetA3dGENERAL( unsigned short _uwNumOfA3dGENERAL,
unsigned long _ulFrameNumber )
{
#ifdef A3X_N64
#ifndef FORCE_REAL_TIME_LOAD
if(g_bRealTimeAnimationLoad)
{
#endif
#ifdef ANIM_DEBUG
if ( _uwNumOfA3dGENERAL >= ulNbIntAnims )
{
osSyncPrintf("fn_p_GetA3dGENERAL : _uwNumOfA3dGENERAL trop grand\n");
osSyncPrintf("_uwNumOfA3dGENERAL = %d\n",_uwNumOfA3dGENERAL);
ASM_BREAK;
}
#endif /*ANIM_DEBUG*/
_ulFrameNumber=g_stEngineStructure.stEngineTimer.ulTrameNumber; /*because frame number should be called trame number !*/
if ( p_stA3dHeaders[_uwNumOfA3dGENERAL].uwNumOfCacheEntry == SEB_Invalid )
{ /* Animation is non loaded*/
register unsigned short uwOffset, uwOldestA3dHeader, uwNumOfCacheList;
/* Invalidate oldest cached A3dHeader*/
uwNumOfCacheList= p_stA3dHeaders[ _uwNumOfA3dGENERAL ].uwCacheList; /* Number of Cache list (static value !)*/
uwOffset= ax_uwCacheList[ uwNumOfCacheList ]; /* First element of the cache list*/
uwOffset= p_stCacheLine[ uwOffset ].uwPrev; /* Last element of the cache list*/
uwOldestA3dHeader= p_stCacheLine[ uwOffset ].uwNumOfA3dHeader;
if ( uwOldestA3dHeader != SEB_Invalid ) /* Animation is loaded ???*/
{
p_stA3dHeaders[uwOldestA3dHeader].uwNumOfCacheEntry= SEB_Invalid; /* Yes -> unload animation*/
#ifdef ANIM_DEBUG
if(p_stCacheLine[uwOffset].slCacheValue==_ulFrameNumber)
osSyncPrintf("Saturation cache %d\n",uwNumOfCacheList);
#endif /*ANIM_DEBUG*/
}
/* Update cache values*/
p_stA3dHeaders[_uwNumOfA3dGENERAL].uwNumOfCacheEntry= uwOffset; /* New Element*/
p_stCacheLine[uwOffset].uwNumOfA3dHeader= _uwNumOfA3dGENERAL; /* Change uwNumOfA3dHeader*/
p_stCacheLine[uwOffset].slCacheValue= (signed long) _ulFrameNumber; /* Update slCacheValue*/
/*p_stCacheLine[uwOffset].uwNumOfMemBloc (static value !)*/
/*p_stCacheLine[uwOffset].uwNext (is not changed)*/
/*p_stCacheLine[uwOffset].uwPrev (is not changed)*/
ax_uwCacheList[uwNumOfCacheList]= uwOffset; /* Update first position of the cache list*/
/* Load animation in p_cMemBlocs*/
/* osSyncPrintf("fn_p_GetA3dGENERAL : chargement animation #%d -> cache %d\n", _uwNumOfA3dGENERAL,p_stA3dHeaders[_uwNumOfA3dGENERAL].uwNumOfCacheEntry);*/
fn_v_LoadCachedAnimV6( &p_cMemBlocs[ ((unsigned long) p_stCacheLine[uwOffset].uwNumOfMemBloc) << 10 ],
fn_p_ReadAnimFromROM(_uwNumOfA3dGENERAL),ax_uwCacheListSize[p_stA3dHeaders[_uwNumOfA3dGENERAL].uwCacheList]*1024);
#ifdef ANIM_DEBUG
if ( ((unsigned long)&p_stMorphData[p_stA3dGENERAL->uwNumberOfMorphData] - (unsigned long)p_stA3dGENERAL) > MaxRAMSizeOfAnim )
{
/* ANTIBUG -------------------------------------------------*/
osSyncPrintf("Anim %d too big !!!\n",_uwNumOfA3dGENERAL);
osSyncPrintf("fn_v_LoadCachedAnimV6 (%d > %d)\n", ((unsigned long)&p_stEvents[p_stA3dGENERAL->uwNumberOfEvents] - (unsigned long)p_stA3dGENERAL), MaxRAMSizeOfAnim);
osSyncPrintf(" uwNumberOfFrames = %4d\n", p_stA3dGENERAL->uwNumberOfFrames);
osSyncPrintf(" uwNumberOfVectors = %4d\n", p_stA3dGENERAL->uwNumberOfVectors);
osSyncPrintf(" uwNumberOfQuaternions= %4d\n", p_stA3dGENERAL->uwNumberOfQuaternions);
osSyncPrintf(" uwNumberOfHierarchies= %4d\n", p_stA3dGENERAL->uwNumberOfHierarchies);
osSyncPrintf(" uwNumberOfNTTO = %4d\n", p_stA3dGENERAL->uwNumberOfNTTO);
osSyncPrintf(" uwNumberOfOnlyFrames = %4d\n", (p_stA3dGENERAL->uwEndFrame - p_stA3dGENERAL->uwStartFrame));
osSyncPrintf(" uwNumberOfChannels = %4d\n", p_stA3dGENERAL->uwNumberOfChannels);
osSyncPrintf(" uwNumberOfSavedFrames= %4d\n", p_stA3dGENERAL->uwNumberOfSavedFrames);
osSyncPrintf(" uwNumberOfKeyFrames = %4d\n", p_stA3dGENERAL->uwNumberOfKeyFrames);
osSyncPrintf(" uwNumberOfEvents = %4d\n", p_stA3dGENERAL->uwNumberOfEvents);
osSyncPrintf(" uwNumberOfMorphData = %4d\n", p_stA3dGENERAL->uwNumberOfMorphData);
osSyncPrintf(" uwStartFrame = %4d\n", p_stA3dGENERAL->uwStartFrame);
osSyncPrintf(" uwEndFrame = %4d\n", p_stA3dGENERAL->uwEndFrame);
osSyncPrintf(" p_stA3dGENERAL = %d\n", 0);
osSyncPrintf(" p_a3_xVectors = %d\n", (unsigned long)p_a3_xVectors - (unsigned long)p_stA3dGENERAL);
osSyncPrintf(" p_a4_xQuaternions = %d\n", (unsigned long)p_a4_xQuaternions - (unsigned long)p_stA3dGENERAL);
osSyncPrintf(" p_stHierarchies = %d\n", (unsigned long)p_stHierarchies - (unsigned long)p_stA3dGENERAL);
osSyncPrintf(" p_stNTTO = %d\n", (unsigned long)p_stNTTO - (unsigned long)p_stA3dGENERAL);
osSyncPrintf(" p_stOnlyFrames = %d\n", (unsigned long)p_stOnlyFrames - (unsigned long)p_stA3dGENERAL);
osSyncPrintf(" p_stChannels = %d\n", (unsigned long)p_stChannels - (unsigned long)p_stA3dGENERAL);
osSyncPrintf(" p_stFrames = %d\n", (unsigned long)p_stFrames - (unsigned long)p_stA3dGENERAL);
osSyncPrintf(" p_stFramesKF = %d\n", (unsigned long)p_stFramesKF - (unsigned long)p_stA3dGENERAL);
osSyncPrintf(" p_stKeyFrames = %d\n", (unsigned long)p_stKeyFrames - (unsigned long)p_stA3dGENERAL);
osSyncPrintf(" p_stEvents = %d\n", (unsigned long)p_stEvents - (unsigned long)p_stA3dGENERAL);
osSyncPrintf(" p_stMorphData = %d\n", (unsigned long)p_stMorphData - (unsigned long)p_stA3dGENERAL);
ASM_BREAK;
}
#endif /*ANIM_DEBUG*/
}
else
{
/* Anim is already loaded. We must update the global pointers.*/
fn_v_UpdateCache( _uwNumOfA3dGENERAL, _ulFrameNumber );
p_stA3dGENERAL= (tdstA3dGENERAL *) &p_cMemBlocs[ ((unsigned long) p_stCacheLine[ p_stA3dHeaders[_uwNumOfA3dGENERAL].uwNumOfCacheEntry ].uwNumOfMemBloc) << 10 ];
p_a3_xVectors= (tdxVector3 *) &p_stA3dGENERAL[ 1 ];
p_a4_xQuaternions= (tdxSShortQuater4 *) &p_a3_xVectors[ p_stA3dGENERAL->uwNumberOfVectors ];
p_stHierarchies= (tdstHierarchy *) &p_a4_xQuaternions[ p_stA3dGENERAL->uwNumberOfQuaternions ];
p_stNTTO= (tdstNTTO *) &p_stHierarchies[ p_stA3dGENERAL->uwNumberOfHierarchies ];
p_stOnlyFrames= (tdstOnlyFrame *) &p_stNTTO[ p_stA3dGENERAL->uwNumberOfNTTO ];
p_stChannels= (tdstChannel *) &p_stOnlyFrames[ (p_stA3dGENERAL->uwEndFrame - p_stA3dGENERAL->uwStartFrame) ];
while ( (((unsigned long) p_stChannels) %4) != 0 )
p_stChannels= (tdstChannel *) (((char *) p_stChannels) + 1);
p_stFrames= (tdstFrame *) &p_stChannels[ p_stA3dGENERAL->uwNumberOfChannels ];
p_stFramesKF= (tdstFrameKF *) &p_stFrames[ p_stA3dGENERAL->uwNumberOfSavedFrames * p_stA3dGENERAL->uwNumberOfChannels ];
/* p_stKeyFrames= (tdstKeyFrame *) &p_stFramesKF[ p_stA3dGENERAL->uwNumberOfFrames * p_stA3dGENERAL->uwNumberOfChannels ];*/
p_stKeyFrames= (tdstKeyFrame *) &p_stFramesKF[ (p_stA3dGENERAL->uwEndFrame - p_stA3dGENERAL->uwStartFrame) * p_stA3dGENERAL->uwNumberOfChannels ];
/* Alignment*/
if ( (((unsigned long) p_stKeyFrames) & 0x0002) != 0x0000 )
p_stKeyFrames= (tdstKeyFrame *) (((char *) p_stKeyFrames) + 2);
p_stEvents= (tdstEvent *) &p_stKeyFrames[ p_stA3dGENERAL->uwNumberOfKeyFrames ];
/* due to alignment*/
while ( (((unsigned long) p_stEvents) %4) != 0 )
p_stEvents= (tdstEvent *) (((char *) p_stEvents) + 1);
p_stMorphData= (tdstMorphData *) &p_stEvents[ p_stA3dGENERAL->uwNumberOfEvents ];
#ifdef ANIM_DEBUG
/* ANTIBUG -------------------------------------------------*/
if ( ((unsigned long)&p_stMorphData[p_stA3dGENERAL->uwNumberOfMorphData] - (unsigned long)p_stA3dGENERAL) > MaxRAMSizeOfAnim )
{
osSyncPrintf("Anim %d too big !!!\n",_uwNumOfA3dGENERAL);
osSyncPrintf("fn_v_LoadCachedAnimV6 (%d > %d)\n", ((unsigned long)&p_stEvents[p_stA3dGENERAL->uwNumberOfEvents] - (unsigned long)p_stA3dGENERAL), MaxRAMSizeOfAnim);
osSyncPrintf(" uwNumberOfFrames = %4d\n", p_stA3dGENERAL->uwNumberOfFrames);
osSyncPrintf(" uwNumberOfVectors = %4d\n", p_stA3dGENERAL->uwNumberOfVectors);
osSyncPrintf(" uwNumberOfQuaternions= %4d\n", p_stA3dGENERAL->uwNumberOfQuaternions);
osSyncPrintf(" uwNumberOfHierarchies= %4d\n", p_stA3dGENERAL->uwNumberOfHierarchies);
osSyncPrintf(" uwNumberOfNTTO = %4d\n", p_stA3dGENERAL->uwNumberOfNTTO);
osSyncPrintf(" uwNumberOfOnlyFrames = %4d\n", (p_stA3dGENERAL->uwEndFrame - p_stA3dGENERAL->uwStartFrame));
osSyncPrintf(" uwNumberOfChannels = %4d\n", p_stA3dGENERAL->uwNumberOfChannels);
osSyncPrintf(" uwNumberOfSavedFrames= %4d\n", p_stA3dGENERAL->uwNumberOfSavedFrames);
osSyncPrintf(" uwNumberOfKeyFrames = %4d\n", p_stA3dGENERAL->uwNumberOfKeyFrames);
osSyncPrintf(" uwNumberOfEvents = %4d\n", p_stA3dGENERAL->uwNumberOfEvents);
osSyncPrintf(" uwNumberOfMorphData = %4d\n", p_stA3dGENERAL->uwNumberOfMorphData);
osSyncPrintf(" uwStartFrame = %4d\n", p_stA3dGENERAL->uwStartFrame);
osSyncPrintf(" uwEndFrame = %4d\n", p_stA3dGENERAL->uwEndFrame);
osSyncPrintf(" p_stA3dGENERAL = %d\n", 0);
osSyncPrintf(" p_a3_xVectors = %d\n", (unsigned long)p_a3_xVectors - (unsigned long)p_stA3dGENERAL);
osSyncPrintf(" p_a4_xQuaternions = %d\n", (unsigned long)p_a4_xQuaternions - (unsigned long)p_stA3dGENERAL);
osSyncPrintf(" p_stHierarchies = %d\n", (unsigned long)p_stHierarchies - (unsigned long)p_stA3dGENERAL);
osSyncPrintf(" p_stNTTO = %d\n", (unsigned long)p_stNTTO - (unsigned long)p_stA3dGENERAL);
osSyncPrintf(" p_stOnlyFrames = %d\n", (unsigned long)p_stOnlyFrames - (unsigned long)p_stA3dGENERAL);
osSyncPrintf(" p_stChannels = %d\n", (unsigned long)p_stChannels - (unsigned long)p_stA3dGENERAL);
osSyncPrintf(" p_stFrames = %d\n", (unsigned long)p_stFrames - (unsigned long)p_stA3dGENERAL);
osSyncPrintf(" p_stFramesKF = %d\n", (unsigned long)p_stFramesKF - (unsigned long)p_stA3dGENERAL);
osSyncPrintf(" p_stKeyFrames = %d\n", (unsigned long)p_stKeyFrames - (unsigned long)p_stA3dGENERAL);
osSyncPrintf(" p_stEvents = %d\n", (unsigned long)p_stEvents - (unsigned long)p_stA3dGENERAL);
osSyncPrintf(" p_stMorphData = %d\n", (unsigned long)p_stMorphData - (unsigned long)p_stA3dGENERAL);
ASM_BREAK;;
}
/* ANTIBUG -------------------------------------------------*/
#endif /*ANIM_DEBUG*/
}
return p_stA3dGENERAL;
#ifndef FORCE_REAL_TIME_LOAD
}
else
#endif
#endif /*A3X_N64*/
#ifndef FORCE_REAL_TIME_LOAD
return &p_stA3dGENERAL[ _uwNumOfA3dGENERAL ];
#endif
}
#ifdef U64
void fn_vInvalidateAnimCache(void)
{
unsigned long i,ulNbIntAnims;
char* p_cBigMalloc;
/* Read number of animations*/
p_cBigMalloc=(char *) fn_pvAllocTmp( 4 , 16 );
LDR_fn_vLoadFromROM( ( g_p_cROMAnimBlocStart ),
( g_p_cROMAnimBlocStart + 1*sizeof(unsigned long) ),
(char *) p_cBigMalloc,
MSG_BLOCK );
ulNbIntAnims= *((unsigned long *) &p_cBigMalloc[0]);
fn_vFreeRomTmp( (void *)p_cBigMalloc );
/* Mark all cache entry invalid*/
for(i=0;i<ulNbIntAnims;++i)
p_stA3dHeaders[i].uwNumOfCacheEntry=SEB_Invalid;
}
#endif
/* ***************************************************************************************************/
/*tdstOutputCacheLine *fn_p_GetOutputCacheEntry( unsigned short _uwNumOfA3dGENERAL,
unsigned long _ulFrame,
void *_p_vSuperObject )
{ unsigned short uwCnt;
unsigned long ulMax;
if (ulLastEngineFrame != _ulFrame)
{
#ifndef MESSAGES_OFF
// M_PrintfN64_((ON"Changement frame moteur (%d)\n", _ulFrame ));
#endif // MESSAGES_OFF
M_v_ResetOneStack( eStackFrame3d );
M_v_ResetOneStack( eStackElement3d );
ulLastEngineFrame= _ulFrame;
}
ulMax = fn_ul_GetStackPos(eStackFrame3d);
for ( uwCnt=0 ; uwCnt<ulMax ; uwCnt++ )
if ( _p_vSuperObject == ax_stOutputCacheLine[uwCnt].p_vSuperObject )
return &ax_stOutputCacheLine[uwCnt];
ax_stOutputCacheLine[ulMax].p_vSuperObject= _p_vSuperObject;
ax_stOutputCacheLine[ulMax].p_stAnim3d= (void *) 0xFFFFFFFF;
ax_stOutputCacheLine[ulMax].lNumOfLastFrame= -1;
#ifdef A3X_CUT
ax_stOutputCacheLine[ulMax].p_stFrame3d= &p_stFrame3d[ fn_ul_AllocateOnStack( eStackFrame3d, 1 ) ];
ax_stOutputCacheLine[ulMax].p_stElement3d=
&p_stElement3d[ fn_ul_AllocateOnStack( eStackElement3d, p_stCuttedAnim[_uwNumOfA3dGENERAL].uwMaxNumberOfElements ) ];
#else
ax_stOutputCacheLine[ulMax].p_stFrame3d= &p_stFrame3d[ fn_ul_AllocateOnStack( eStackFrame3d, 1 ) ];
ax_stOutputCacheLine[ulMax].p_stElement3d= &p_stElement3d[ fn_ul_AllocateOnStack(eStackElement3d,fn_p_GetA3dGENERAL(_uwNumOfA3dGENERAL,_ulFrame)->uwNumberOfChannels) ];
#endif
ax_stOutputCacheLine[ulMax].p_stFrame3d->p_stArrayOfElts3d = ax_stOutputCacheLine[ulMax].p_stElement3d;
// ANTIBUG -------------------------------------------------
if ( (fn_ul_GetStackPos(eStackFrame3d) > uwMaxInTabFrame3d) || (fn_ul_GetStackPos(eStackElement3d) > uwMaxInTabElement3d) )
{
M_v_ResetOneStack( eStackFrame3d );
M_v_ResetOneStack( eStackElement3d );
#ifdef A3X_CUT
ax_stOutputCacheLine[ulMax].p_stFrame3d=&p_stFrame3d[ fn_ul_AllocateOnStack( eStackFrame3d, 1 ) ];
ax_stOutputCacheLine[ulMax].p_stElement3d=
&p_stElement3d[ fn_ul_AllocateOnStack( eStackElement3d, p_stCuttedAnim[_uwNumOfA3dGENERAL].uwMaxNumberOfElements ) ];
#else
ax_stOutputCacheLine[ulMax].p_stFrame3d=&p_stFrame3d[ fn_ul_AllocateOnStack( eStackFrame3d, 1 ) ];
ax_stOutputCacheLine[ulMax].p_stElement3d=&p_stElement3d[ fn_ul_AllocateOnStack( eStackElement3d,fn_p_GetA3dGENERAL(_uwNumOfA3dGENERAL,_ulFrame)->uwNumberOfChannels) ];
#endif
#ifdef A3X_N64
#ifndef MESSAGES_OFF
M_PrintfN64(("fn_uw_GetOutputCacheEntry : saturation cache sortie\n"));
// asm("break 0xFF");
#endif // MESSAGES_OFF
#endif
return &ax_stOutputCacheLine[0];
}
if ( (fn_ul_GetStackPos(eStackFrame3d) > uwMaxInStackFrame3d) || (fn_ul_GetStackPos(eStackElement3d) > uwMaxInStackElement3d) )
{ if (fn_ul_GetStackPos(eStackFrame3d) > uwMaxInStackFrame3d)
uwMaxInStackFrame3d = (unsigned short)fn_ul_GetStackPos(eStackFrame3d);
if (fn_ul_GetStackPos(eStackElement3d) > uwMaxInStackElement3d)
uwMaxInStackElement3d = (unsigned short)fn_ul_GetStackPos(eStackElement3d);
#ifdef A3X_N64
#ifndef MESSAGES_OFF
// M_PrintfN64(( "uwMaxInStackFrame3d= %d, uwMaxInStackElement3d= %d\n",
// uwMaxInStackFrame3d, uwMaxInStackElement3d ));
#endif // MESSAGES_OFF
#endif
}
// ANTIBUG -------------------------------------------------
return &ax_stOutputCacheLine[ulMax];
}*/
/* ***************************************************************************************************/
#undef A3X_CACH_C

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,989 @@
/* ***********************************************************************************/
/* * "a3x_intn.c" **/
/* * Written by : S<>bastien Rubens **/
/* * Tabulations : 4 char **/
/* ***********************************************************************************/
#define A3X_INTN_C
/* ***********************************************************************************/
/* Included files*/
#include <math.h>
/*#define LST2_StaticIsOptimised*/
#include "ACP_Base.h"
#include "cpa_std.h"
#include "TOOLSCPA.h"
#include "STRUCTUR/Anim_s.h"
#define D_ObjsTbls_Define
#include "STRUCTUR/ObjsTbls.h"
#include "MTH.h"
#include "POS.h"
#include "PlayAnim/Interpol/specif/a3x_pref.h"
#include "chanlist.h"
#include "PlayAnim/Interpol/a3x_glob.h"
#include "PlayAnim/Interpol/a3x_int.h"
#include "PlayAnim/Interpol/a3x_intn.h"
#include "PlayAnim/Interpol/a3x_mem.h"
#include "PlayAnim/Interpol/a3x_cach.h"
#include "PlayAnim/PlayEvts.h"
/* for allocation*/
#include "ZeMem.h"
#define M_Abs( x ) \
( ((x) > xZero) ? (x) : -(x) )
/* temp*/
extern SEB_xReal xEps;
extern SEB_xReal xOneSubEps;
/*AR9902 To be cleaned...*/
extern tdstA3dHeader* p_stA3dHeaders;
/* ***********************************************************************************/
void fn_v_InterpolBetweenKeys( tdstKeyFrame *_p_stKey1,
tdstKeyFrame *_p_stKey2,
tdstChannel *_p_stChannel,
POS_tdxHandleToPosition _p_stCompletePosition,
register unsigned short _uwInterpolated,
register SEB_xReal _xT )
{ tdxMatrix33 a3a3_xMtxOri, a3a3_xMtxTra;
tdxVector3 a3_xPosition;
static tdxQuater4 a4_xQuatI, a4_xQuatS1, a4_xQuatS2;
static tdxMatrix33 a3a3_xMtxOriSca, a3a3_xMtxSca;
static tdxVector3 a3_xVecSca;
register SEB_xReal xSinOmega;
register SEB_xReal xCoef1, xCoef2;
/* register SEB_xReal xOmega, xCosOmega, xTbyOmega;*/
register tdxVector3 *p_Vect1, *p_Vect2;
register signed short swOmega, swCosOmega, swTbyOmega;
#ifdef ANIM_DEBUG
if(_p_stCompletePosition==NULL)
{
osSyncPrintf("Position is null in fn_v_InterpolBetweenKeys\n");
ASM_BREAK;
}
#endif
POS_fn_vSetIdentityMatrix(_p_stCompletePosition);
MTH3D_M_vSetIdentityMatrix((MTH3D_tdstMatrix*)&a3a3_xMtxOri);
MTH3D_M_vSetIdentityMatrix((MTH3D_tdstMatrix*)&a3a3_xMtxTra);
MTH3D_M_vNullVector((MTH3D_tdstVector*)&a3_xPosition);
/* -- Interpolation of orientation -------*/
if ( (_xT == xZero) || ((_p_stKey1->uwMask & SEB_xMaskQuatOri) != 0x0000) )
{ /* We are on the first KeyFrame or we have a non interpolated quaternion*/
if ((_p_stKey1->uwMask & SEB_xMaskIdQuatOri) == 0x0000)
{ /* Copy of first (KeyFrame) quaternion*/
fn_v_ExpandQuat( a4_xQuatI, p_a4_xQuaternions[_p_stKey1->uwNumOfQuatOri] );
fn_v_QuatToMatrix( a3a3_xMtxOri, a4_xQuatI );
POS_fn_vSetRotationMatrix( _p_stCompletePosition , (MTH3D_tdstVector*)a3a3_xMtxOri[0], (MTH3D_tdstVector*)a3a3_xMtxOri[1] , (MTH3D_tdstVector*)a3a3_xMtxOri[2] );
}
}
else
{ /* Interpolation of orientation*/
fn_v_ExpandQuat( a4_xQuatS1, p_a4_xQuaternions[_p_stKey1->uwNumOfQuatOri] );
fn_v_ExpandQuat( a4_xQuatS2, p_a4_xQuaternions[_p_stKey2->uwNumOfQuatOri] );
fn_v_InterpolQuatWithOmega( a4_xQuatI, a4_xQuatS1, a4_xQuatS2, _xT, _p_stKey1->uwAngQuatOri );
fn_v_QuatToMatrix( a3a3_xMtxOri, a4_xQuatI );
POS_fn_vSetRotationMatrix( _p_stCompletePosition , (MTH3D_tdstVector*)a3a3_xMtxOri[0], (MTH3D_tdstVector*)a3a3_xMtxOri[1] , (MTH3D_tdstVector*)a3a3_xMtxOri[2] );
}
/* -- Linear interpolation of ScaleValues -------*/
if ( ((_p_stKey1->uwMask & (SEB_xMaskScaleValues|SEB_xMaskIdScaleValues)) == (SEB_xMaskScaleValues|SEB_xMaskIdScaleValues))
|| ((_xT==xZero) && ((_p_stKey1->uwMask & SEB_xMaskIdScaleValues) != 0x0000)) )
{ /* Identity vector (we don't use scale)*/
MTH3D_M_vCopyMatrix((MTH3D_tdstMatrix*)&a3a3_xMtxTra,(MTH3D_tdstMatrix*)&a3a3_xMtxOri);
}
/*else we have a non "identity" scale vector*/
/* -- Interpolation of whole scale -------*/
/* -- and creation of TransformMatrix -------*/
else
{ /* Interpolated of ScaleValues*/
fn_v_InterpolVect( a3_xVecSca, p_a3_xVectors[_p_stKey1->uwNumOfScaleValues],
p_a3_xVectors[_p_stKey2->uwNumOfScaleValues], _xT );
if ( (_xT == xZero) || ((_p_stKey1->uwMask & SEB_xMaskQuatSca) != 0x0000) )
{ /* We are on the first KeyFrame or we have a non interpolated quaternion*/
if ((_p_stKey1->uwMask & SEB_xMaskIdQuatSca) != 0x0000)
{ /* Identity quaternion*/
/* Create final Transform matrix*/
/* Final matrix= [scale dir. matrix]*[values scale matrix]*[scale dir. matrix]^-1*/
if(MTH_M_bEqualWithEpsilon(a3_xVecSca[0],a3_xVecSca[1],MTH_M_xFloatToReal(0.01)) &&
MTH_M_bEqualWithEpsilon(a3_xVecSca[0],a3_xVecSca[2],MTH_M_xFloatToReal(0.01)))
{
POS_fn_vSetZoomMatrix( _p_stCompletePosition , (MTH_tdxReal)a3_xVecSca[0] );
POS_fn_vGetTransformMatrix( _p_stCompletePosition , (MTH3D_tdstVector*)a3a3_xMtxTra[0], (MTH3D_tdstVector*)a3a3_xMtxTra[1] , (MTH3D_tdstVector*)a3a3_xMtxTra[2] );
}
else
{
fn_v_MatrixByDia( a3a3_xMtxTra, a3a3_xMtxOri, a3_xVecSca );
POS_fn_vSetTransformMatrix( _p_stCompletePosition , (MTH3D_tdstVector*)a3a3_xMtxTra[0], (MTH3D_tdstVector*)a3a3_xMtxTra[1] , (MTH3D_tdstVector*)a3a3_xMtxTra[2] );
}
}
else
{ /* Copy of first (KeyFrame) quaternion*/
fn_v_ExpandQuat( a4_xQuatI, p_a4_xQuaternions[_p_stKey1->uwNumOfQuatSca] );
fn_v_QuatToMatrix( a3a3_xMtxOriSca, a4_xQuatI );
/* Create final scale matrix*/
/* Final matrix= [scale dir. matrix]*[values scale matrix]*[scale dir. matrix]^-1*/
if(MTH_M_bEqualWithEpsilon(a3_xVecSca[0],a3_xVecSca[1],MTH_M_xFloatToReal(0.01)) &&
MTH_M_bEqualWithEpsilon(a3_xVecSca[0],a3_xVecSca[2],MTH_M_xFloatToReal(0.01)))
{
POS_fn_vSetZoomMatrix( _p_stCompletePosition , (MTH_tdxReal)a3_xVecSca[0] );
POS_fn_vGetTransformMatrix( _p_stCompletePosition , (MTH3D_tdstVector*)a3a3_xMtxTra[0], (MTH3D_tdstVector*)a3a3_xMtxTra[1] , (MTH3D_tdstVector*)a3a3_xMtxTra[2] );
}
else
{
fn_v_InvRotDiaRot( a3a3_xMtxSca, a3a3_xMtxOriSca, a3_xVecSca );
/* Create final Transform matrix*/
fn_v_MultMatrix( a3a3_xMtxTra, a3a3_xMtxOri, a3a3_xMtxSca );
POS_fn_vSetTransformMatrix( _p_stCompletePosition , (MTH3D_tdstVector*)a3a3_xMtxTra[0], (MTH3D_tdstVector*)a3a3_xMtxTra[1] , (MTH3D_tdstVector*)a3a3_xMtxTra[2] );
}
}
}
else
{ /* Interpolation of scale direction*/
fn_v_ExpandQuat( a4_xQuatS1, p_a4_xQuaternions[_p_stKey1->uwNumOfQuatSca] );
fn_v_ExpandQuat( a4_xQuatS2, p_a4_xQuaternions[_p_stKey2->uwNumOfQuatSca] );
fn_v_InterpolQuatWithOmega( a4_xQuatI, a4_xQuatS1, a4_xQuatS2, _xT, _p_stKey1->uwAngQuatSca );
fn_v_QuatToMatrix( a3a3_xMtxOriSca, a4_xQuatI );
/* Create final scale matrix*/
/* Final matrix= [scale dir. matrix]*[values scale matrix]*[scale dir. matrix]^-1*/
if(MTH_M_bEqualWithEpsilon(a3_xVecSca[0],a3_xVecSca[1],MTH_M_xFloatToReal(0.01)) &&
MTH_M_bEqualWithEpsilon(a3_xVecSca[0],a3_xVecSca[2],MTH_M_xFloatToReal(0.01)))
{
POS_fn_vSetZoomMatrix( _p_stCompletePosition , (MTH_tdxReal)a3_xVecSca[0] );
POS_fn_vGetTransformMatrix( _p_stCompletePosition , (MTH3D_tdstVector*)a3a3_xMtxTra[0], (MTH3D_tdstVector*)a3a3_xMtxTra[1] , (MTH3D_tdstVector*)a3a3_xMtxTra[2] );
}
else
{
fn_v_InvRotDiaRot( a3a3_xMtxSca, a3a3_xMtxOriSca, a3_xVecSca );
/* Create final Transform matrix*/
fn_v_MultMatrix( a3a3_xMtxTra, a3a3_xMtxOri, a3a3_xMtxSca );
POS_fn_vSetTransformMatrix( _p_stCompletePosition , (MTH3D_tdstVector*)a3a3_xMtxTra[0], (MTH3D_tdstVector*)a3a3_xMtxTra[1] , (MTH3D_tdstVector*)a3a3_xMtxTra[2] );
}
}
}
/* -- Interpolation of position -------*/
if ( (_xT == xZero) || (_p_stKey1->uwMask & SEB_xMaskPosition) != 0x0000 )
{ register SEB_xReal r_xDistMaster;
p_Vect1= &p_a3_xVectors[_p_stKey1->uwNumOfPosition];
r_xDistMaster= _p_stKey1->xDistMaster;
a3_xPosition[0]= (*p_Vect1)[0] * r_xDistMaster;
a3_xPosition[1]= (*p_Vect1)[1] * r_xDistMaster;
a3_xPosition[2]= (*p_Vect1)[2] * r_xDistMaster;
POS_fn_vSetTranslationVector( _p_stCompletePosition , (MTH3D_tdstVector*)a3_xPosition );
}
else
{
if ( _uwInterpolated == 0x0000 )
{
/* Interpolation with the pivot*/
/* Rotate pivot (local to object)*/
fn_v_MatrixByVector( a3_xVecSca, a3a3_xMtxTra, p_a3_xVectors[_p_stChannel->uwNumOfLocalPivotPos] );
/* Pivot (linear) interpolation in world axes*/
fn_v_InterpolVect( a3_xPosition, _p_stKey1->a3_xWorldPivotPosition, _p_stKey2->a3_xWorldPivotPosition, _xT );
/* Computes the interpolated position*/
a3_xPosition[0]-= a3_xVecSca[0];
a3_xPosition[1]-= a3_xVecSca[1];
a3_xPosition[2]-= a3_xVecSca[2];
POS_fn_vSetTranslationVector( _p_stCompletePosition , (MTH3D_tdstVector*)a3_xPosition );
}
else
{
/* Interpolation with Hierarchy*/
if ( (_p_stKey1->xDistMaster > xEps) || (_p_stKey2->xDistMaster > xEps) )
{
p_Vect1= &p_a3_xVectors[_p_stKey1->uwNumOfPosition];
if ((_p_stKey1->uwMask & SEB_xMaskZeroAngCentre) != 0x0000)
{
/* Linear interpolation of vector length*/
xCoef1= ( _p_stKey2->xDistMaster - _p_stKey1->xDistMaster ) * _xT
+ _p_stKey1->xDistMaster;
/* Computes the interpolated position*/
a3_xPosition[0]= xCoef1 * (*p_Vect1)[0];
a3_xPosition[1]= xCoef1 * (*p_Vect1)[1];
a3_xPosition[2]= xCoef1 * (*p_Vect1)[2];
POS_fn_vSetTranslationVector( _p_stCompletePosition , (MTH3D_tdstVector*)a3_xPosition );
}
else
{
p_Vect2= &p_a3_xVectors[_p_stKey2->uwNumOfPosition];
swOmega= _p_stKey1->uwAngObjCentre;
/* Computes values for "Geodesic" interpolation*/
swCosOmega= ax_SinTab[ swOmega ];
if ( swCosOmega != 0 )
{ xSinOmega= xOne / swCosOmega;
swTbyOmega= (signed short) (_xT * swOmega); /* Always 0 < slTbyOmega < _slOmega*/
xCoef1= ax_SinTab[ swOmega - swTbyOmega ] * xSinOmega;
xCoef2= ax_SinTab[ swTbyOmega ] * xSinOmega;
}
else
{ xCoef1= xOne - _xT;
xCoef2= _xT;
}
/* Linear interpolation of vector length*/
xSinOmega= ( _p_stKey2->xDistMaster - _p_stKey1->xDistMaster ) * _xT
+ _p_stKey1->xDistMaster;
xCoef1*= xSinOmega;
xCoef2*= xSinOmega;
/* Computes the interpolated position*/
a3_xPosition[0]= xCoef1 * (*p_Vect1)[0] + xCoef2 * (*p_Vect2)[0];
a3_xPosition[1]= xCoef1 * (*p_Vect1)[1] + xCoef2 * (*p_Vect2)[1];
a3_xPosition[2]= xCoef1 * (*p_Vect1)[2] + xCoef2 * (*p_Vect2)[2];
POS_fn_vSetTranslationVector( _p_stCompletePosition , (MTH3D_tdstVector*)a3_xPosition );
}
}
}
}
}
/* ***********************************************************************************/
#ifdef A3X_CUT
unsigned short fn_uw_GetNumOfA3dGENERAL( unsigned short _uwNumOfA3dGENERAL,
unsigned short _uwT )
{ register unsigned short uwNumOfA3dGENERAL;
uwNumOfA3dGENERAL= _uwNumOfA3dGENERAL;
while ( _uwT >= p_stCuttedAnim[uwNumOfA3dGENERAL].uwEndFrame )
{ uwNumOfA3dGENERAL= p_stCuttedAnim[uwNumOfA3dGENERAL].uwNextAnim;
if (uwNumOfA3dGENERAL == 0xFFFF)
{
#ifdef ANIM_DEBUG
osSyncPrintf("Cut anim not found\n");
osSyncPrintf("Anim = %d, Frame = %d\n",_uwNumOfA3dGENERAL,_uwT);
ASM_BREAK; /* temporary*/
#endif
return 0xFFFF;
}
}
p_uwLastA3dGENERAL[_uwNumOfA3dGENERAL]= uwNumOfA3dGENERAL;
return uwNumOfA3dGENERAL;
}
#endif
/* ***********************************************************************************/
tdstEvent *fn_p_GetEventsAddress( tdstAnim3d *_p_stAnim3d,
unsigned long _ulFrame,
tdxHandleToObjectsTablesList _h_ObjectsTablesListElement)
{
#ifdef U64
int i;
tdstEvent * p_stEvent, * p_stEventNeverPlay;
if ( _p_stAnim3d->uwNumOfA3dGENERAL != C_uwAnimNotInterpolated )
{ /* Animation is a interpolated animation*/
/* Set Events*/
if ( _p_stAnim3d->ucNumberOfEvents == 0 )
_p_stAnim3d->d_stAnimEvent= NULL;
else
{ tdstA3dGENERAL *p_stCurrentA3dGENERAL;
#ifndef FORCE_REAL_TIME_LOAD
if(g_bRealTimeAnimationLoad)
#endif
p_stCurrentA3dGENERAL= fn_p_GetA3dGENERAL(p_uwLastA3dGENERAL[_p_stAnim3d->uwNumOfA3dGENERAL], _ulFrame);
#ifndef FORCE_REAL_TIME_LOAD
else
p_stCurrentA3dGENERAL= fn_p_GetA3dGENERAL(_p_stAnim3d->uwNumOfA3dGENERAL, _ulFrame );
#endif
_p_stAnim3d->d_stAnimEvent= &p_stEvents[ p_stCurrentA3dGENERAL->uwNumOfFirstEvent ];
/* Update event pointer with sort*/
for(i=0,p_stEvent=NULL,p_stEventNeverPlay=_p_stAnim3d->d_stAnimEvent;i<_p_stAnim3d->ucNumberOfEvents;++i,p_stEventNeverPlay++)
{
if(p_stEventNeverPlay->p_stfEventInTBL==NULL)
{
/* set the tbl event*/
p_stEventNeverPlay->p_stfEventInTBL=
(tdstEventInTable*)_h_ObjectsTablesListElement->d_stObjectsTable[p_stEventNeverPlay->usEventNumberInTBL].h_Target;
/* found first non never play event*/
#ifdef ANIM_DEBUG
if(p_stEventNeverPlay->p_stfEventInTBL==NULL)
{
osSyncPrintf("Probleme d'evenements : p_stfEventInTBL==NULL\n");
osSyncPrintf("Anim = %d, Frame = %d, number in table = %d\n",_p_stAnim3d->uwNumOfA3dGENERAL,_ulFrame,p_stEventNeverPlay->usEventNumberInTBL);
}
#endif
if (!p_stEvent && (GAM_fn_ucGetFirstCallOfEvent(p_stEventNeverPlay) != C_ucNeverPlay))
p_stEvent = p_stEventNeverPlay;
/* found a never play */
else if (GAM_fn_ucGetFirstCallOfEvent(p_stEventNeverPlay) == C_ucNeverPlay)
{
/* set the frame & channel to 0*/
p_stEventNeverPlay->uwChannelNumber = p_stEventNeverPlay->uwFrameNumber = 0;
/* there is a non never play before*/
if (p_stEvent)
{
tdstEvent * p_stTmpEvent;
/* we move up the never play event until the first non never play*/
for(p_stTmpEvent = p_stEventNeverPlay-1;p_stTmpEvent >= p_stEvent;p_stTmpEvent--)
{
/* permute Event*/
tdstEvent stEvent = *(p_stTmpEvent+1);
*(p_stTmpEvent+1) = *p_stTmpEvent;
*p_stTmpEvent = stEvent;
}
/* now the fisrt non never play has moved 1 place down*/
p_stEvent++;
}
}
}
}
}
}
#endif /*U64*/
return _p_stAnim3d->d_stAnimEvent;
}
/* ***********************************************************************************/
void fn_v_CalculateGeneral(tdstAnim3d * _p_stAnim3d,unsigned long _ulFrame ) {
#ifndef FORCE_REAL_TIME_LOAD
tdstA3dGENERAL *p_stCurrentA3dGENERAL;
/* tdxQuater4 a4_xQuat;*/
/* tdxMatrix33 a3x3_Matrix;*/
if(!g_bRealTimeAnimationLoad)
{
p_stCurrentA3dGENERAL = fn_p_GetA3dGENERAL(_p_stAnim3d->uwNumOfA3dGENERAL,_ulFrame);
_p_stAnim3d->uwNumberOfFrames = p_stCurrentA3dGENERAL->uwNumberOfFrames;
_p_stAnim3d->ucFrameRate= (unsigned char) p_stCurrentA3dGENERAL->uwAnimationSpeed;
_p_stAnim3d->ucMaxNumberOfElements= (unsigned char) p_stCurrentA3dGENERAL->uwNumberOfChannels;
_p_stAnim3d->ucNumberOfEvents= (unsigned char) p_stCurrentA3dGENERAL->uwNumberOfEvents;
if ( (p_a3_xVectors[p_stCurrentA3dGENERAL->uwNumOfAnimationTranslationOffset][0] != xZero) ||
(p_a3_xVectors[p_stCurrentA3dGENERAL->uwNumOfAnimationTranslationOffset][1] != xZero) ||
(p_a3_xVectors[p_stCurrentA3dGENERAL->uwNumOfAnimationTranslationOffset][2] != xZero)
)
{
/* POS_fn_vSetTranslationVector( &(_p_stAnim3d->stOffsetMatrix) , (MTH3D_tdstVector*)p_a3_xVectors[p_stCurrentA3dGENERAL->uwNumOfAnimationTranslationOffset] );*/
memcpy(&(_p_stAnim3d->stOffsetMatrix),(MTH3D_tdstVector*)p_a3_xVectors[p_stCurrentA3dGENERAL->uwNumOfAnimationTranslationOffset],sizeof(MTH3D_tdstVector));
}
else
memset(&_p_stAnim3d->stOffsetMatrix,0,sizeof(MTH3D_tdstVector)); /*AR9811*/
/* if ( (p_a4_xQuaternions[p_stCurrentA3dGENERAL->uwNumOfAnimationRotationOffset][0] != 0) ||
(p_a4_xQuaternions[p_stCurrentA3dGENERAL->uwNumOfAnimationRotationOffset][1] != 0) ||
(p_a4_xQuaternions[p_stCurrentA3dGENERAL->uwNumOfAnimationRotationOffset][2] != 0) ||
(p_a4_xQuaternions[p_stCurrentA3dGENERAL->uwNumOfAnimationRotationOffset][3] != lOne)
)
{
fn_v_ExpandQuat( a4_xQuat, p_a4_xQuaternions[p_stCurrentA3dGENERAL->uwNumOfAnimationRotationOffset] );
fn_v_QuatToMatrix( a3x3_Matrix , a4_xQuat );
POS_fn_vSetRotationMatrix( &(_p_stAnim3d->stOffsetMatrix) , (MTH3D_tdstVector*)a3x3_Matrix[0] , (MTH3D_tdstVector*)a3x3_Matrix[1] , (MTH3D_tdstVector*)a3x3_Matrix[2] );
} */
/* Set Events*/
if ( _p_stAnim3d->ucNumberOfEvents == 0 )
_p_stAnim3d->d_stAnimEvent= NULL;
else
_p_stAnim3d->d_stAnimEvent= &p_stEvents[p_stCurrentA3dGENERAL->uwNumOfFirstEvent];
/* Set Morph table*/
if ( p_stCurrentA3dGENERAL->uwNumberOfMorphData == 0 )
_p_stAnim3d->d_stMorphDataArray = NULL;
else
_p_stAnim3d->d_stMorphDataArray = &p_stMorphData[p_stCurrentA3dGENERAL->uwNumOfFirstMorphData];
}
else
{
#endif
#ifdef A3X_CUT
/* If we are in realtime load system, we don't need to load the entire animations, here.*/
register tdstShortA3dGENERAL *p_stShortA3dGENERAL;
p_stShortA3dGENERAL= fn_p_ReadShortAnimFromROM(_p_stAnim3d->uwNumOfA3dGENERAL);
_p_stAnim3d->uwNumberOfFrames= p_stShortA3dGENERAL->uwNumberOfFrames;
_p_stAnim3d->ucFrameRate= p_stShortA3dGENERAL->uwFrameRate;
_p_stAnim3d->ucMaxNumberOfElements= p_stShortA3dGENERAL->uwMaxNumberOfElements;
_p_stAnim3d->ucNumberOfEvents= p_stShortA3dGENERAL->uwNumberOfEvents;
if((p_stShortA3dGENERAL->a3_xAnimationTranslationOffset[0] != xZero)||
(p_stShortA3dGENERAL->a3_xAnimationTranslationOffset[1] != xZero)||
(p_stShortA3dGENERAL->a3_xAnimationTranslationOffset[2] != xZero))
/* POS_fn_vSetTranslationVector(&(_p_stAnim3d->stOffsetMatrix) , (MTH3D_tdstVector*)p_stShortA3dGENERAL->a3_xAnimationTranslationOffset );*/
memcpy(&(_p_stAnim3d->stOffsetMatrix),(MTH3D_tdstVector*)p_stShortA3dGENERAL->a3_xAnimationTranslationOffset,sizeof(MTH3D_tdstVector)); /*AR9811*/
else
memset(&_p_stAnim3d->stOffsetMatrix,0,sizeof(MTH3D_tdstVector)); /*AR9811*/
/* if ((p_stShortA3dGENERAL->a4_uwAnimationRotationOffset[0] != 0) ||
(p_stShortA3dGENERAL->a4_uwAnimationRotationOffset[1] != 0) ||
(p_stShortA3dGENERAL->a4_uwAnimationRotationOffset[2] != 0) ||
(p_stShortA3dGENERAL->a4_uwAnimationRotationOffset[3] != lOne)
)
{
fn_v_ExpandQuat(a4_xQuat, p_stShortA3dGENERAL->a4_uwAnimationRotationOffset );
fn_v_QuatToMatrix( a3x3_Matrix , a4_xQuat );
POS_fn_vSetRotationMatrix( &(_p_stAnim3d->stOffsetMatrix) , (MTH3D_tdstVector*)a3x3_Matrix[0] , (MTH3D_tdstVector*)a3x3_Matrix[1] , (MTH3D_tdstVector*)a3x3_Matrix[2] );
} */
/* Set Events*/
if ( _p_stAnim3d->ucNumberOfEvents == 0 )
_p_stAnim3d->d_stAnimEvent= NULL;
else
_p_stAnim3d->d_stAnimEvent= (struct tdstEvent_ *)0xCCCCCCCC; /* Updated later*/
/* Set Morph table*/
if ( p_stShortA3dGENERAL->uwNumberOfMorphData == 0 )
_p_stAnim3d->d_stMorphDataArray = NULL;
else
_p_stAnim3d->d_stMorphDataArray = (struct stMorphData *)0xCCCCCCCC; /* Updated later*/
#endif
#ifndef FORCE_REAL_TIME_LOAD
}
#endif
}
/* ****************************************************************** fn_vUpdateFrame*/
/* Update Frame structure if it wasn't - but matrix isn't update*/
/* Set Linear and Angular Speed (Alloc or Free Matrix)*/
/* Set Hierarchy*/
/* Fill Element3D Array : ElementNuber,ElementType,ActiveStatus,ChannelNumber*/
/**/
/* 17/07/98 - Carlos Torres*/
/* ***********************************************************************************/
void fn_vUpdateFrame(void * _p_stSuperObject,tdstFrame3d * _p_stFrame,tdstAnim3d * _p_stAnim3d,unsigned short _uwFrame)
{
tdstA3dGENERAL * p_stCurrentA3dGENERAL;
tdstOnlyFrame * p_stCurrentOnlyFrame;
tdstChannel * p_stCurrentChannel;
unsigned short uwT_NTTO;
unsigned short uwCnt1,uwNumOfA3dGENERAL;
tdstElement3d * p_stCurrentElement3d;
unsigned short uwCorrectedFrame;
ACP_tdxBool bMustTest=TRUE;
/* AR9902*/
/* Before returning, we must be sure that the animation is still loaded into the animation cache*/
/* and that it is loaded into the same cache entry*/
/* ----------------------------------------------------------------------------------*/
/* Get A3D General Info*/
#ifdef A3X_N64
#ifndef FORCE_REAL_TIME_LOAD
if(g_bRealTimeAnimationLoad)
#endif
uwNumOfA3dGENERAL= fn_uw_GetNumOfA3dGENERAL(_p_stAnim3d->uwNumOfA3dGENERAL, _uwFrame);
#ifndef FORCE_REAL_TIME_LOAD
else
#endif
#endif
#ifndef FORCE_REAL_TIME_LOAD
uwNumOfA3dGENERAL= _p_stAnim3d->uwNumOfA3dGENERAL;
#endif
#ifdef A3X_N64
if((p_stA3dHeaders[uwNumOfA3dGENERAL].uwNumOfCacheEntry == SEB_Invalid)
||(_p_stFrame->ucCacheEntry!=(unsigned char)p_stA3dHeaders[uwNumOfA3dGENERAL].uwNumOfCacheEntry))
{
/* Animation isn't loaded*/
/* We must load it and fill again the _p_stFrame because the old values aren't valid anymore*/
bMustTest=FALSE;
}
else
#endif /*A3X_N64*/
bMustTest=TRUE;
if(bMustTest)
{
/* if uwFrame>uwNumberOfFrames, no update*/
if ( _uwFrame >= _p_stAnim3d->uwNumberOfFrames )
return; /* Can occur sometimes... AR9808*/
/* check if the frame is already updated*/
if ((_p_stFrame->p_stAnim == _p_stAnim3d) && (_p_stFrame->uwFrameNumber == _uwFrame))
return;
}
else
{
if ( _uwFrame >= _p_stAnim3d->uwNumberOfFrames )
_uwFrame = ( unsigned short ) ( _p_stAnim3d->uwNumberOfFrames - 1 ) ; /*last valid frame*/
}
/* ----------------------------------------------------------------------------------*/
/* set ref of the frame*/
_p_stFrame->p_stAnim = _p_stAnim3d;
_p_stFrame->uwFrameNumber = _uwFrame;
_p_stFrame->ucMatrixUpdated = FALSE;
/* Here, we load the animation in cache again*/
p_stCurrentA3dGENERAL = fn_p_GetA3dGENERAL(uwNumOfA3dGENERAL,_uwFrame);
/* ----------------------------------------------------------------------------------*/
/* check if anim cutting is well done*/
#if defined(A3X_N64) && defined(ANIM_DEBUG)
if ((_uwFrame < p_stCurrentA3dGENERAL->uwStartFrame) ||
(_uwFrame >= p_stCurrentA3dGENERAL->uwEndFrame) )
{
osSyncPrintf("Probleme decoupage d'animation (anim= %d, Frame= %d, StartFrame= %d, EndFrame= %d)\n", uwNumOfA3dGENERAL, _uwFrame, p_stCurrentA3dGENERAL->uwStartFrame, p_stCurrentA3dGENERAL->uwEndFrame);
ASM_BREAK;
}
#endif /* ANIM_DEBUG */
#ifdef A3X_N64
if(!bMustTest)
{
/*Here, the anim has been loaded and we can updade the number of the cache entry into the frame structure*/
_p_stFrame->ucCacheEntry=(unsigned char)p_stA3dHeaders[uwNumOfA3dGENERAL].uwNumOfCacheEntry;
}
/* End of AR9902*/
#endif /*A3X_N64*/
uwCorrectedFrame = (unsigned short) (_uwFrame - p_stCurrentA3dGENERAL->uwStartFrame);
/* ----------------------------------------------------------------------------------*/
/* Get information to update frame info*/
p_stCurrentChannel = &p_stChannels [p_stCurrentA3dGENERAL->uwNumOfFirstChannel];
p_stCurrentOnlyFrame = &p_stOnlyFrames[p_stCurrentA3dGENERAL->uwNumOfFirstOnlyFrame + uwCorrectedFrame];
uwT_NTTO = p_stCurrentOnlyFrame->uwNumOfSavedFrame;
/* ----------------------------------------------------------------------------------*/
/* Set Angular Speed Matrix if exist*/
#ifndef U64
if (p_stCurrentOnlyFrame->uwNumOfAngularSpeedQuat == SEB_Invalid)
{
/* free matrix if allocated*/
if (_p_stFrame->p_stAngularSpeedMatrix)
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeSpeedMatrix , 0 );
TMP_M_Free(_p_stFrame->p_stAngularSpeedMatrix);
}
_p_stFrame->p_stAngularSpeedMatrix= NULL;
}
else
{
tdxQuater4 a4_xQuatOri;
/* allocate matrix if it wasn't*/
if (!_p_stFrame->p_stAngularSpeedMatrix)
{
MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeSpeedMatrix , 0 );
_p_stFrame->p_stAngularSpeedMatrix = TMP_M_p_Malloc(sizeof(MTH3D_tdstMatrix));
}
fn_v_ExpandQuat(a4_xQuatOri,p_a4_xQuaternions[p_stCurrentOnlyFrame->uwNumOfAngularSpeedQuat]);
fn_v_QuatToMatrix(*((tdxMatrix33 *) (_p_stFrame->p_stAngularSpeedMatrix)),a4_xQuatOri);
}
/* ----------------------------------------------------------------------------------*/
/* Set Linear Speed Vector if exist*/
if (p_stCurrentOnlyFrame->uwNumOfSpeedVector == SEB_Invalid)
{
_p_stFrame->p_stLinearSpeedVector = NULL;
}
else
{
_p_stFrame->p_stLinearSpeedVector = (MTH3D_tdstVector *) &p_a3_xVectors[p_stCurrentOnlyFrame->uwNumOfSpeedVector];
}
#endif
/* ---------------------------------------------------------------------------------- */
/* Set Hierarchy */
if (p_stCurrentOnlyFrame->uwHierarchyNbCouples)
{
#ifdef U64
/* Begin AR9902 Copy hierarchy instead of pointing it */
if(_p_stFrame->stHierarchy.d_stCouples!=NULL)
{
if((memcmp(_p_stFrame->stHierarchy.d_stCouples,
&p_stHierarchies[p_stCurrentOnlyFrame->uwNumOfFirstHierarchyCouple],
sizeof(tdstCouple)*p_stCurrentOnlyFrame->uwHierarchyNbCouples)!=0) ||
(p_stCurrentOnlyFrame->uwHierarchyNbCouples != _p_stFrame->stHierarchy.ulNbOfCouples))
{
/* hierarchy is different */
MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeHierarchies , 0 );
_p_stFrame->stHierarchy.d_stCouples = TMP_M_p_Malloc(sizeof(tdstCouple)*p_stCurrentOnlyFrame->uwHierarchyNbCouples);
memcpy(_p_stFrame->stHierarchy.d_stCouples,
&p_stHierarchies[p_stCurrentOnlyFrame->uwNumOfFirstHierarchyCouple],
sizeof(tdstCouple)*p_stCurrentOnlyFrame->uwHierarchyNbCouples);
/* The old hierarchy is freed into the anim player (PLA_fn_vInitAllChildInHeapNewAnim) */
}
}
else
{
/* no previous hierarchy */
MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeHierarchies , 0 );
_p_stFrame->stHierarchy.d_stCouples = TMP_M_p_Malloc(sizeof(tdstCouple)*p_stCurrentOnlyFrame->uwHierarchyNbCouples);
memcpy(_p_stFrame->stHierarchy.d_stCouples,
&p_stHierarchies[p_stCurrentOnlyFrame->uwNumOfFirstHierarchyCouple],
sizeof(tdstCouple)*p_stCurrentOnlyFrame->uwHierarchyNbCouples);
}
/* End AR9902 */
#else
_p_stFrame->stHierarchy.d_stCouples = (tdstCouple *) &p_stHierarchies[p_stCurrentOnlyFrame->uwNumOfFirstHierarchyCouple];
#endif
}
else
_p_stFrame->stHierarchy.d_stCouples = NULL;
_p_stFrame->stHierarchy.ulNbOfCouples = p_stCurrentOnlyFrame->uwHierarchyNbCouples;
/* ----------------------------------------------------------------------------------*/
/* Set Frame Info - don't compute matrix*/
for (uwCnt1=0,p_stCurrentElement3d=_p_stFrame->p_stArrayOfElts3d;uwCnt1<p_stCurrentA3dGENERAL->uwNumberOfChannels;uwCnt1++)
{
tdstFrame * p_stCurrentFrame;
/* Get Current Frame info*/
p_stCurrentFrame = &p_stFrames[p_stCurrentChannel->uwNumOfFirstFrame + uwT_NTTO];
/* ----------------------------------------------------------------------------------*/
/* Fill element 3D structure*/
if(p_stCurrentFrame->uwNumOfNTTO!=(unsigned short)0xFFFF) /* empty object AR9810*/
{
/* Element Number in TBL*/
p_stCurrentElement3d->wElement = p_stNTTO[p_stCurrentFrame->uwNumOfNTTO].ucNumberInTable;
/* Channel Number*/
p_stCurrentElement3d->ucChannelNumber = (unsigned char)(p_stCurrentChannel->uwChannelNumber);
/* Active Status*/
p_stCurrentElement3d->bf1ActiveStatus = TRUE;
/* Type Of Element*/
p_stCurrentElement3d->eTypeOfElement = (tdeTypeOfElement)(p_stNTTO[p_stCurrentFrame->uwNumOfNTTO].uwTypeOfObject & 0x00FF);
/* ucTransparency*/
p_stCurrentElement3d->ucTransparency= p_stNTTO[ p_stCurrentFrame->uwNumOfNTTO ].ucTransparency;
}
else
{
/* XB 05/05/99 : typeof(wElement)=unsigned char on N64 !! */
#ifndef U64
p_stCurrentElement3d->wElement = (unsigned short) -1;
#else
p_stCurrentElement3d->wElement = (unsigned char) -1;
#endif
/* End XB 05/05/99 */
p_stCurrentElement3d->ucChannelNumber = (unsigned char)(p_stCurrentChannel->uwChannelNumber);
p_stCurrentElement3d->bf1ActiveStatus = TRUE;
p_stCurrentElement3d->eTypeOfElement = TE_EmptyObject;
p_stCurrentElement3d->ucTransparency = 0;
}
p_stCurrentChannel++;
p_stCurrentElement3d++;
}
}
/* ************************************************************ fn_vUpdateFrameMatrix*/
/* Update Frame if it wasn't update*/
/* Update Matrix in Channel Array*/
/* if they weren't updated*/
/* or if bolean ForceUpdate is TRUE*/
/**/
/* 17/07/98 - Carlos Torres*/
/* ***********************************************************************************/
void fn_vUpdateFrameMatrix(void * _p_stSuperObject,tdstFrame3d * _p_stFrame,tdstAnim3d * _p_stAnim3d,
unsigned short _uwFrame,unsigned char ucForceUpdate,tdstAChannel * d_stChannelArray) {
tdstA3dGENERAL * p_stCurrentA3dGENERAL;
tdstChannel * p_stCurrentChannel;
unsigned short uwT_NTTO;
unsigned short uwCnt1,uwNumOfA3dGENERAL;
unsigned short uwCorrectedFrame;
ACP_tdxBool bHierarchized;
/* ----------------------------------------------------------------------------------*/
/* update frame*/
fn_vUpdateFrame(_p_stSuperObject,_p_stFrame,_p_stAnim3d,_uwFrame);
/* ----------------------------------------------------------------------------------*/
/* check if the frame matrix is already updated*/
if (_p_stFrame->ucMatrixUpdated && !ucForceUpdate)
return;
/* ----------------------------------------------------------------------------------*/
/* set ref of the frame*/
_p_stFrame->ucMatrixUpdated = TRUE;
/* ----------------------------------------------------------------------------------*/
/* Get A3D General Info*/
#ifdef A3X_N64
#ifndef FORCE_REAL_TIME_LOAD
if(g_bRealTimeAnimationLoad)
#endif
uwNumOfA3dGENERAL= fn_uw_GetNumOfA3dGENERAL(_p_stAnim3d->uwNumOfA3dGENERAL, _uwFrame);
#ifndef FORCE_REAL_TIME_LOAD
else
#endif
#endif
#ifndef FORCE_REAL_TIME_LOAD
uwNumOfA3dGENERAL= _p_stAnim3d->uwNumOfA3dGENERAL;
#endif
p_stCurrentA3dGENERAL = fn_p_GetA3dGENERAL(uwNumOfA3dGENERAL,_uwFrame);
#ifdef A3X_N64
/* ----------------------------------------------------------------------------------*/
/* check if anim cutting is well done*/
#ifdef ANIM_DEBUG
if ((_uwFrame < p_stCurrentA3dGENERAL->uwStartFrame) ||
(_uwFrame >= p_stCurrentA3dGENERAL->uwEndFrame) )
{
osSyncPrintf("Probleme decoupage d'animation (anim= %d, frame= %d, StartFrame= %d, EndFrame= %d)\n", uwNumOfA3dGENERAL, _uwFrame, p_stCurrentA3dGENERAL->uwStartFrame, p_stCurrentA3dGENERAL->uwEndFrame);
osSyncPrintf("Num<EFBFBD>ro original d'anim : %d\n",_p_stAnim3d->uwNumOfA3dGENERAL);
ASM_BREAK;
}
#endif /* ANIM_DEBUG */
#endif
uwCorrectedFrame = (unsigned short) (_uwFrame - p_stCurrentA3dGENERAL->uwStartFrame);
/* ----------------------------------------------------------------------------------*/
/* Get information to update frame info*/
p_stCurrentChannel = &p_stChannels [p_stCurrentA3dGENERAL->uwNumOfFirstChannel];
uwT_NTTO = p_stOnlyFrames[p_stCurrentA3dGENERAL->uwNumOfFirstOnlyFrame + uwCorrectedFrame].uwNumOfSavedFrame;
/* ----------------------------------------------------------------------------------*/
/* Interpolate all channels Matrix*/
for (uwCnt1=0;uwCnt1<p_stCurrentA3dGENERAL->uwNumberOfChannels;uwCnt1++) {
tdstFrame * p_stCurrentFrame;
tdstFrameKF * p_stCurrentFrameKF;
tdstKeyFrame * p_stCurrentKeyFrame, * p_stOldKeyFrame;
register SEB_xReal xDT= xZero;
/* TEMP ANTI BUG - to avoid crash with bad Anim*/
/* Later replace by an assert in debuf version*/
if ((p_stCurrentChannel->uwChannelNumber != SEB_Invalid) &&
(!d_stChannelArray[p_stCurrentChannel->uwChannelNumber].bControlledChannel))
{
/* Get Current frame information*/
p_stCurrentFrame = &p_stFrames[p_stCurrentChannel->uwNumOfFirstFrame + uwT_NTTO];
p_stCurrentFrameKF = &p_stFramesKF[p_stCurrentChannel->ulNumOfFirstFrameKF + uwCorrectedFrame];
p_stOldKeyFrame = &p_stKeyFrames[p_stCurrentFrameKF->uwNumOfKeyFrame];
/* get key frame for interpolation*/
if ((p_stOldKeyFrame->uwMask & SEB_xMaskLastKey) != 0x0000)
{
if ((p_stOldKeyFrame->uwMask & SEB_xTypeWrapLastKey) != 0x0000)
{
p_stCurrentKeyFrame= &p_stKeyFrames[ p_stFramesKF[p_stCurrentChannel->ulNumOfFirstFrameKF].uwNumOfKeyFrame ];
xDT= ((SEB_xReal) (_uwFrame - p_stOldKeyFrame->uwFrameNumber)) / ((SEB_xReal) (p_stCurrentA3dGENERAL->uwNumberOfFrames + p_stCurrentKeyFrame->uwFrameNumber - p_stOldKeyFrame->uwFrameNumber));
}
else
{
p_stCurrentKeyFrame = p_stOldKeyFrame;
xDT = xZero;
}
}
else {
p_stCurrentKeyFrame = p_stOldKeyFrame + 1;
if (p_stCurrentKeyFrame->uwFrameNumber == p_stOldKeyFrame->uwFrameNumber)
xDT = xZero;
else
xDT = ((SEB_xReal)(_uwFrame - p_stOldKeyFrame->uwFrameNumber)) / ((SEB_xReal)(p_stCurrentKeyFrame->uwFrameNumber - p_stOldKeyFrame->uwFrameNumber));
}
/* InterpolationParameter*/
if ( (p_stOldKeyFrame->swInterpolationParameter != 0x0000) && (xDT != xZero) )
{ register SEB_xReal xTmp;
xTmp= p_stCurrentKeyFrame->swInterpolationParameter * ((SEB_xReal) (1.0f / 8192.0f));
xDT= xDT * (xDT * xTmp + xOne - xTmp);
}
if(p_stNTTO[p_stCurrentFrame->uwNumOfNTTO].uwTypeOfObject!=(unsigned short)0xFFFF)
bHierarchized=(ACP_tdxBool)(p_stNTTO[p_stCurrentFrame->uwNumOfNTTO].uwTypeOfObject & SEB_xTypeHierarchized);
else
bHierarchized=FALSE;
/* Interpolate channel matrix*/
fn_v_InterpolBetweenKeys(
p_stOldKeyFrame,
p_stCurrentKeyFrame,
p_stCurrentChannel,
d_stChannelArray[p_stCurrentChannel->uwChannelNumber].hSupObject->hLocalMatrix,
bHierarchized,
xDT);
}
p_stCurrentChannel++;
}
}
/* ****************************************************** fn_p_stGetLinearSpeedVector*/
/* Return the Linear Speed Vector*/
/* the vector returned is a reference so*/
/* DON'T Modify it or Free it*/
/* if there is no speed, return NULL*/
/* reference remain valid until animation is free*/
/**/
/* 20/07/98 - Carlos Torres*/
/* ***********************************************************************************/
MTH3D_tdstVector * fn_p_stGetLinearSpeedVector(tdstAnim3d * _p_stAnim3d,unsigned short _uwFrame) {
unsigned short uwNumOfA3dGENERAL;
tdstA3dGENERAL * p_stCurrentA3dGENERAL;
tdstOnlyFrame * p_stCurrentOnlyFrame;
if ( _uwFrame >= _p_stAnim3d->uwNumberOfFrames )
return NULL; /* Can occur sometimes... AR9808*/
/* ----------------------------------------------------------------------------------*/
/* Get A3D General Info*/
#ifdef A3X_N64
#ifndef FORCE_REAL_TIME_LOAD
if(g_bRealTimeAnimationLoad)
#endif
uwNumOfA3dGENERAL= fn_uw_GetNumOfA3dGENERAL(_p_stAnim3d->uwNumOfA3dGENERAL, _uwFrame);
#ifndef FORCE_REAL_TIME_LOAD
else
#endif
#endif
#ifndef FORCE_REAL_TIME_LOAD
uwNumOfA3dGENERAL= _p_stAnim3d->uwNumOfA3dGENERAL;
#endif
p_stCurrentA3dGENERAL = fn_p_GetA3dGENERAL(uwNumOfA3dGENERAL,_uwFrame);
#ifdef A3X_N64
/* ----------------------------------------------------------------------------------*/
/* check if anim cutting is well done*/
#ifdef ANIM_DEBUG
if ((_uwFrame < p_stCurrentA3dGENERAL->uwStartFrame) ||
(_uwFrame >= p_stCurrentA3dGENERAL->uwEndFrame) )
{
osSyncPrintf("Probleme decoupage d'animation (anim= %d, Frame= %d, StartFrame= %d, EndFrame= %d)\n", uwNumOfA3dGENERAL, _uwFrame, p_stCurrentA3dGENERAL->uwStartFrame, p_stCurrentA3dGENERAL->uwEndFrame);
osSyncPrintf("Numero original d'anim : %d\n",_p_stAnim3d->uwNumOfA3dGENERAL);
ASM_BREAK;
}
#endif /* ANIM_DEBUG */
#endif
#ifndef U64
#pragma warning(disable:4244)
#endif
_uwFrame -= p_stCurrentA3dGENERAL->uwStartFrame;
#ifndef U64
#pragma warning(default:4244)
#endif
/* ----------------------------------------------------------------------------------*/
/* Get information to update frame info*/
p_stCurrentOnlyFrame = &p_stOnlyFrames[p_stCurrentA3dGENERAL->uwNumOfFirstOnlyFrame + _uwFrame];
/* ----------------------------------------------------------------------------------*/
/* Set Linear Speed Vector if exist*/
if (p_stCurrentOnlyFrame->uwNumOfSpeedVector == SEB_Invalid) {
return NULL;
}
else {
return (MTH3D_tdstVector *) &p_a3_xVectors[p_stCurrentOnlyFrame->uwNumOfSpeedVector];
}
}
/* ***************************************************** fn_p_stGetAngularSpeedMatrix*/
/* Return the Angular Speed Matrix*/
/* Fill the Matrix if exist and return pointer*/
/* If no angular speed return NULL*/
/* The matrix pass in parameter must be allocate by the calling function*/
/**/
/* 20/07/98 - Carlos Torres*/
/* ***********************************************************************************/
MTH3D_tdstMatrix * fn_p_stGetAngularSpeedMatrix(tdstAnim3d * _p_stAnim3d,unsigned short _uwFrame,MTH3D_tdstMatrix * p_stMatrix) {
unsigned short uwNumOfA3dGENERAL;
tdstA3dGENERAL * p_stCurrentA3dGENERAL;
tdstOnlyFrame * p_stCurrentOnlyFrame;
if ( _uwFrame >= _p_stAnim3d->uwNumberOfFrames )
return NULL; /* Can occur sometimes... AR9808*/
/* ----------------------------------------------------------------------------------*/
/* Get A3D General Info*/
#ifdef A3X_N64
#ifndef FORCE_REAL_TIME_LOAD
if(g_bRealTimeAnimationLoad)
#endif
uwNumOfA3dGENERAL= fn_uw_GetNumOfA3dGENERAL(_p_stAnim3d->uwNumOfA3dGENERAL, _uwFrame);
#ifndef FORCE_REAL_TIME_LOAD
else
#endif
#endif
#ifndef FORCE_REAL_TIME_LOAD
uwNumOfA3dGENERAL= _p_stAnim3d->uwNumOfA3dGENERAL;
#endif
p_stCurrentA3dGENERAL = fn_p_GetA3dGENERAL(uwNumOfA3dGENERAL,_uwFrame);
#ifdef A3X_N64
/* ----------------------------------------------------------------------------------*/
/* check if anim cutting is well done*/
#ifdef ANIM_DEBUG
if ((_uwFrame < p_stCurrentA3dGENERAL->uwStartFrame) ||
(_uwFrame >= p_stCurrentA3dGENERAL->uwEndFrame) )
{
osSyncPrintf("Probleme decoupage d'animation (anim= %d, Frame= %d, StartFrame= %d, EndFrame= %d)\n", uwNumOfA3dGENERAL, _uwFrame, p_stCurrentA3dGENERAL->uwStartFrame, p_stCurrentA3dGENERAL->uwEndFrame);
osSyncPrintf("Animation originelle : %d\n",_p_stAnim3d->uwNumOfA3dGENERAL);
ASM_BREAK;
}
#endif /* ANIM_DEBUG */
#endif /*A3X_N64*/
#ifndef U64
#pragma warning(disable:4244)
#endif
_uwFrame -= p_stCurrentA3dGENERAL->uwStartFrame;
#ifndef U64
#pragma warning(default:4244)
#endif
/* ----------------------------------------------------------------------------------*/
/* Get information to update frame info*/
p_stCurrentOnlyFrame = &p_stOnlyFrames[p_stCurrentA3dGENERAL->uwNumOfFirstOnlyFrame + _uwFrame];
/* ----------------------------------------------------------------------------------*/
/* Set Angular Speed Matrix if exist*/
if (p_stCurrentOnlyFrame->uwNumOfAngularSpeedQuat == SEB_Invalid) {
return NULL;
}
else {
tdxQuater4 a4_xQuatOri;
fn_v_ExpandQuat(a4_xQuatOri,p_a4_xQuaternions[p_stCurrentOnlyFrame->uwNumOfAngularSpeedQuat]);
/* if (_uwFrame != 1)
fn_v_InterpolQuatWithOmega( a4_xQuatOri, a4_xQuater1, a4_xQuatOri, (SEB_xReal)_uwFrame, p_stCurrentOnlyFrame->uwAngSpeedQuat ); */
fn_v_QuatToMatrix(*((tdxMatrix33 *) (p_stMatrix)),a4_xQuatOri);
return p_stMatrix;
}
}
#undef A3X_INTN_C

View File

@@ -0,0 +1,813 @@
/* ***********************************************************************************/
/* * "a3x_load.c" **/
/* * Written by : S<>bastien Rubens **/
/* * Tabulations : 4 char **/
/* ***********************************************************************************/
/* ***********************************************************************************/
#define A3X_LOAD_C
/* ***********************************************************************************/
/* Included files*/
#include <math.h>
#include <stdio.h>
#include "PlayAnim/Interpol/specif/a3x_pref.h"
/*#define LST2_StaticIsOptimised*/
#include "TOOLSCPA.h"
#include "cpa_std.h"
#include "STRUCTUR/Anim_s.h"
#include "PlayAnim/Interpol/a3x_glob.h"
#include "PlayAnim/Interpol/a3x_int.h"
#include "PlayAnim/Interpol/a3x_mem.h"
#include "PlayAnim/Interpol/a3x_load.h"
/* ***********************************************************************************/
/* Globals datas*/
static void *p_vCurrentFile;
static tdstFileA3dAnimationGENERAL *p_stFileA3dGENERAL;
static tdxULongVector3 *p_stFileVector3;
static tdxSShortQuater4 *p_stFileQuater4;
static tdstFileHierarchy *p_stFileHierarchy;
static tdstFileNTTO *p_stFileNTTO;
static tdstFileOnlyFrame *p_stFileOnlyFrame;
static tdstFileChannel *p_stFileChannel;
static tdstFileFrame *p_stFileFrame;
static tdstFileKeyFrame *p_stFileKeyFrame;
static tdstFileEvent *p_stFileEvent;
static tdstFileMorphData *p_stFileMorphData;
static tdstA3dGENERAL *p_stCurrentA3dGENERAL;
static tdxULongVector3 *p_stCurrentVector3;
static tdxSShortQuater4 *p_stCurrentQuater4;
static tdstHierarchy *p_stCurrentHierarchy;
static tdstNTTO *p_stCurrentNTTO;
static tdstOnlyFrame *p_stCurrentOnlyFrame;
static tdstChannel *p_stCurrentChannel, *p_stFirstChannel;
static tdstFrame *p_stCurrentFrame;
static tdstKeyFrame *p_stCurrentKeyFrame, *p_stOldKeyFrame;
static tdstEvent *p_stCurrentEvent;
static tdstMorphData *p_stCurrentMorphData;
static tdxMatrix33 a3a3_xMtxOri, a3a3_xMtxSca, a3a3_xScaleMatrix;
static tdxQuater4 a4_xOldQuatOri, a4_xOldQuatSca;
static tdxQuater4 a4_xQuatOri, a4_xQuatSca;
static tdxVector3 a3_xTmpVec;
static unsigned short uwNumOfFirstVector, uwNumOfFirstQuaternion, uwNumOfFirstHierarchy;
#ifdef ANIM_DEBUG
extern char* g_p_cSecurityMalloc; /* for debug -> to be removed !!!*/
#endif /*ANIM_DEBUG*/
/* ***********************************************************************************/
#ifdef A3xDebug
void fn_v_A3dVerify( char *a4_cNeededString,
char *p_cString )
{
if ( (a4_cNeededString[0] != p_cString[0]) ||
(a4_cNeededString[1] != p_cString[1]) ||
(a4_cNeededString[2] != p_cString[2]) ||
(a4_cNeededString[3] != p_cString[3]) )
{ printf("Error in %s hunk\n", a4_cNeededString );
}
}
#define M_A3xDebug( String, Type, p_xFile ) \
{ fn_v_A3dVerify( String, (char *) (p_xFile) ); \
p_xFile= (Type *) ( ((char *) (p_xFile)) + 8 ); \
}
#else
#define M_A3xDebug( String, Type, p_xFile )
#endif
#ifdef U64
/* XB 05/05/99 */
extern void *fast_memcpy( register void *dest, register void *src, register size_t n);
/* End XB 05/05/99 */
#define memcpy(a,b,c) fast_memcpy(a,b,c)
#endif /*U64*/
/* ***********************************************************************************/
void fn_v_LoadA3dGENERAL( void )
{
p_stCurrentA3dGENERAL= &p_stA3dGENERAL[ fn_ul_AllocateOnStack( eStackA3dGENERAL, 1 ) ];
p_stFileA3dGENERAL= (tdstFileA3dAnimationGENERAL *) p_vCurrentFile;
M_A3xDebug( "GENE", tdstFileA3dAnimationGENERAL, p_stFileA3dGENERAL );
/* p_stCurrentA3dGENERAL->uwAnimationSpeed= p_stFileA3dGENERAL->uwAnimationSpeed;
p_stCurrentA3dGENERAL->uwNumberOfVectors= p_stFileA3dGENERAL->uwNumberOfVectors;
p_stCurrentA3dGENERAL->uwNumberOfQuaternions= p_stFileA3dGENERAL->uwNumberOfQuaternions;
p_stCurrentA3dGENERAL->uwNumberOfHierarchies= p_stFileA3dGENERAL->uwNumberOfHierarchies;
p_stCurrentA3dGENERAL->uwNumberOfNTTO= p_stFileA3dGENERAL->uwNumberOfSavedNTTO;
p_stCurrentA3dGENERAL->uwNumberOfSavedFrames= p_stFileA3dGENERAL->uwNumberOfSavedFrames;
p_stCurrentA3dGENERAL->uwNumberOfChannels= p_stFileA3dGENERAL->uwNumberOfChannels;
p_stCurrentA3dGENERAL->uwNumberOfFrames= p_stFileA3dGENERAL->uwNumberOfFrames;
p_stCurrentA3dGENERAL->uwNumberOfKeyFrames= p_stFileA3dGENERAL->uwNumberOfKeyFrames;
p_stCurrentA3dGENERAL->uwNumberOfEvents= p_stFileA3dGENERAL->uwNumberOfEvents;
p_stCurrentA3dGENERAL->uwNumberOfMorphData= p_stFileA3dGENERAL->uwNumberOfMorphData;
p_stCurrentA3dGENERAL->uwNumOfAnimationTranslationOffset= p_stFileA3dGENERAL->uwNumOfAnimationTranslationOffset;
p_stCurrentA3dGENERAL->uwNumOfAnimationRotationOffset= p_stFileA3dGENERAL->uwNumOfAnimationRotationOffset;
p_stCurrentA3dGENERAL->uwNumOfFirstPosition= p_stFileA3dGENERAL->uwNumOfFirstPosition;
p_stCurrentA3dGENERAL->uwStartFrame= p_stFileA3dGENERAL->uwStartFrame;
p_stCurrentA3dGENERAL->uwEndFrame= p_stFileA3dGENERAL->uwEndFrame;
p_stCurrentA3dGENERAL->uwFlags= p_stFileA3dGENERAL->uwFlags;
p_stCurrentA3dGENERAL->uwFakeAnimSpeed= p_stFileA3dGENERAL->uwFakeAnimSpeed; */
/* p_stCurrentA3dGENERAL->uwAlign= 0;*/
/* optim AR9811*/
memcpy(p_stCurrentA3dGENERAL,p_stFileA3dGENERAL,sizeof(tdstFileA3dAnimationGENERAL));
p_stFileA3dGENERAL++;
p_vCurrentFile= (void *) p_stFileA3dGENERAL;
/*unsigned short uwNumOfFirstVector; will be set in fn_v_LoadVectors*/
/*unsigned short uwNumOfFirstQuaternion; will be set in fn_v_LoadQuaternions*/
/*unsigned short uwNumOfFirstHierarchy; will be set in fn_v_LoadHierarchies*/
/*unsigned short uwNumOfFirstNTTO; will be set in fn_v_LoadNTTO*/
/*unsigned short uwNumOfFirstOnlyFrame; will be set in fn_v_LoadOnlyFrames*/
/*unsigned short uwNumOfFirstChannel; will be set in fn_v_LoadChannels*/
/*unsigned short uwNumOfFirstEvent; will be set in fn_v_LoadEvents*/
/*unsigned short uwNumOfFirstPosition; will be add in fn_v_LoadVectors*/
/*unsigned short uwNumOfAnimationTranslationOffset; will be add in fn_v_LoadVectors*/
/*unsigned short uwNumOfAnimationRotationOffset; will be add in fn_v_LoadQuaternions*/
}
/* ***********************************************************************************/
void fn_v_LoadVectors( void )
{ register unsigned short uwMax/*, uwCnt1*/;
register unsigned long ulInd;
uwMax= p_stCurrentA3dGENERAL->uwNumberOfVectors;
ulInd= fn_ul_AllocateOnStack( eStackVertexes, uwMax );
uwNumOfFirstVector = p_stCurrentA3dGENERAL->uwNumOfFirstVector = (unsigned short)ulInd;
p_stCurrentVector3= (tdxULongVector3 *) &p_a3_xVectors[ ulInd ];
p_stFileVector3= (tdxULongVector3 *) p_vCurrentFile;
M_A3xDebug( "VERT", tdxULongVector3, p_stFileVector3 );
/* for ( uwCnt1=0 ; uwCnt1<uwMax ; uwCnt1++ )
{
(*p_stCurrentVector3)[0]= (*p_stFileVector3)[0];
(*p_stCurrentVector3)[1]= (*p_stFileVector3)[1];
(*p_stCurrentVector3)[2]= (*p_stFileVector3)[2];
p_stFileVector3++;
p_stCurrentVector3++;
}*/
memcpy(p_stCurrentVector3,p_stFileVector3,sizeof(tdxULongVector3)*uwMax); /* optim AR9811*/
/* p_vCurrentFile= (void *) p_stFileVector3;*/
p_vCurrentFile= (void *) (p_stFileVector3+uwMax);
p_stCurrentVector3 += uwMax;
#pragma warning(disable:4244)
p_stCurrentA3dGENERAL->uwNumOfFirstPosition+= uwNumOfFirstVector;
p_stCurrentA3dGENERAL->uwNumOfAnimationTranslationOffset+= uwNumOfFirstVector;
#pragma warning(default:4244)
}
/* ***********************************************************************************/
void fn_v_LoadQuaternions( void )
{ register unsigned short uwMax/*, uwCnt1*/;
register unsigned long ulInd;
uwMax= p_stCurrentA3dGENERAL->uwNumberOfQuaternions;
ulInd= fn_ul_AllocateOnStack( eStackQuaternions, uwMax );
uwNumOfFirstQuaternion = p_stCurrentA3dGENERAL->uwNumOfFirstQuaternion = (unsigned short)ulInd;
p_stCurrentQuater4= &p_a4_xQuaternions[ ulInd ];
p_stFileQuater4= (tdxSShortQuater4 *) p_vCurrentFile;
M_A3xDebug( "QUAT", tdxSShortQuater4, p_stFileQuater4 );
/* for ( uwCnt1=0 ; uwCnt1<uwMax ; uwCnt1++ )
{
(*p_stCurrentQuater4)[0]= (*p_stFileQuater4)[0];
(*p_stCurrentQuater4)[1]= (*p_stFileQuater4)[1];
(*p_stCurrentQuater4)[2]= (*p_stFileQuater4)[2];
(*p_stCurrentQuater4)[3]= (*p_stFileQuater4)[3];
p_stFileQuater4++;
p_stCurrentQuater4++;
} */
memcpy(p_stCurrentQuater4,p_stFileQuater4,sizeof(tdxSShortQuater4)*uwMax); /* optim AR9811*/
/* p_vCurrentFile= (void *) p_stFileQuater4;*/
p_vCurrentFile= (void *) (p_stFileQuater4+uwMax);
p_stCurrentQuater4 += uwMax;
#pragma warning(disable:4244)
p_stCurrentA3dGENERAL->uwNumOfAnimationRotationOffset+= uwNumOfFirstQuaternion;
#pragma warning(default:4244)
}
/* ***********************************************************************************/
void fn_v_LoadHierarchies( void )
{ register unsigned short uwMax/*, uwCnt1*/;
register unsigned long ulInd;
uwMax= p_stCurrentA3dGENERAL->uwNumberOfHierarchies;
ulInd= fn_ul_AllocateOnStack( eStackHierarchies, uwMax );
uwNumOfFirstHierarchy = p_stCurrentA3dGENERAL->uwNumOfFirstHierarchy = (unsigned short)ulInd;
p_stCurrentHierarchy= &p_stHierarchies[ ulInd ];
p_stFileHierarchy= (tdstFileHierarchy *) p_vCurrentFile;
M_A3xDebug( "HIER", tdstFileHierarchy, p_stFileHierarchy );
/* for ( uwCnt1=0 ; uwCnt1<uwMax ; uwCnt1++ )
{
p_stCurrentHierarchy->uwChild= p_stFileHierarchy->uwChild;
p_stCurrentHierarchy->uwFather= p_stFileHierarchy->uwFather;
p_stFileHierarchy++;
p_stCurrentHierarchy++;
} */
memcpy(p_stCurrentHierarchy,p_stFileHierarchy,sizeof(tdstFileHierarchy)*uwMax); /* optim AR9811*/
/* p_vCurrentFile= (void *) p_stFileHierarchy;*/
p_vCurrentFile= (void *) (p_stFileHierarchy+uwMax);
p_stCurrentHierarchy+=uwMax;
}
/* ***********************************************************************************/
void fn_v_LoadNTTO( void )
{ register unsigned short uwMax/*, uwCnt1*/;
register unsigned long ulInd;
uwMax= p_stCurrentA3dGENERAL->uwNumberOfNTTO;
ulInd= fn_ul_AllocateOnStack( eStackNTTO, uwMax );
p_stCurrentA3dGENERAL->uwNumOfFirstNTTO = (unsigned short)ulInd;
p_stCurrentNTTO= &p_stNTTO[ ulInd ];
p_stFileNTTO= (tdstFileNTTO *) p_vCurrentFile;
M_A3xDebug( "NTTO", tdstFileNTTO, p_stFileNTTO );
/* for ( uwCnt1=0 ; uwCnt1<uwMax ; uwCnt1++ )
{
p_stCurrentNTTO->ucNumberInTable= p_stFileNTTO->ucNumberInTable;
p_stCurrentNTTO->uwTypeOfObject= p_stFileNTTO->uwTypeOfObject;
p_stCurrentNTTO->ucTransparency= p_stFileNTTO->ucTransparency;
p_stFileNTTO++;
p_stCurrentNTTO++;
} */
memcpy(p_stCurrentNTTO,p_stFileNTTO,sizeof(tdstFileNTTO)*uwMax); /* optim AR9811*/
/* p_vCurrentFile= (void *) p_stFileNTTO;*/
p_vCurrentFile= (void *) (p_stFileNTTO+uwMax);
p_stCurrentNTTO+=uwMax;
}
/* ***********************************************************************************/
void fn_v_LoadOnlyFrames( void )
{ register unsigned short uwCnt1, uwMax;
register unsigned long ulInd;
uwMax= (unsigned short)(p_stCurrentA3dGENERAL->uwEndFrame - p_stCurrentA3dGENERAL->uwStartFrame);
ulInd= fn_ul_AllocateOnStack( eStackOnlyFrames, uwMax );
p_stCurrentA3dGENERAL->uwNumOfFirstOnlyFrame = (unsigned short)ulInd;
p_stCurrentOnlyFrame= &p_stOnlyFrames[ ulInd ];
p_stFileOnlyFrame= (tdstFileOnlyFrame *) p_vCurrentFile;
M_A3xDebug( "OFRM", tdstFileOnlyFrame, p_stFileOnlyFrame );
for ( uwCnt1=0 ; uwCnt1<uwMax ; uwCnt1++ )
{
if ( p_stFileOnlyFrame->uwNumOfAngularSpeedQuat != SEB_Invalid )
{ p_stCurrentOnlyFrame->uwNumOfAngularSpeedQuat= (unsigned short) (uwNumOfFirstQuaternion + p_stFileOnlyFrame->uwNumOfAngularSpeedQuat);
/* fn_v_ExpandQuat( a4_xQuatOri, p_a4_xQuaternions[ p_stCurrentOnlyFrame->uwNumOfAngularSpeedQuat ] );
p_stCurrentOnlyFrame->uwAngSpeedQuat= fn_uw_AngleBetweenQuat( a4_xQuatOri, a4_xQuater1 ); */
}
else
{ p_stCurrentOnlyFrame->uwNumOfAngularSpeedQuat= SEB_Invalid;
}
if ( p_stFileOnlyFrame->uwNumOfSpeedVector != SEB_Invalid )
p_stCurrentOnlyFrame->uwNumOfSpeedVector=(unsigned short)(uwNumOfFirstVector + p_stFileOnlyFrame->uwNumOfSpeedVector);
else p_stCurrentOnlyFrame->uwNumOfSpeedVector= SEB_Invalid;
p_stCurrentOnlyFrame->uwHierarchyNbCouples= p_stFileOnlyFrame->uwHierarchyNbCouples;
p_stCurrentOnlyFrame->uwNumOfFirstHierarchyCouple= (unsigned short)(uwNumOfFirstHierarchy + p_stFileOnlyFrame->uwNumOfHierarchyCouples);
p_stCurrentOnlyFrame->uwNumOfSavedFrame= p_stFileOnlyFrame->uwNumOfSavedFrame;
p_stFileOnlyFrame++;
p_stCurrentOnlyFrame++;
}
p_vCurrentFile= (void *) p_stFileOnlyFrame;
}
/* ***********************************************************************************/
void fn_v_LoadChannels( void )
{ register unsigned short uwCnt1, uwMax;
register unsigned long ulInd;
uwMax= p_stCurrentA3dGENERAL->uwNumberOfChannels;
ulInd= fn_ul_AllocateOnStack( eStackChannels, uwMax );
p_stCurrentA3dGENERAL->uwNumOfFirstChannel = (unsigned short)ulInd;
p_stFirstChannel= &p_stChannels[ ulInd ];
p_stCurrentChannel= p_stFirstChannel;
p_stFileChannel= (tdstFileChannel *) p_vCurrentFile;
M_A3xDebug( "CHAN", tdstFileChannel, p_stFileChannel );
for ( uwCnt1=0 ; uwCnt1<uwMax ; uwCnt1++ )
{
p_stCurrentChannel->uwNumberOfKeys= p_stFileChannel->uwNumberOfKeys;
p_stCurrentChannel->uwChannelNumber= p_stFileChannel->uwChannelNumber;
p_stCurrentChannel->uwNumOfLocalPivotPos= (unsigned short)(uwNumOfFirstVector + p_stFileChannel->uwNumOfLocalPivotPos);
p_stFileChannel++;
p_stCurrentChannel++;
}
p_vCurrentFile= (void *) p_stFileChannel;
/*unsigned short uwNumOfFirstFrame; will be set in fn_v_LoadFrames*/
/*unsigned short uwNumOfFirstFrameKF; will be set in fn_v_LoadFrames*/
/*unsigned short uwNumOfFirstKeyFrame; will be set in fn_v_LoadKeyFrames*/
}
/* ***********************************************************************************/
void fn_v_LoadFrames( void )
{ register unsigned short uwCnt1, uwCnt2, uwMax;
register unsigned long ulInd;
p_stCurrentChannel= p_stFirstChannel;
p_stFileFrame= (tdstFileFrame *) p_vCurrentFile;
M_A3xDebug( "FRMS", tdstFileFrame, p_stFileFrame );
for ( uwCnt1=0 ; uwCnt1<p_stCurrentA3dGENERAL->uwNumberOfChannels ; uwCnt1++ )
{
uwMax= p_stCurrentA3dGENERAL->uwNumberOfSavedFrames;
ulInd= fn_ul_AllocateOnStack( eStackFrames, uwMax );
p_stCurrentChannel->uwNumOfFirstFrame=(unsigned short)ulInd;
p_stCurrentFrame= &p_stFrames[ ulInd ];
for ( uwCnt2=0 ; uwCnt2<uwMax ; uwCnt2++ )
{
if(p_stFileFrame->uwNumOfNTTO!=(unsigned short)0xFFFF) /*AR9810 0xFFFF means simple empty object*/
p_stCurrentFrame->uwNumOfNTTO= (unsigned short)(p_stCurrentA3dGENERAL->uwNumOfFirstNTTO + p_stFileFrame->uwNumOfNTTO);
else
p_stCurrentFrame->uwNumOfNTTO=(unsigned short)0xFFFF;
p_stFileFrame++;
p_stCurrentFrame++;
}
uwMax= (unsigned short)(p_stCurrentA3dGENERAL->uwEndFrame - p_stCurrentA3dGENERAL->uwStartFrame);
ulInd= fn_ul_AllocateOnStack( eStackFramesKF, uwMax );
p_stCurrentChannel->ulNumOfFirstFrameKF = ulInd;
p_stCurrentChannel++;
}
p_vCurrentFile= (void *) p_stFileFrame;
/*unsigned short uwNumOfKeyFrame; will be set in fn_v_LoadKeyFrames*/
}
/* ***********************************************************************************/
void fn_v_LoadKeyFrames( void )
{ register unsigned short uwCnt1, uwCnt2, uwCnt3, uwMax;
register unsigned long ulInd;
unsigned short uwNumOfPosition;
unsigned long ulNumOfFirstFrameKF;
unsigned short uwNumOfOldKeyFrame= 0, uwNumOfCurrentKeyFrame;
unsigned short uwNumOfOldFrameNumber= 0, uwNumOfCurrentFrameNumber;
unsigned short uwNumOfOldPosition= 0;
p_stCurrentChannel= p_stFirstChannel;
p_stFileKeyFrame= (tdstFileKeyFrame *) p_vCurrentFile;
M_A3xDebug( "KFRM", tdstFileKeyFrame, p_stFileKeyFrame );
for ( uwCnt1=0 ; uwCnt1<p_stCurrentA3dGENERAL->uwNumberOfChannels ; uwCnt1++ )
{
/* Allocate KeyFrames*/
uwMax= p_stCurrentChannel->uwNumberOfKeys;
ulInd= fn_ul_AllocateOnStack( eStackKeyFrames, uwMax );
p_stCurrentChannel->uwNumOfFirstKeyFrame = (unsigned short)ulInd;
p_stCurrentKeyFrame= &p_stKeyFrames[ ulInd ];
/* Warning : don't change uwInd value (it will use at the end of this routine to get first keyframe)*/
ulNumOfFirstFrameKF= p_stCurrentChannel->ulNumOfFirstFrameKF;
uwNumOfCurrentKeyFrame= (unsigned short)ulInd;
uwNumOfCurrentFrameNumber= 0;
ulInd= 0;
uwCnt3= p_stCurrentChannel->uwNumOfLocalPivotPos;
if ( (p_a3_xVectors[uwCnt3][0] != xZero) ||
(p_a3_xVectors[uwCnt3][1] != xZero) ||
(p_a3_xVectors[uwCnt3][2] != xZero) )
{ ulInd= 1;
}
for ( uwCnt2=0 ; uwCnt2<uwMax ; uwCnt2++ )
{
/* Copy Key Frame information*/
p_stCurrentKeyFrame->uwFrameNumber= p_stFileKeyFrame->uwFrameNumber;
p_stCurrentKeyFrame->uwMask= p_stFileKeyFrame->uwMask;
p_stCurrentKeyFrame->uwNumOfQuatOri= (unsigned short)(uwNumOfFirstQuaternion + p_stFileKeyFrame->uwNumOfQuatOri);
p_stCurrentKeyFrame->uwNumOfQuatSca= (unsigned short)(uwNumOfFirstQuaternion + p_stFileKeyFrame->uwNumOfQuatSca);
p_stCurrentKeyFrame->uwNumOfScaleValues= (unsigned short)(uwNumOfFirstVector + p_stFileKeyFrame->uwNumOfScaleValues);
p_stCurrentKeyFrame->uwNumOfPosition= (unsigned short)(uwNumOfFirstVector + p_stFileKeyFrame->uwNumOfPosition);
p_stCurrentKeyFrame->swInterpolationParameter= p_stFileKeyFrame->swInterpolationParameter;
/* World Pivot position*/
fn_v_ExpandQuat ( a4_xQuatOri, p_a4_xQuaternions[ p_stCurrentKeyFrame->uwNumOfQuatOri ] );
fn_v_ExpandQuat( a4_xQuatSca, p_a4_xQuaternions[ p_stCurrentKeyFrame->uwNumOfQuatSca ] );
if (ulInd == 0)
{ register SEB_xReal xTmp;
xTmp= 0.0f;
p_stCurrentKeyFrame->a3_xWorldPivotPosition[0]= xTmp;
p_stCurrentKeyFrame->a3_xWorldPivotPosition[1]= xTmp;
p_stCurrentKeyFrame->a3_xWorldPivotPosition[2]= xTmp;
}
else
{
fn_v_QuatToMatrix( a3a3_xMtxOri, a4_xQuatOri );
/* optim AR9811*/
if((a4_xQuatSca[0]!=0.0f)||(a4_xQuatSca[1]!=0.0f)||(a4_xQuatSca[2]!=0.0f)||(a4_xQuatSca[3]!=1.0f))
{
fn_v_QuatToMatrix( a3a3_xMtxSca, a4_xQuatSca );
fn_v_InvRotDiaRot( a3a3_xScaleMatrix, a3a3_xMtxSca, p_a3_xVectors[ p_stCurrentKeyFrame->uwNumOfScaleValues ] );
fn_v_MatrixByVector( a3_xTmpVec, a3a3_xScaleMatrix, p_a3_xVectors[ p_stCurrentChannel->uwNumOfLocalPivotPos ] );
}
else
{
a3_xTmpVec[0]=p_a3_xVectors[ p_stCurrentKeyFrame->uwNumOfScaleValues ][0]*p_a3_xVectors[ p_stCurrentChannel->uwNumOfLocalPivotPos ][0];
a3_xTmpVec[1]=p_a3_xVectors[ p_stCurrentKeyFrame->uwNumOfScaleValues ][1]*p_a3_xVectors[ p_stCurrentChannel->uwNumOfLocalPivotPos ][1];
a3_xTmpVec[2]=p_a3_xVectors[ p_stCurrentKeyFrame->uwNumOfScaleValues ][2]*p_a3_xVectors[ p_stCurrentChannel->uwNumOfLocalPivotPos ][2];
}
fn_v_MatrixByVector( p_stCurrentKeyFrame->a3_xWorldPivotPosition, a3a3_xMtxOri, a3_xTmpVec );
}
uwNumOfPosition= p_stCurrentKeyFrame->uwNumOfPosition;
p_stCurrentKeyFrame->a3_xWorldPivotPosition[0]+= p_a3_xVectors[ uwNumOfPosition ][0];
p_stCurrentKeyFrame->a3_xWorldPivotPosition[1]+= p_a3_xVectors[ uwNumOfPosition ][1];
p_stCurrentKeyFrame->a3_xWorldPivotPosition[2]+= p_a3_xVectors[ uwNumOfPosition ][2];
/* DistMaster*/
p_stCurrentKeyFrame->xDistMaster= fn_x_VectorLength( p_a3_xVectors[ uwNumOfPosition ] );
/* If we are not on the first keyframe*/
if ( uwCnt2 > 0 )
{
p_stOldKeyFrame->uwAngQuatOri= 0x0000;
if ((p_stOldKeyFrame->uwMask & SEB_xMaskQuatOri) == 0x0000)
p_stOldKeyFrame->uwAngQuatOri= fn_uw_AngleBetweenQuat( a4_xOldQuatOri, a4_xQuatOri );
p_stOldKeyFrame->uwAngQuatSca= 0x0000;
if ((p_stOldKeyFrame->uwMask & SEB_xMaskQuatSca) == 0x0000)
p_stOldKeyFrame->uwAngQuatSca= fn_uw_AngleBetweenQuat( a4_xOldQuatSca, a4_xQuatSca );
/* Copy KeyFrames references*/
uwNumOfCurrentFrameNumber= p_stFileKeyFrame->uwFrameNumber;
if ( uwNumOfCurrentFrameNumber > p_stCurrentA3dGENERAL->uwEndFrame )
uwNumOfCurrentFrameNumber= p_stCurrentA3dGENERAL->uwEndFrame;
#pragma warning(disable:4244)
uwNumOfCurrentFrameNumber-= p_stCurrentA3dGENERAL->uwStartFrame;
#pragma warning(default:4244)
for ( uwCnt3=uwNumOfOldFrameNumber ; uwCnt3<uwNumOfCurrentFrameNumber ; uwCnt3++ )
p_stFramesKF[ulNumOfFirstFrameKF + uwCnt3].uwNumOfKeyFrame= uwNumOfOldKeyFrame;
}
/* Copy old informations*/
p_stOldKeyFrame= p_stCurrentKeyFrame;
fn_v_CopyQuat( a4_xOldQuatOri, a4_xQuatOri );
fn_v_CopyQuat( a4_xOldQuatSca, a4_xQuatSca );
uwNumOfOldPosition= uwNumOfPosition;
uwNumOfOldFrameNumber= uwNumOfCurrentFrameNumber;
uwNumOfOldKeyFrame= uwNumOfCurrentKeyFrame;
uwNumOfCurrentKeyFrame++;
p_stFileKeyFrame++;
p_stCurrentKeyFrame++;
}
/* For last keyframe*/
p_stCurrentKeyFrame= &p_stKeyFrames[ p_stCurrentChannel->uwNumOfFirstKeyFrame ];
fn_v_ExpandQuat ( a4_xQuatOri, p_a4_xQuaternions[ p_stCurrentKeyFrame->uwNumOfQuatOri ] );
fn_v_ExpandQuat ( a4_xQuatSca, p_a4_xQuaternions[ p_stCurrentKeyFrame->uwNumOfQuatSca ] );
p_stOldKeyFrame->uwAngQuatOri= 0x0000;
if ((p_stOldKeyFrame->uwMask & SEB_xMaskQuatOri) == 0x0000)
p_stOldKeyFrame->uwAngQuatOri= fn_uw_AngleBetweenQuat( a4_xOldQuatOri, a4_xQuatOri );
p_stOldKeyFrame->uwAngQuatSca= 0x0000;
if ((p_stOldKeyFrame->uwMask & SEB_xMaskQuatSca) == 0x0000)
p_stOldKeyFrame->uwAngQuatSca= fn_uw_AngleBetweenQuat( a4_xOldQuatSca, a4_xQuatSca );
for ( uwCnt3=uwNumOfOldFrameNumber ; uwCnt3<(p_stCurrentA3dGENERAL->uwEndFrame - p_stCurrentA3dGENERAL->uwStartFrame) ; uwCnt3++ )
p_stFramesKF[ulNumOfFirstFrameKF + uwCnt3].uwNumOfKeyFrame= uwNumOfOldKeyFrame;
p_stCurrentChannel++;
}
/* Normalization of positions*/
for ( uwCnt1=p_stCurrentA3dGENERAL->uwNumOfFirstPosition ; uwCnt1<uwNumOfFirstVector+p_stCurrentA3dGENERAL->uwNumberOfVectors ; uwCnt1++ )
fn_v_NormalizeVector( p_a3_xVectors[ uwCnt1 ] );
/* Calculate (uwAngObjCentre) and (WorldPivotPosition with hierarchy)*/
p_stCurrentChannel= p_stFirstChannel;
for ( uwCnt1=0 ; uwCnt1<p_stCurrentA3dGENERAL->uwNumberOfChannels ; uwCnt1++ )
{
p_stOldKeyFrame= &p_stKeyFrames[ p_stCurrentChannel->uwNumOfFirstKeyFrame ];
p_stCurrentKeyFrame= &p_stOldKeyFrame[1];
uwMax= p_stCurrentChannel->uwNumberOfKeys;
for ( uwCnt2=1 ; uwCnt2<uwMax ; uwCnt2++ )
{ /* uwAngObjCentre*/
p_stOldKeyFrame->uwAngObjCentre=
fn_uw_AngleBetweenVect( p_a3_xVectors[ p_stOldKeyFrame->uwNumOfPosition ],
p_a3_xVectors[ p_stCurrentKeyFrame->uwNumOfPosition ] );
p_stOldKeyFrame++;
p_stCurrentKeyFrame++;
}
/* For last keyframe*/
p_stOldKeyFrame->uwAngObjCentre=
fn_uw_AngleBetweenVect( p_a3_xVectors[ p_stOldKeyFrame->uwNumOfPosition ], p_a3_xVectors[ p_stKeyFrames[p_stCurrentChannel->uwNumOfFirstKeyFrame].uwNumOfPosition ] );
p_stCurrentChannel++;
}
p_vCurrentFile= (void *) p_stFileKeyFrame;
}
/*----------------------------------------------------------------------------
// Description : fn_v_LoadMorphingData
// Load morphing data from the rom
----------------------------------------------------------------------------//
// Methods : None
----------------------------------------------------------------------------//
// Input :
// Output :
----------------------------------------------------------------------------//
// Creation date : Mar 98 Author: Alain Robin
----------------------------------------------------------------------------//
// Modifications :
// Modification date : Modification author :
----------------------------------------------------------------------------*/
void fn_v_LoadMorphingData ( void )
{
register unsigned short uwMax/*, uwCnt1*/;
register unsigned long ulInd;
/* Alignment*/
while ( (((unsigned long) p_vCurrentFile) % 4) != 0 )
p_vCurrentFile= (void *) (((unsigned char *) p_vCurrentFile) + 1);
uwMax= p_stCurrentA3dGENERAL->uwNumberOfMorphData;
ulInd= fn_ul_AllocateOnStack( eStackMorphData, p_stCurrentA3dGENERAL->uwNumberOfMorphData);
p_stCurrentA3dGENERAL->uwNumOfFirstMorphData = (unsigned short)ulInd;
p_stCurrentMorphData= &p_stMorphData[ulInd];
p_stFileMorphData= (tdstFileMorphData *) p_vCurrentFile;
/* for ( uwCnt1=0 ; uwCnt1<uwMax ; uwCnt1++ )
{
p_stCurrentMorphData->ucTarget=p_stFileMorphData->ucTarget;
p_stCurrentMorphData->ucMorphingAmount=p_stFileMorphData->ucMorphingAmount;
p_stCurrentMorphData->uwChannelNumber=p_stFileMorphData->uwChannelNumber;
p_stCurrentMorphData->uwFrameNumber=p_stFileMorphData->uwFrameNumber;
p_stFileMorphData++;
p_stCurrentMorphData++;
} */
memcpy(p_stCurrentMorphData,p_stFileMorphData,sizeof(tdstFileMorphData)*uwMax); /* optim AR9811*/
/* p_vCurrentFile= (void *) p_stFileMorphData;*/
p_vCurrentFile= (void *) (p_stFileMorphData+uwMax);
p_stCurrentMorphData+=uwMax;
}
/*AR9809 Now, this function can be in the common part (same structure used)*/
void fn_v_LoadEvents()
{ register unsigned short uwCnt1, uwMax;
register unsigned long ulInd;
/* Alignment*/
while ( (((unsigned long) p_vCurrentFile) % 4) != 0 )
p_vCurrentFile= (void *) (((unsigned char *) p_vCurrentFile) + 1);
uwMax= p_stCurrentA3dGENERAL->uwNumberOfEvents;
ulInd= fn_ul_AllocateOnStack( eStackEvents, uwMax );
p_stCurrentA3dGENERAL->uwNumOfFirstEvent = (unsigned short)ulInd;
p_stCurrentEvent= &p_stEvents[ulInd];
p_stFileEvent= (tdstFileEvent *) p_vCurrentFile;
M_A3xDebug( "EVNT", tdstFileEvent, p_stFileEvent );
for ( uwCnt1=0 ; uwCnt1<uwMax ; uwCnt1++ )
{
p_stCurrentEvent->uwFrameNumber= p_stFileEvent->uwFrameNumber;
p_stCurrentEvent->usEventNumberInTBL= p_stFileEvent->usEventNumberInTBL;
p_stCurrentEvent->p_stfEventInTBL= NULL;
p_stCurrentEvent->uwChannelNumber= p_stFileEvent->uwChannelNumber;
p_stFileEvent++;
p_stCurrentEvent++;
}
p_vCurrentFile= (void *) p_stFileEvent;
}
/* ***********************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC 04/06/99 */
unsigned short fn_uw_LoadAnimV6 ( void *_p_vStartFile )
{
p_vCurrentFile= _p_vStartFile;
fn_v_LoadA3dGENERAL ();
fn_v_LoadVectors ();
fn_v_LoadQuaternions();
fn_v_LoadHierarchies();
fn_v_LoadNTTO ();
fn_v_LoadOnlyFrames ();
fn_v_LoadChannels ();
fn_v_LoadFrames ();
fn_v_LoadKeyFrames ();
fn_v_LoadEvents ();
/* fn_v_LoadLights ();*/
fn_v_LoadMorphingData(); /*AR980306*/
return (unsigned short)(fn_ul_GetStackAlloc(eStackA3dGENERAL));
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC 04/06/99 */
/* ***********************************************************************************/
void fn_v_LoadCachedAnimV6 ( char *_p_cDestMem,
void *_p_vStartFile,
unsigned long _ulMaxlength )
{
#ifdef ANIM_PROFILE
u64 ulBefore,ulAfter;
if(_ulMaxlength==10240)
ulBefore=osGetTime();
#endif
#ifdef A3X_CacheIsUsed
/* Reset Stacks*/
M_v_ResetOneStack( eStackA3dGENERAL );
M_v_ResetOneStack( eStackVertexes );
M_v_ResetOneStack( eStackQuaternions );
M_v_ResetOneStack( eStackHierarchies );
M_v_ResetOneStack( eStackNTTO );
M_v_ResetOneStack( eStackOnlyFrames );
M_v_ResetOneStack( eStackChannels );
M_v_ResetOneStack( eStackFrames );
M_v_ResetOneStack( eStackFramesKF );
M_v_ResetOneStack( eStackKeyFrames );
M_v_ResetOneStack( eStackEvents );
M_v_ResetOneStack( eStackMorphData );
p_vCurrentFile= _p_vStartFile;
p_stA3dGENERAL= (tdstA3dGENERAL *) _p_cDestMem;
fn_v_LoadA3dGENERAL ();
p_a3_xVectors= (tdxVector3 *) &p_stA3dGENERAL[1];
fn_v_LoadVectors ();
p_a4_xQuaternions= (tdxSShortQuater4 *) p_stCurrentVector3;
fn_v_LoadQuaternions();
p_stHierarchies= (tdstHierarchy *) p_stCurrentQuater4;
fn_v_LoadHierarchies();
p_stNTTO= (tdstNTTO *) p_stCurrentHierarchy;
fn_v_LoadNTTO ();
p_stOnlyFrames= (tdstOnlyFrame *) p_stCurrentNTTO;
fn_v_LoadOnlyFrames ();
p_stChannels= (tdstChannel *) p_stCurrentOnlyFrame;
while ( (((unsigned long) p_stChannels) %4) != 0 )
p_stChannels= (tdstChannel *) (((char *) p_stChannels) + 1);
fn_v_LoadChannels ();
p_stFrames= (tdstFrame *) p_stCurrentChannel;
fn_v_LoadFrames ();
p_stFramesKF= (tdstFrameKF *) p_stCurrentFrame;
/*p_stKeyFrames= (tdstKeyFrame *) &p_stFramesKF[ p_stCurrentA3dGENERAL->uwNumberOfChannels * p_stCurrentA3dGENERAL->uwNumberOfFrames ];*/
p_stKeyFrames= (tdstKeyFrame *) &p_stFramesKF[ p_stCurrentA3dGENERAL->uwNumberOfChannels *
(p_stCurrentA3dGENERAL->uwEndFrame - p_stCurrentA3dGENERAL->uwStartFrame) ];
/* Alignment*/
if ( (((unsigned long) p_stKeyFrames) & 0x0002) != 0x0000 )
p_stKeyFrames= (tdstKeyFrame *) (((char *) p_stKeyFrames) + 2);
fn_v_LoadKeyFrames ();
p_stEvents= (tdstEvent *) p_stCurrentKeyFrame;
fn_v_LoadEvents ();
/* fn_v_LoadLights ();*/
/* due to alignment*/
while ( (((unsigned long) p_stCurrentEvent) %4) != 0 )
p_stCurrentEvent= (tdstEvent *) (((char *) p_stCurrentEvent) + 1);
p_stMorphData= (tdstMorphData *) p_stCurrentEvent; /*AR9803*/
fn_v_LoadMorphingData(); /*AR9803*/
#ifdef ANIM_PROFILE
if(_ulMaxlength==10240)
{
ulAfter=osGetTime();
osSyncPrintf("%llu\n",ulAfter-ulBefore);
}
#endif
/*AR9901 For debug only -> to be removed !!!*/
#ifdef ANIM_DEBUG
if(*((unsigned char*)(g_p_cSecurityMalloc))!=0xA1)
{
ASM_BREAK;
}
#endif /*#ifdef ANIM_DEBUG*/
#ifdef ANIM_DEBUG
/* due to alignment*/
while ( (((unsigned long) p_stCurrentMorphData) %4) != 0 )
p_stCurrentMorphData= (tdstMorphData *) (((char *) p_stCurrentMorphData) + 1);
if ( abs((unsigned long)p_stCurrentMorphData - (unsigned long)p_stCurrentA3dGENERAL) > _ulMaxlength )
{
osSyncPrintf("fn_v_LoadCachedAnimV6 (%d > %d)\n", ((unsigned long)p_stCurrentMorphData - (unsigned long)p_stCurrentA3dGENERAL),_ulMaxlength);
osSyncPrintf(" uwNumberOfFrames = %4d\n", p_stCurrentA3dGENERAL->uwNumberOfFrames);
osSyncPrintf(" uwNumberOfVectors = %4d\n", p_stCurrentA3dGENERAL->uwNumberOfVectors);
osSyncPrintf(" uwNumberOfQuaternions= %4d\n", p_stCurrentA3dGENERAL->uwNumberOfQuaternions);
osSyncPrintf(" uwNumberOfHierarchies= %4d\n", p_stCurrentA3dGENERAL->uwNumberOfHierarchies);
osSyncPrintf(" uwNumberOfNTTO = %4d\n", p_stCurrentA3dGENERAL->uwNumberOfNTTO);
osSyncPrintf(" uwNumberOfOnlyFrames = %4d\n", (p_stCurrentA3dGENERAL->uwEndFrame - p_stCurrentA3dGENERAL->uwStartFrame));
osSyncPrintf(" uwNumberOfChannels = %4d\n", p_stCurrentA3dGENERAL->uwNumberOfChannels);
osSyncPrintf(" uwNumberOfSavedFrames= %4d\n", p_stCurrentA3dGENERAL->uwNumberOfSavedFrames);
osSyncPrintf(" uwNumberOfKeyFrames = %4d\n", p_stCurrentA3dGENERAL->uwNumberOfKeyFrames);
osSyncPrintf(" uwNumberOfEvents = %4d\n", p_stCurrentA3dGENERAL->uwNumberOfEvents);
osSyncPrintf(" uwNumberOfMorphData = %4d\n", p_stCurrentA3dGENERAL->uwNumberOfMorphData);
osSyncPrintf(" uwStartFrame = %4d\n", p_stCurrentA3dGENERAL->uwStartFrame);
osSyncPrintf(" uwEndFrame = %4d\n", p_stCurrentA3dGENERAL->uwEndFrame);
osSyncPrintf(" p_stA3dGENERAL = %d\n", 0);
osSyncPrintf(" p_a3_xVectors = %d\n", (unsigned long)p_a3_xVectors - (unsigned long)p_stA3dGENERAL);
osSyncPrintf(" p_a4_xQuaternions = %d\n", (unsigned long)p_a4_xQuaternions - (unsigned long)p_stA3dGENERAL);
osSyncPrintf(" p_stHierarchies = %d\n", (unsigned long)p_stHierarchies - (unsigned long)p_stA3dGENERAL);
osSyncPrintf(" p_stNTTO = %d\n", (unsigned long)p_stNTTO - (unsigned long)p_stA3dGENERAL);
osSyncPrintf(" p_stOnlyFrames = %d\n", (unsigned long)p_stOnlyFrames - (unsigned long)p_stA3dGENERAL);
osSyncPrintf(" p_stChannels = %d\n", (unsigned long)p_stChannels - (unsigned long)p_stA3dGENERAL);
osSyncPrintf(" p_stFrames = %d\n", (unsigned long)p_stFrames - (unsigned long)p_stA3dGENERAL);
osSyncPrintf(" p_stFramesKF = %d\n", (unsigned long)p_stFramesKF - (unsigned long)p_stA3dGENERAL);
osSyncPrintf(" p_stKeyFrames = %d\n", (unsigned long)p_stKeyFrames - (unsigned long)p_stA3dGENERAL);
osSyncPrintf(" p_stEvents = %d\n", (unsigned long)p_stEvents - (unsigned long)p_stA3dGENERAL);
osSyncPrintf(" p_stMorphData = %d\n", (unsigned long)p_stMorphData - (unsigned long)p_stA3dGENERAL);
ASM_BREAK;
}
#endif /* ANIM_DEBUG */
#endif
}
/* ***********************************************************************************/
#undef A3X_LOAD_C

View File

@@ -0,0 +1,464 @@
/* ***********************************************************************************/
/* * "a3x_mem.c" **/
/* * Written by : S<>bastien Rubens **/
/* * Tabulations : 4 char **/
/* ***********************************************************************************/
#define A3X_MEM_C
/* ***********************************************************************************/
/* Included files*/
#include <stdlib.h>
#include "PlayAnim/Interpol/specif/a3x_pref.h"
/*#define LST2_StaticIsOptimised*/
#include "TOOLSCPA.h"
#include "cpa_std.h"
#include "STRUCTUR/Anim_s.h"
#include "STRUCTUR/ErrGame.h"
#include "PlayAnim/Interpol/a3x_glob.h"
#include "PlayAnim/Interpol/a3x_cach.h"
#include "PlayAnim/Interpol/a3x_int.h"
#include "PlayAnim/Interpol/a3x_mem.h"
#include "zemem.h"
#ifndef U64
#include "SNA\snaglob.h"
#endif
#ifndef RETAIL
#include "STRUCTUR/GameScpt.h"
#endif
/* ***********************************************************************************/
/* Defines*/
/*#ifndef A3X_CacheIsUsed*/
/*#ifndef U64
#define MaxInTabA3dGENERAL 1500
#define MaxInTabVertexes 60000
#define MaxInTabQuaternions 60000
#define MaxInTabHierarchies 5000
#define MaxInTabNTTO 10000
#define MaxInTabOnlyFrames 30000
#define MaxInTabChannels 30000
#define MaxInTabFrames 40000
#define MaxInTabFramesKF 140000
#define MaxInTabKeyFrames 65500
#define MaxInTabEvents 5000
#define MaxInTabMorphData 30000
#define MaxInTabCuttedAnim 3000
#define MaxInTabHandleElement3d 1000
#else*/
#ifdef U64
#define MaxInTabA3dGENERAL 1500
#define MaxInTabVertexes 30000
#define MaxInTabQuaternions 20000
#define MaxInTabHierarchies 5000
#define MaxInTabNTTO 10000
#define MaxInTabOnlyFrames 15000
#define MaxInTabChannels 10000
#define MaxInTabFrames 33000
#define MaxInTabFramesKF 80000
#define MaxInTabKeyFrames 30000
#define MaxInTabEvents 5000
#define MaxInTabMorphData 5000
#define MaxInTabCuttedAnim 3000
#define MaxInTabHandleElement3d 1000
#endif /*U64*/
/*#else
#define MaxInTabA3dGENERAL 1
#define MaxInTabVertexes 1
#define MaxInTabQuaternions 1
#define MaxInTabHierarchies 1
#define MaxInTabNTTO 1
#define MaxInTabOnlyFrames 1
#define MaxInTabChannels 1
#define MaxInTabFrames 1
#define MaxInTabFramesKF 1
#define MaxInTabKeyFrames 1
#define MaxInTabEvents 1
#define MaxInTabMorphData 1
#define MaxInTabCuttedAnim 1
#define MaxInTabHandleElement3d 1
// Output cache
#define uwMaxInTabFrame3d 100
#define uwMaxInTabElement3d 1000
#endif */
/* ***********************************************************************************/
/* Globals datas*/
tdstStackInfos tdstStacks[eStackNbMax]=
{
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 },
{ 0, 0, 0, 0 }
};
#ifdef A3X_StaticTables
tdstA3dGENERAL ax_stA3dGENERAL [MaxInTabA3dGENERAL];
tdxVector3 axa3_xVectors [MaxInTabVertexes];
tdxSShortQuater4 axa4_xQuaternions [MaxInTabQuaternions];
tdstHierarchy ax_stHierarchies [MaxInTabHierarchies];
tdstNTTO ax_stNTTO [MaxInTabNTTO];
tdstOnlyFrame ax_stOnlyFrames [MaxInTabOnlyFrames];
tdstChannel ax_stChannels [MaxInTabChannels];
tdstFrame ax_stFrames [MaxInTabFrames];
tdstFrameKF ax_stFramesKF [MaxInTabFramesKF];
tdstKeyFrame ax_stKeyFrames [MaxInTabKeyFrames];
tdstEvent ax_stEvents [MaxInTabEvents];
tdstMorphData ax_stMorphData [MaxInTabMorphData];
tdstCuttedAnim ax_stCuttedAnim [MaxInTabCuttedAnim];
#endif
tdstA3dGENERAL *p_stA3dGENERAL;
tdxVector3 *p_a3_xVectors;
tdxSShortQuater4 *p_a4_xQuaternions;
tdstHierarchy *p_stHierarchies;
tdstNTTO *p_stNTTO;
tdstOnlyFrame *p_stOnlyFrames;
tdstChannel *p_stChannels;
tdstFrame *p_stFrames;
tdstFrameKF *p_stFramesKF;
tdstKeyFrame *p_stKeyFrames;
tdstEvent *p_stEvents;
tdstMorphData *p_stMorphData; /*AR9803*/
tdstCuttedAnim *p_stCuttedAnim;
/* ***********************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC 07/06/99 */
unsigned long fn_ul_GetStackAlloc( unsigned short _uwNumStack )
{
return (tdstStacks[_uwNumStack].ulPosAlloc);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC 07/06/99 */
/* ***********************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
unsigned long fn_ul_GetStackPos( unsigned short _uwNumStack )
{
return (tdstStacks[_uwNumStack].ulStackPos);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/* ***********************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_v_AllocateOnStack( unsigned short _uwNumStack,
unsigned short _uwWantedSize )
{
#ifndef A3X_CacheIsUsed /*AR9807*/
if ((tdstStacks[_uwNumStack].ulStackPos+_uwWantedSize)>tdstStacks[_uwNumStack].ulMaxPos) {
char szMessage[50];
sprintf(szMessage,"Stack %d exceed maximum elements(%d), change it in Game.dsc",_uwNumStack,tdstStacks[_uwNumStack].ulMaxPos);
Erm_M_UpdateLastError( Game, C_ucErmDefaultChannel, E_uwGameErrorWhileLoadingAnimation,
C_lErmNoDebugData,C_ucErmOpenInfoWindow, C_ucAllowStopForDebug,szMessage);
}
#endif
tdstStacks[_uwNumStack].ulStackPos+= _uwWantedSize;
tdstStacks[_uwNumStack].ulPosAlloc= tdstStacks[_uwNumStack].ulStackPos - _uwWantedSize;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/* ***********************************************************************************/
unsigned long fn_ul_AllocateOnStack( unsigned short _uwNumStack,
unsigned short _uwWantedSize )
{
#ifndef A3X_CacheIsUsed /*AR9807*/
#ifndef U64
if ((tdstStacks[_uwNumStack].ulStackPos+_uwWantedSize)>tdstStacks[_uwNumStack].ulMaxPos) {
char szMessage[50];
sprintf(szMessage,"Stack %d exceed maximum elements(%d), change it in Game.dsc",_uwNumStack,tdstStacks[_uwNumStack].ulMaxPos);
Erm_M_UpdateLastError( Game, C_ucErmDefaultChannel, E_uwGameErrorWhileLoadingAnimation,
C_lErmNoDebugData,C_ucErmOpenInfoWindow, C_ucAllowStopForDebug,szMessage);
}
#else
if((tdstStacks[_uwNumStack].ulStackPos+_uwWantedSize)>=tdstStacks[_uwNumStack].ulMaxPos)
osSyncPrintf("No enough place in stack %d (%d)\n",_uwNumStack,_uwWantedSize);
#endif
#endif
tdstStacks[_uwNumStack].ulStackPos+= _uwWantedSize;
tdstStacks[_uwNumStack].ulPosAlloc= tdstStacks[_uwNumStack].ulStackPos - _uwWantedSize;
return tdstStacks[_uwNumStack].ulPosAlloc;
}
/* ***********************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_v_DeAllocateOnStack( unsigned short _uwNumStack,
unsigned short _uwSize )
{
tdstStacks[_uwNumStack].ulStackPos-= _uwSize;
assert(tdstStacks[_uwNumStack].ulStackPos >= 0);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/* ************************************************** fn_v_UnclearPreviousLoadedAnims*/
/* Allow to keep the N First Anims when clear*/
/* Must be call after loading the N anims*/
/* 03/07/98 Carlos Torres*/
/* ***********************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_v_UnclearPreviousLoadedAnims( void ) {
unsigned short uwCnt;
for ( uwCnt=0 ; uwCnt<eStackNbMax ; uwCnt++ )
tdstStacks[uwCnt].ulResetPos=tdstStacks[uwCnt].ulStackPos;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/* ************************************************************ fn_v_ClearLoadedAnims*/
/* Clear Loaded Anims depending on parameter ucClearAll*/
/* False : Until the position set by fn_v_UnclearPreviousLoadedAnims*/
/* True : ALL anims*/
/* 03/07/98 Carlos Torres*/
/* ***********************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_v_ClearLoadedAnims(unsigned char ucClearAll) {
unsigned short uwCnt;
for ( uwCnt=0 ; uwCnt<eStackNbMax ; uwCnt++ ) {
if (ucClearAll)
tdstStacks[uwCnt].ulResetPos=0;
M_v_ResetOneStack(uwCnt);
}
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/* **************************************************************** fn_v_InitInterpol*/
/* Make allocation and init structure for anim management*/
/* Must be called only once*/
/**/
/* 03/07/98 Carlos Torres*/
/* 17/07/98 : Erase table of Frame and table of Element3d*/
/* ***********************************************************************************/
void fn_v_InitInterpol( void )
{
#ifdef U64
#ifndef FORCE_REAL_TIME_LOAD
fn_vInitROMLoad(); /* To initialise the animation loading system*/
#endif
#endif /*U64*/
#ifndef FORCE_REAL_TIME_LOAD
if(!g_bRealTimeAnimationLoad)
{
#ifdef A3X_StaticTables
p_stA3dGENERAL= ax_stA3dGENERAL;
p_a3_xVectors= axa3_xVectors;
p_a4_xQuaternions= axa4_xQuaternions;
p_stHierarchies= ax_stHierarchies;
p_stNTTO= ax_stNTTO;
p_stOnlyFrames= ax_stOnlyFrames;
p_stChannels= ax_stChannels;
p_stFrames= ax_stFrames;
p_stFramesKF= ax_stFramesKF;
p_stKeyFrames= ax_stKeyFrames;
p_stEvents= ax_stEvents;
p_stMorphData= ax_stMorphData;
p_stCuttedAnim= ax_stCuttedAnim;
#else
#ifndef A3X_N64
if (SNA_fn_ucGetLoadType()!=SNA_LOAD_SNAPSHOT)
#endif
{
unsigned char ucOldACPModeMalloc;
ucOldACPModeMalloc = GEO_M_ucGetMemMallocMode();
GEO_xSelectMemoryChannel(ACP_FixMemoryChannel);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeA3dGENERAL , 0 );
#ifndef U64
/* check if all stack size is set*/
{
unsigned short uwCnt;
for ( uwCnt=0 ; uwCnt<eStackNbMax ; uwCnt++ ) {
if (!tdstStacks[uwCnt].ulMaxPos) {
char szMessage[50];
sprintf(szMessage,"To Load Animation All stacks must be sized, correct Game.dsc for stack %d",uwCnt);
Erm_M_UpdateLastError( Game, C_ucErmDefaultChannel, E_uwGameErrorWhileLoadingAnimation,
C_lErmNoDebugData,C_ucErmOpenInfoWindow, C_ucAllowStopForDebug,szMessage);
}
}
}
GEO_M_CPAMalloc(p_stA3dGENERAL, tdstA3dGENERAL * , tdstStacks[eStackA3dGENERAL].ulMaxPos * sizeof(tdstA3dGENERAL) , E_uwGEONotEnoughtMemory);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeVectors , 0 );
GEO_M_CPAMalloc(p_a3_xVectors, tdxVector3 * , tdstStacks[eStackVertexes].ulMaxPos * sizeof(tdxVector3) , E_uwGEONotEnoughtMemory);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeQuaternions , 0 );
GEO_M_CPAMalloc(p_a4_xQuaternions, tdxSShortQuater4 * , tdstStacks[eStackQuaternions].ulMaxPos * sizeof(tdxSShortQuater4) , E_uwGEONotEnoughtMemory);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeHierarchies , 0 );
GEO_M_CPAMalloc(p_stHierarchies, tdstHierarchy * , tdstStacks[eStackHierarchies].ulMaxPos * sizeof(tdstHierarchy) , E_uwGEONotEnoughtMemory);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeNTTO , 0 );
GEO_M_CPAMalloc(p_stNTTO, tdstNTTO * , tdstStacks[eStackNTTO].ulMaxPos * sizeof(tdstNTTO) , E_uwGEONotEnoughtMemory);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeOnlyFrames , 0 );
GEO_M_CPAMalloc(p_stOnlyFrames, tdstOnlyFrame * , tdstStacks[eStackOnlyFrames].ulMaxPos * sizeof(tdstOnlyFrame) , E_uwGEONotEnoughtMemory);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeChannels , 0 );
GEO_M_CPAMalloc(p_stChannels, tdstChannel * , tdstStacks[eStackChannels].ulMaxPos * sizeof(tdstChannel) , E_uwGEONotEnoughtMemory);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeFrames , 0 );
GEO_M_CPAMalloc(p_stFrames, tdstFrame * , tdstStacks[eStackFrames].ulMaxPos * sizeof(tdstFrame) , E_uwGEONotEnoughtMemory);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeFramesKF , 0 );
GEO_M_CPAMalloc(p_stFramesKF, tdstFrameKF * , tdstStacks[eStackFramesKF].ulMaxPos * sizeof(tdstFrameKF) , E_uwGEONotEnoughtMemory);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeKeyFrames , 0 );
GEO_M_CPAMalloc(p_stKeyFrames, tdstKeyFrame * , tdstStacks[eStackKeyFrames].ulMaxPos * sizeof(tdstKeyFrame) , E_uwGEONotEnoughtMemory);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeEvents , 0 );
GEO_M_CPAMalloc(p_stEvents, tdstEvent * , tdstStacks[eStackEvents].ulMaxPos * sizeof(tdstEvent) , E_uwGEONotEnoughtMemory);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeMorphData , 0 );
GEO_M_CPAMalloc(p_stMorphData, tdstMorphData * , tdstStacks[eStackMorphData].ulMaxPos * sizeof(tdstMorphData) , E_uwGEONotEnoughtMemory);
#else /* U64 */
GEO_M_CPAMalloc(p_stA3dGENERAL, tdstA3dGENERAL * , MaxInTabA3dGENERAL * sizeof(tdstA3dGENERAL) , E_uwGEONotEnoughtMemory);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeVectors , 0 );
GEO_M_CPAMalloc(p_a3_xVectors, tdxVector3 * , MaxInTabVertexes * sizeof(tdxVector3) , E_uwGEONotEnoughtMemory);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeQuaternions , 0 );
GEO_M_CPAMalloc(p_a4_xQuaternions, tdxSShortQuater4 * , MaxInTabQuaternions * sizeof(tdxSShortQuater4) , E_uwGEONotEnoughtMemory);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeHierarchies , 0 );
GEO_M_CPAMalloc(p_stHierarchies, tdstHierarchy * , MaxInTabHierarchies * sizeof(tdstHierarchy) , E_uwGEONotEnoughtMemory);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeNTTO , 0 );
GEO_M_CPAMalloc(p_stNTTO, tdstNTTO * , MaxInTabNTTO * sizeof(tdstNTTO) , E_uwGEONotEnoughtMemory);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeOnlyFrames , 0 );
GEO_M_CPAMalloc(p_stOnlyFrames, tdstOnlyFrame * , MaxInTabOnlyFrames * sizeof(tdstOnlyFrame) , E_uwGEONotEnoughtMemory);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeChannels , 0 );
GEO_M_CPAMalloc(p_stChannels, tdstChannel * , MaxInTabChannels * sizeof(tdstChannel) , E_uwGEONotEnoughtMemory);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeFrames , 0 );
GEO_M_CPAMalloc(p_stFrames, tdstFrame * , MaxInTabFrames * sizeof(tdstFrame) , E_uwGEONotEnoughtMemory);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeFramesKF , 0 );
GEO_M_CPAMalloc(p_stFramesKF, tdstFrameKF * , MaxInTabFramesKF * sizeof(tdstFrameKF) , E_uwGEONotEnoughtMemory);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeKeyFrames , 0 );
GEO_M_CPAMalloc(p_stKeyFrames, tdstKeyFrame * , MaxInTabKeyFrames * sizeof(tdstKeyFrame) , E_uwGEONotEnoughtMemory);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeEvents , 0 );
GEO_M_CPAMalloc(p_stEvents, tdstEvent * , MaxInTabEvents * sizeof(tdstEvent) , E_uwGEONotEnoughtMemory);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeMorphData , 0 );
GEO_M_CPAMalloc(p_stMorphData, tdstMorphData * , MaxInTabMorphData * sizeof(tdstMorphData) , E_uwGEONotEnoughtMemory);
MMG_fn_vAddMemoryInfo( MMG_C_lTypeInterpol , MMG_C_lSubTypeSpeedCuttedAnim, 0 );
GEO_M_CPAMalloc(p_stCuttedAnim, tdstCuttedAnim * , MaxInTabCuttedAnim * sizeof(tdstCuttedAnim) , E_uwGEONotEnoughtMemory);
#endif /* U64 */
GEO_xSelectMemoryChannel(ucOldACPModeMalloc);
}
#endif /*A3X_StaticTables*/
}
#endif
#ifdef U64
#ifndef FORCE_REAL_TIME_LOAD
else
#endif
fn_v_InitCache();
#endif
fn_v_InitSinTab();
}
/* ***************************************************************** fn_vSetStackSize*/
/* Set the stack size */
/* Must be called only once for all stack to configure it*/
/**/
/* 27/10/98 Carlos Torres*/
/* ***********************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vSetStackSize(unsigned short uwNumStack,unsigned long ulSize) {
/* change only if is not previously set*/
if (!tdstStacks[uwNumStack].ulMaxPos)
tdstStacks[uwNumStack].ulMaxPos = ulSize;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#if !defined(RETAIL) && !defined(U64)
/* ***************************************************************** fn_vAnimStackLog*/
/* Make a log of Memory used for each stack in an open file*/
/**/
/* 11/12/98 Carlos Torres*/
/* ***********************************************************************************/
void fn_vAnimStackLog(FILE * fLogFile) {
unsigned short uwCnt;
unsigned long ulMemFix=0,ulMemGlob=0;
struct {
char szName[16];
unsigned long ulSize;
} stStackData[eStackNbMax] = {
C_Entry_A3dGeneral,sizeof(tdstA3dGENERAL),
C_Entry_Vertexes,sizeof(tdxVector3),
C_Entry_Quaternions,sizeof(tdxSShortQuater4),
C_Entry_Hierarchies,sizeof(tdstHierarchy),
C_Entry_NTTO,sizeof(tdstNTTO),
C_Entry_OnlyFrames,sizeof(tdstOnlyFrame),
C_Entry_Channels,sizeof(tdstChannel),
C_Entry_Frames,sizeof(tdstFrame),
C_Entry_FramesKF,sizeof(tdstFrameKF),
C_Entry_KeyFrames,sizeof(tdstKeyFrame),
C_Entry_Events,sizeof(tdstEvent),
C_Entry_MorphData,sizeof(tdstMorphData)
};
if (!fLogFile)
return;
fprintf (fLogFile,"\tStack Name\tFix Nb: FixMem \tLvl Nb: Lvl Mem \tTot Nb( Max. ): Tot Mem \n");
/* log for each stack*/
for (uwCnt=0 ; uwCnt<eStackNbMax ; uwCnt++) {
fprintf (fLogFile,"\t%10s\t%6d:%8do\t%6d:%8do\t%6d(%6d):%8do\n",
stStackData[uwCnt].szName,
tdstStacks[uwCnt].ulResetPos,tdstStacks[uwCnt].ulResetPos*stStackData[uwCnt].ulSize,
tdstStacks[uwCnt].ulStackPos-tdstStacks[uwCnt].ulResetPos,
(tdstStacks[uwCnt].ulStackPos-tdstStacks[uwCnt].ulResetPos)*stStackData[uwCnt].ulSize,
tdstStacks[uwCnt].ulStackPos,
tdstStacks[uwCnt].ulMaxPos,
tdstStacks[uwCnt].ulStackPos*stStackData[uwCnt].ulSize);
ulMemFix += tdstStacks[uwCnt].ulResetPos*stStackData[uwCnt].ulSize;
ulMemGlob += tdstStacks[uwCnt].ulStackPos*stStackData[uwCnt].ulSize;
}
/* Total*/
fprintf(fLogFile,"\t---------------------------------------------------------------------------------\n");
fprintf (fLogFile,"\tTotal \t %8do\t %8do\t %8do\n\n",
ulMemFix,ulMemGlob-ulMemFix,ulMemGlob);
}
#endif /* RETAIL */
/* ***********************************************************************************/
#undef A3X_MEM_C

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,706 @@
/*=========================================================================
* PlayEvrs.cpp : This module contain all functions used to play events
* This is a part of the Game project.
*
* Version 1.0
* Creation date 6/11/96
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1996
*=======================================================================*/
#if defined (WIN32)
#include <stdio.h>
#endif /* WIN32 */
#include "ToolsCPA.h"
/* SOUND 14/02/97*/
#include "SND.h"
/* SOUND fin*/
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/Anim_s.h"
#include "Structur/MemGame.h"
#include "Structur/Objects.h"
#include "Structur/EngMode.h" /* For interpolated animations*/
#include "Structur/State.h"
#include "PlayAnim/PlayEvts.h"
/* JO 01/07/97*/
#include "PlayAnim/PlayAnim.h"
#include "ZeMem.h"
#include "Micros.h"
#include "ia_dnm.h"
#include "objinit.h"
#include "Chanlist.h"
/* For interpolated animations*/
#include "PlayAnim/Interpol/a3x_intn.h"
/*-----------------------------------------------------------------------------
* Description : init animation events for a character
* this should be called when the anim of a character did change
* Aim : init the array of activation (there is one activation value for each event
* of the anim. The event is played when the activation is 0
*-----------------------------------------------------------------------------
* Input : object
* Output : void
*-----------------------------------------------------------------------------
* Creation date : 16/10/96 Author : blef
*---------------------------------------------------------------------------*/
void fn_vInitAllEvents(HIE_tdxHandleToSuperObject p_stSuperObject,unsigned short uwFirstFrame)
{
MS_tdxHandleTo3dData h_3dData;
tdxHandleToState h_State;
tdstAnim3d * p_stAnim;
tdstEvent * p_stEvent;
unsigned char i;
/* get the anim*/
h_3dData = M_GetMSHandle( p_stSuperObject, 3dData );
h_State = fn_h3dDataGetCurrentState(h_3dData);
if ( h_State == NULL ) return; /* not a good object (camera) ...*/
p_stAnim = fn_p_stGetAnimInState(h_State);
/* get the events array*/
p_stEvent= fn_p_GetEventsAddress( p_stAnim, uwFirstFrame,fn_h3dDataGetCurrentObjectsTable(h_3dData) );
/* init all events*/
if ( p_stEvent != NULL ) {
/* allocate array of event activation*/
fn_v3dDataAllocateEventActivation(h_3dData,p_stAnim->ucNumberOfEvents);
/* do not start a the first framE*/
if (uwFirstFrame) {
/* search next Event to play*/
for (i = 0;(i < p_stAnim->ucNumberOfEvents) && (p_stEvent[i].uwFrameNumber < uwFirstFrame);i++);
fn_v3dDataSetNextEvent(h_3dData,i);
}
/* start at first frame*/
else {
if ( fn_scGetSpeedInState(h_State) > 0 )
fn_v3dDataSetNextEvent(h_3dData,0);
else
fn_v3dDataSetNextEvent(h_3dData,(unsigned char)(p_stAnim->ucNumberOfEvents - 1));
}
/* fill rest of array of activation*/
for (i=0; i < p_stAnim->ucNumberOfEvents;i++,p_stEvent++)
fn_v3dDataSetEventActivationByIndex(h_3dData,i,GAM_fn_ucGetFirstCallOfEvent(p_stEvent));
}
}
/*-----------------------------------------------------------------------------
* Description : DesInit animation events for a character
* Should be called when the anim is about to change
* Do not call if the next anim is the same as the current one
* If the next anim normally follows the current one, call with
* bStopEvents set to FALSE.
* If the next anim interrupt the current one, call with bStopEvents
* set to TRUE.
* Never Play are played only when bStopEvents & if are not present
* in the next state
*-----------------------------------------------------------------------------
* Input : object
the future state
* bStopEvents must be set to TRUE if we want 'NeverPlay' stop events
* to be played
* Output : void
*-----------------------------------------------------------------------------
* Creation date : 16/10/96 Author : blef
*-----------------------------------------------------------------------------
* Modif 08/10/98 : add next in parameter and check for never play in the next state - Carlos Torres
*-----------------------------------------------------------------------------
* Modif 25/01/99 : Fix for real time load and short cache - AR
*---------------------------------------------------------------------------*/
void fn_vDesInitAllEvents(HIE_tdxHandleToSuperObject p_stSuperObject,tdxHandleToState hNextState,BOOL bStopEvents)
{
MS_tdxHandleTo3dData h_3dData;
tdxHandleToState h_State;
tdstAnim3d * p_stAnim;
tdstEvent * p_stEvent;
int i,j;
unsigned short uwFrameNumber;
/* MR1006*/
/* fn_vPlayEventsSinceLastOneNoLoop(p_stSuperObject);*/
/* get the anim*/
h_3dData = M_GetMSHandle( p_stSuperObject, 3dData );
h_State = fn_h3dDataGetCurrentState(h_3dData);
if ( h_State == NULL )
return; /* not a good object (camera) ...*/
p_stAnim = fn_p_stGetAnimInState(h_State);
if ((p_stAnim)&&(p_stAnim->ucNumberOfEvents!=0))
{
uwFrameNumber=h_3dData->uwCurrentFrame;
if ( uwFrameNumber >= p_stAnim -> uwNumberOfFrames )
uwFrameNumber = ( unsigned short ) ( p_stAnim -> uwNumberOfFrames - 1 );
/* get the events array*/
p_stEvent= fn_p_GetEventsAddress( p_stAnim,uwFrameNumber,fn_h3dDataGetCurrentObjectsTable(h_3dData) );
/* des-init all events*/
if ( p_stEvent != NULL )
{
if ( bStopEvents )
{
tdstAnim3d * p_stNextAnim = NULL;
tdstEvent * p_stNextEvent = NULL;
tdstEvent * p_stNextEvent2;
/* get next event table*/
if (hNextState)
{
p_stNextAnim = fn_p_stGetAnimInState(hNextState);
if ((p_stNextAnim)&&(p_stNextAnim->ucNumberOfEvents!=0))
{
p_stNextEvent = fn_p_GetEventsAddress(p_stNextAnim,0,fn_h3dDataGetCurrentObjectsTable(h_3dData));
/* Store events into a temporary array*/
if(p_stNextEvent!=NULL)
{
p_stNextEvent2 = (tdstEvent*)TMP_M_p_Malloc(sizeof(tdstEvent) * p_stNextAnim->ucNumberOfEvents);
memcpy(p_stNextEvent2,p_stNextEvent,sizeof(tdstEvent) * p_stNextAnim->ucNumberOfEvents);
p_stNextEvent=p_stNextEvent2;
/* Reinit Event pointer (load it in cache if n<>cessary)*/
p_stEvent = fn_p_GetEventsAddress(p_stAnim,uwFrameNumber,fn_h3dDataGetCurrentObjectsTable(h_3dData));
/* play 'NeverPlay' stop events*/
for (i = 0; i < p_stAnim->ucNumberOfEvents;i++,p_stEvent++)
{
int bNeverPlayFound = FALSE;
if (GAM_fn_ucGetFirstCallOfEvent(p_stEvent) == C_ucNeverPlay )
{
/* search event in next anim */
/* reinit NextEvent*/
p_stNextEvent=p_stNextEvent2;
for (j = 0;j < p_stNextAnim->ucNumberOfEvents;j++,p_stNextEvent++)
{
/* found a never play*/
if (GAM_fn_ucGetFirstCallOfEvent(p_stNextEvent) == C_ucNeverPlay)
{
/* check if is the same never play*/
if (GAM_fn_p_xGetEventOfEvent(p_stEvent) == GAM_fn_p_xGetEventOfEvent(p_stNextEvent))
{
bNeverPlayFound = TRUE;
break;
}
}
/* no more never play*/
else
break;
}
/* this is a 'NeverPlay' stop event, play it*/
if (!bNeverPlayFound)
fn_vPlayEvent(p_stEvent,C_ucStopEvent,p_stSuperObject);
}
/* all stop event are in the beginnig of the array (ucFrameNumber == 0)*/
/* so if we find a non 'NeverPlay' event, we can stop*/
else
break;
}
TMP_M_Free(p_stNextEvent2);
}
else
{
/* no event into the next anim -> play all neverplay events*/
/* Reinit Event pointer (load it in cache if n<>cessary)*/
p_stEvent = fn_p_GetEventsAddress(p_stAnim,0,fn_h3dDataGetCurrentObjectsTable(h_3dData));
/* play 'NeverPlay' stop events*/
for (i = 0; i < p_stAnim->ucNumberOfEvents;i++,p_stEvent++)
{
if (GAM_fn_ucGetFirstCallOfEvent(p_stEvent) == C_ucNeverPlay )
fn_vPlayEvent(p_stEvent,C_ucStopEvent,p_stSuperObject);
}
}
}
else
{
/* no next anim -> play all neverplay events*/
/* Reinit Event pointer (load it in cache if n<>cessary)*/
p_stEvent = fn_p_GetEventsAddress(p_stAnim,0,fn_h3dDataGetCurrentObjectsTable(h_3dData));
/* play 'NeverPlay' stop events*/
for (i = 0; i < p_stAnim->ucNumberOfEvents;i++,p_stEvent++)
{
if (GAM_fn_ucGetFirstCallOfEvent(p_stEvent) == C_ucNeverPlay )
fn_vPlayEvent(p_stEvent,C_ucStopEvent,p_stSuperObject);
}
}
}
}
}
}
fn_v3dDataSetNextEvent(h_3dData,0);
/* free array of event activation*/
fn_v3dDataFreeEventActivation(h_3dData);
}
/*-----------------------------------------------------------------------------
* Description : play animation events for a character since the last played
* call this function if the anim did not restart.
* If the anim is about to loop, call fn_vPlayLastEventsBeforeRestart
* for the current anim, then call this function when new current frame
* has been set.
*-----------------------------------------------------------------------------
* Input : object
* Output : void
*-----------------------------------------------------------------------------
* Creation date : 16/10/96 Author : blef
*---------------------------------------------------------------------------*/
void fn_vPlayEventsSinceLastOneNoLoop( HIE_tdxHandleToSuperObject p_stSuperObject )
{
MS_tdxHandleTo3dData h_3dData;
tdxHandleToState h_State;
tdstAnim3d * p_stAnim;
tdstEvent * p_stEvent;
/* get the anim*/
h_3dData = M_GetMSHandle( p_stSuperObject, 3dData );
h_State = fn_h3dDataGetCurrentState(h_3dData);
if ( h_State == NULL ) return; /* not a good object (camera) ...*/
p_stAnim = fn_p_stGetAnimInState(h_State);
/* get the events array*/
p_stEvent= fn_p_GetEventsAddress( p_stAnim, h_3dData->uwCurrentFrame,fn_h3dDataGetCurrentObjectsTable(h_3dData) );
if ( p_stEvent != NULL )
{
if ( fn_scGetSpeedInState(h_State) > 0 )
{
/* play events from past frames*/
while ( fn_uc3dDataGetNextEvent(h_3dData) !=p_stAnim->ucNumberOfEvents && p_stEvent[ fn_uc3dDataGetNextEvent(h_3dData) ].uwFrameNumber <= fn_uw3dDataGetCurrentFrame(h_3dData))
{
/* is it time to play event ?*/
if ( fn_uc3dDataGetEventActivationByIndex(h_3dData,fn_uc3dDataGetNextEvent(h_3dData)) == 0 )
{
/* play the event*/
fn_vPlayEvent( &p_stEvent[ fn_uc3dDataGetNextEvent(h_3dData) ], C_ucNormal ,p_stSuperObject);
/* update activation*/
fn_v3dDataSetEventActivationByIndex(h_3dData,fn_uc3dDataGetNextEvent(h_3dData),GAM_fn_ucGetPeriodOfEvent(&(p_stEvent[ fn_uc3dDataGetNextEvent(h_3dData) ])));
}
else
{
/* may be next loop : update activation if not NevrPlay*/
if ( fn_uc3dDataGetEventActivationByIndex(h_3dData,fn_uc3dDataGetNextEvent(h_3dData)) != C_ucNeverPlay )
fn_v3dDataAddEventActivationByIndex(h_3dData,fn_uc3dDataGetNextEvent(h_3dData),-1);
}
/* next event*/
fn_v3dDataAddNextEvent(h_3dData,1);
}
}
/* reverse play animation*/
else /* SpeedAnim < 0*/
{
/* play events from past frames*/
while ( fn_uc3dDataGetNextEvent(h_3dData) != 255 && p_stEvent[ fn_uc3dDataGetNextEvent(h_3dData) ].uwFrameNumber >= fn_uw3dDataGetCurrentFrame(h_3dData))
{
/* is it time to play event ?*/
if ( fn_uc3dDataGetEventActivationByIndex(h_3dData,fn_uc3dDataGetNextEvent(h_3dData)) == 0 )
{
fn_vPlayEvent( &p_stEvent[ fn_uc3dDataGetNextEvent(h_3dData) ], C_ucReverse ,p_stSuperObject);
fn_v3dDataSetEventActivationByIndex(h_3dData,fn_uc3dDataGetNextEvent(h_3dData),GAM_fn_ucGetPeriodOfEvent(&(p_stEvent[ fn_uc3dDataGetNextEvent(h_3dData) ])));
}
else
{
/* may be next loop*/
if ( fn_uc3dDataGetEventActivationByIndex(h_3dData,fn_uc3dDataGetNextEvent(h_3dData) ) != C_ucNeverPlay )
fn_v3dDataAddEventActivationByIndex(h_3dData,fn_uc3dDataGetNextEvent(h_3dData),-1);
}
fn_v3dDataAddNextEvent(h_3dData,-1);
/* we do not loop (unsigned values)*/
/* if last event has been treated, next event will be 255 and will stop the while*/
}
}
}
}
/*-----------------------------------------------------------------------------
* Description : play all remaining animation events for a character
* since the last played.
* Call this function if the anim is about to change
* then after changing anim (or restarting anim) and setting the
* current frame, call fn_vPlayEventsSinceLastOneNoLoop
*-----------------------------------------------------------------------------
* Input : object
* Number of complete loops
* Output : void
*-----------------------------------------------------------------------------
* Creation date : 16/10/96 Author : blef
*---------------------------------------------------------------------------*/
void fn_vPlayLastEventsBeforeRestart( HIE_tdxHandleToSuperObject p_stSuperObject )
{
MS_tdxHandleTo3dData h_3dData;
tdxHandleToState h_State;
tdstAnim3d * p_stAnim;
tdstEvent * p_stEvent;
/*XB980504*/
/*unsigned*/ char i;
/*End XB*/
/* get the anim*/
h_3dData = M_GetMSHandle( p_stSuperObject, 3dData );
h_State = fn_h3dDataGetCurrentState(h_3dData);
if ( h_State == NULL ) return; /* not a good object (camera) ...*/
p_stAnim = fn_p_stGetAnimInState(h_State);
/* get the events array*/
p_stEvent= fn_p_GetEventsAddress( p_stAnim, h_3dData->uwCurrentFrame-1,fn_h3dDataGetCurrentObjectsTable(h_3dData) );
/*SEB p_stEvent = p_stAnim->d_stAnimEvent;*/
if ( p_stEvent != NULL )
{
if ( fn_scGetSpeedInState(h_State) > 0 )
{
/* play last frames events*/
for ( i = fn_uc3dDataGetNextEvent(h_3dData); i < p_stAnim->ucNumberOfEvents; i++ )
{
/* is it time to play event ?*/
if ( fn_uc3dDataGetEventActivationByIndex(h_3dData,i) == 0 )
{
fn_vPlayEvent( &p_stEvent[ i ], C_ucNormal ,p_stSuperObject);
fn_v3dDataSetEventActivationByIndex(h_3dData, i, GAM_fn_ucGetPeriodOfEvent(&(p_stEvent[ i ])));
}
else
{
/* may be next loop*/
if ( fn_uc3dDataGetEventActivationByIndex(h_3dData,i) != C_ucNeverPlay )
fn_v3dDataAddEventActivationByIndex(h_3dData, i , -1);
}
}
/* set next event if the animation in case the animation is looping*/
fn_v3dDataSetNextEvent(h_3dData,0);
}
else /* SpeedAnim < 0*/
{
/* play 'first' frames events*/
/* this test is here if the last event has been treated (unsigned values)*/
if ( fn_uc3dDataGetNextEvent(h_3dData) != 255 )
{
for ( i = fn_uc3dDataGetNextEvent(h_3dData); i >= 0; i-- )
{
/* is it time to play event ?*/
if ( fn_uc3dDataGetEventActivationByIndex(h_3dData,i) == 0 )
{
fn_vPlayEvent( &p_stEvent[ i ], C_ucReverse ,p_stSuperObject);
fn_v3dDataSetEventActivationByIndex(h_3dData, i, GAM_fn_ucGetPeriodOfEvent(&(p_stEvent[ i ])));
}
else
{
/* may be next loop*/
if ( fn_uc3dDataGetEventActivationByIndex(h_3dData,i) != C_ucNeverPlay )
fn_v3dDataAddEventActivationByIndex(h_3dData, i , -1);
}
}
}
/* set next event if the animation in case the animation is looping*/
fn_v3dDataSetNextEvent(h_3dData,(unsigned char)(p_stAnim->ucNumberOfEvents - 1));
}
}
}
/*-----------------------------------------------------------------------------
* Description : play one animation event
*-----------------------------------------------------------------------------
* Input : event to be played
* mode ( normal or reverse )
* Output : void
*-----------------------------------------------------------------------------
* Creation date : 16/10/96 Author : blef
*---------------------------------------------------------------------------*/
void fn_vPlayEvent( tdstEvent * p_stEvent, unsigned char ucMode ,HIE_tdxHandleToSuperObject p_stSuperObject)
{
SND_tduRefEvt SoundEvt;
/* switch( p_stEvent->ucTypeOfEvent )
{
case C_ucSOUND_EVENT :
break;
case C_ucACTION_EVENT :
break;
case C_ucGENERATE_EVENT :
break;
default :
break;
}*/
/* test events : uses TRACE*/
#if defined(_DEBUG) && defined(WIN32) && defined(__cplusplus)
char szType[25];
char szMode[25];
#endif /* _DEBUG && WIN32 && __cplusplus */
/*long lTmpTypeOfMechEvt;*/
/* LRM_eKindOfRequest eMechEvent;*/
switch( GAM_fn_ucGetTypeOfEvent(p_stEvent) )
{
case C_ucSOUND_EVENT :
SoundEvt.pstPtr=(SND_tdstBlockEvent*)GAM_fn_p_xGetEventOfEvent(p_stEvent);
SND_fn_lSendRequestSound((long)p_stSuperObject,g_lSoundObjectTypeAnim,SoundEvt,0,NULL);
#if defined(_DEBUG) && defined(WIN32) && defined(__cplusplus)
strcpy( szType, "SoundEvent");
#endif /* _DEBUG && WIN32 && __cplusplus */
break;
/* MR2803: Add a mechanics event to the LRM list*/
/* case C_ucMECHANIC_EVENT :
lTmpTypeOfMechEvt=(long)GAM_fn_p_xGetEventOfEvent(p_stEvent);
eMechEvent = (LRM_eKindOfRequest)lTmpTypeOfMechEvt;
if(M_GetMSHandle(p_stSuperObject,Dynam) != NULL )
LRM_fn_xBoolAddRequest
(fn_pDynamGetListOfRequests(M_GetMSHandle(p_stSuperObject,Dynam)),
eMechEvent ,
fn_h_GetCurrentDNMIdCard(p_stSuperObject));
if(eMechEvent == LRM_eRequest_Jump)
LRM_fn_xBoolDelAllRequestsOfThisType(fn_pDynamGetListOfRequests(M_GetMSHandle(p_stSuperObject,Dynam)),
LRM_eRequest_GoRelative);
fn_v3dDataSetNbEngineFrameSinceLastMechEvent(M_GetMSHandle(p_stSuperObject,3dData),0);
strcpy( szType, "MechanicEvent");
break;*/
case C_ucGENERATE_EVENT :
break;
/* MR1206*/
case C_ucGENERIC_EVENT :
{
long lEvent;
unsigned char ucTypeOfEvent;
/*unsigned short uwChannel;*/
HIE_tdxHandleToSuperObject hSupObjTakenObject;
lEvent=(long)GAM_fn_p_xGetEventOfEvent(p_stEvent);
ucTypeOfEvent=(unsigned char)(lEvent&0xff);
/*uwChannel=(unsigned short)(lEvent>>8);*/
if ( (ucTypeOfEvent >= C_ucEvent_User0) && (ucTypeOfEvent <= C_ucEvent_User7) )
{
MTH3D_tdstVector stPosition;
/*get the channel superobject*/
hSupObjTakenObject = fn_hGetSuperObjectInChannel(fn_h3dDataGetChannelSOList(M_GetMSHandle(p_stSuperObject,3dData)),p_stEvent->uwChannelNumber);
if ( hSupObjTakenObject )
{
unsigned long ulCustomBits = fn_ulStandardGameGetCustomBitsSO(p_stSuperObject);
/* check if position have been update by the player*/
if(!(ulCustomBits & GAM_C_CustBitNeedModuleMatrices))
{
fn_vStandardGameSetCustomBitsSO(p_stSuperObject,ulCustomBits|GAM_C_CustBitNeedModuleMatrices);
PLA_fn_vRefreshGlobalMatrixUnderCharacter(p_stSuperObject);
fn_vStandardGameSetCustomBitsSO(p_stSuperObject,ulCustomBits);
}
POS_fn_vGetTranslationVector(HIE_fn_hGetSuperObjectGlobalMatrix(hSupObjTakenObject), &stPosition);
fn_v3dDataSetUserEventFlag
(
M_GetMSHandle(p_stSuperObject,3dData),
(unsigned char) (ucTypeOfEvent - C_ucEvent_User0),
TRUE,
&stPosition
);
}
}
}
break;
default :
break;
}
#if defined(_DEBUG) && defined(WIN32) && defined(__cplusplus)
switch( ucMode )
{
case C_ucNormal :
strcpy( szMode, "Normal");
break;
case C_ucReverse :
strcpy( szMode, "Reverse");
break;
case C_ucStopEvent :
strcpy( szMode, "Stop");
break;
default :
break;
}
TRACE3( "%s %s %d\n", szType, szMode, (long)p_stEvent->p_xEvent );
#endif /* _DEBUG && WIN32 && __cplusplus */
}
unsigned short fn_uwGetNbEngineFrameSinceLastMechEvent(HIE_tdxHandleToSuperObject p_stSuperObject)
{
return fn_uw3dDataGetNbEngineFrameSinceLastMechEvent(M_GetMSHandle(p_stSuperObject,3dData));
}
/*-----------------------------------------------------------------------------
* Description : Get the type of an event (V5 or V6 format)
*-----------------------------------------------------------------------------
* Input : _p_stEvent : pointer to the event
* Output : the type
*-----------------------------------------------------------------------------
* Creation date : Jan 98 Author : Alain Robin
*---------------------------------------------------------------------------*/
unsigned char GAM_fn_ucGetTypeOfEvent(tdstEvent* _p_stEvent)
{
return _p_stEvent->p_stfEventInTBL->ucTypeOfEvent;
}
/*-----------------------------------------------------------------------------
* Description : Get the pointed event of an event (V5 or V6 format)
*-----------------------------------------------------------------------------
* Input : _p_stEvent : pointer to the event
* Output : the event
*-----------------------------------------------------------------------------
* Creation date : Jan 98 Author : Alain Robin
*---------------------------------------------------------------------------*/
void* GAM_fn_p_xGetEventOfEvent(tdstEvent* _p_stEvent)
{
return _p_stEvent->p_stfEventInTBL->p_xEvent;
}
/*-----------------------------------------------------------------------------
* Description : Get the address pointed event of an event (V5 or V6 format)
*-----------------------------------------------------------------------------
* Input : _p_stEvent : pointer to the event
* Output : the address
*-----------------------------------------------------------------------------
* Creation date : Jan 98 Author : Alain Robin
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void** GAM_fn_p_xGetAdressOfEventOfEvent(tdstEvent* _p_stEvent)
{
return &(_p_stEvent->p_stfEventInTBL->p_xEvent);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*-----------------------------------------------------------------------------
* Description : Set the pointed event of an event (V5 or V6 format)
*-----------------------------------------------------------------------------
* Input : _p_stEvent : pointer to the animation event
* _p_xRealEvent : pointed event
* Output :
*-----------------------------------------------------------------------------
* Creation date : Jan 98 Author : Alain Robin
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void GAM_fn_vSetEventOfEvent(tdstEvent* _p_stEvent,void* _p_xRealEvent)
{
_p_stEvent->p_stfEventInTBL->p_xEvent=_p_xRealEvent;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*-----------------------------------------------------------------------------
* Description : Get the first call field of an event (V5 or V6 format)
*-----------------------------------------------------------------------------
* Input : _p_stEvent : pointer to the event
* Output : the first call
*-----------------------------------------------------------------------------
* Creation date : Jan 98 Author : Alain Robin
*---------------------------------------------------------------------------*/
unsigned char GAM_fn_ucGetFirstCallOfEvent(tdstEvent* _p_stEvent)
{
return _p_stEvent->p_stfEventInTBL->ucFirstCall;
}
/*-----------------------------------------------------------------------------
* Description : Get the first call field of an event (V5 or V6 format)
*-----------------------------------------------------------------------------
* Input : _p_stEvent : pointer to the event
* Output : the first call
*-----------------------------------------------------------------------------
* Creation date : Jan 98 Author : Alain Robin
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void GAM_fn_vSetFirstCallOfEvent(tdstEvent* _p_stEvent,unsigned char _ucFirstCall)
{
_p_stEvent->p_stfEventInTBL->ucFirstCall=_ucFirstCall;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*-----------------------------------------------------------------------------
* Description : Get the period field of an event (V5 or V6 format)
*-----------------------------------------------------------------------------
* Input : _p_stEvent : pointer to the event
* Output : the period
*-----------------------------------------------------------------------------
* Creation date : Jan 98 Author : Alain Robin
*---------------------------------------------------------------------------*/
unsigned char GAM_fn_ucGetPeriodOfEvent(tdstEvent* _p_stEvent)
{
return _p_stEvent->p_stfEventInTBL->ucPeriod;
}
/*-----------------------------------------------------------------------------
* Description : Get the first call field of an event (V5 or V6 format)
*-----------------------------------------------------------------------------
* Input : _p_stEvent : pointer to the event
* Output : the first call
*-----------------------------------------------------------------------------
* Creation date : Jan 98 Author : Alain Robin
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void GAM_fn_vSetPeriodOfEvent(tdstEvent* _p_stEvent,unsigned char _ucPeriod)
{
_p_stEvent->p_stfEventInTBL->ucPeriod=_ucPeriod;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*-----------------------------------------------------------------------------
* Description : Get the binary event id of an event (V5 or V6 format)
*-----------------------------------------------------------------------------
* Input : _p_stEvent : pointer to the event
* Output : the binary event id
*-----------------------------------------------------------------------------
* Creation date : Jan 98 Author : Alain Robin
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
/*
unsigned long GAM_fn_ulGetBinaryEventIdOfEvent(tdstEvent* _p_stEvent)
{
return _p_stEvent->p_stfEventInTBL->ulBinaryEventId;
}
*/
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*-----------------------------------------------------------------------------
* Description : Get the first call field of an event (V5 or V6 format)
*-----------------------------------------------------------------------------
* Input : _p_stEvent : pointer to the event
* Output : the first call
*-----------------------------------------------------------------------------
* Creation date : Jan 98 Author : Alain Robin
*---------------------------------------------------------------------------*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
/*
void GAM_fn_vSetBinaryEventIdOfEvent(tdstEvent* _p_stEvent,unsigned long _ulBinaryEventId)
{
_p_stEvent->p_stfEventInTBL->ulBinaryEventId=_ulBinaryEventId;
}
*/
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */

View File

@@ -0,0 +1,380 @@
/*=========================================================================
* State.c : This module contain all models functions
* This is a part of the Game project.
*
* Version 1.0
* Creation date 04/02/97
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1997
*=======================================================================*/
/*******************************************************/
/**** For the structures and variables declarations ****/
/*******************************************************/
#define D_State_Define
#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/MemGame.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "Structur/3DOSLkTb.h"
#include "PlayAnim/PLA_dbg.h"
#include "Structur/State.h"
#include "ZeMem.h"
#define MAX_STATE_SIZE 64*1024
/*-----------------------------------------------------------------------------
* Description : State's mini-structure sizeof
*-----------------------------------------------------------------------------
* Input : None
* Output : Size of
*-----------------------------------------------------------------------------
* Creation date : 04/02/97 Author : DAVID Sebastien (Gizmo)
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
/* ************* STATE *************/
unsigned long fn_ulStateSizeOf()
{
return(sizeof(struct tdstState_));
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
tdxHandleToState fn_h_StateAlloc()
{
tdxHandleToState h_State;
h_State = (tdxHandleToState)M_p_GameMallocInHLM(fn_ulStateSizeOf());
/* init the State structure*/
h_State->p_stAnim = NULL;
LST2_M_StaticInitAnchor(&h_State->hForTransitionArray);
LST2_M_StaticInitAnchor(&h_State->hForProhibitArray);
h_State->h_NextState = NULL;
h_State->ucRepeatAnimation = 0;
h_State->ucTransitionStatusFlag = C_ucProhibitedState;
h_State->scSpeedAnim = 1;
h_State->h_LinkedMechanicsIdCard = NULL;
h_State->ucCustomBits = 0;
return(h_State);
}
void fn_h_StateFree(tdxHandleToState h_State)
{
M_GameFreeInHLM(h_State);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/* ************ Transitional State ************** */
unsigned long fn_ulTransitionSizeOf()
{
return(sizeof(struct tdstTransition_));
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
tdxHandleToTransition fn_h_TransitionAlloc()
{
tdxHandleToTransition h_Transition;
h_Transition = (tdxHandleToTransition)M_p_GameMallocInHLM(fn_ulTransitionSizeOf());
return(h_Transition);
}
void fn_h_TransitionFree(tdxHandleToTransition h_Transition)
{
M_GameFreeInHLM(h_Transition);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/* ************ Prohibited State ************** */
unsigned long fn_ulProhibitSizeOf()
{
return(sizeof(struct tdstProhibit_));
}
tdxHandleToProhibit fn_h_ProhibitAlloc()
{
tdxHandleToProhibit h_Prohibit;
h_Prohibit = (tdxHandleToProhibit)M_p_GameMallocInHLM(fn_ulProhibitSizeOf());
return(h_Prohibit);
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_h_ProhibitFree(tdxHandleToProhibit h_Prohibit)
{
M_GameFreeInHLM(h_Prohibit);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*-----------------------------------------------------------------------------
* Description : State access functions
*-----------------------------------------------------------------------------
* Input : tdxHandleToState + (value)
* Output : (value or pointer)
*-----------------------------------------------------------------------------
* Creation date : 07/02/97 Author : DAVID Sebastien (Gizmo)
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
/********** Debug name ********************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
char* fn_p_szGetStateName(tdxHandleToState h_State)
{
#ifdef _DEBUG_STRING_FOR_PLA_
return (h_State->szStateName);
#else
return NULL;
#endif
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/********** Anim ********************/
struct tdstAnim3d_* fn_p_stGetAnimInState(tdxHandleToState h_State)
{
return(h_State->p_stAnim);
}
void fn_vSetAnimInState(tdxHandleToState h_State,struct tdstAnim3d_ *p_stAnim)
{
h_State->p_stAnim = p_stAnim;
}
/*************** NextState *******************/
tdxHandleToState fn_hGetNextStateInState(tdxHandleToState h_State)
{
return(h_State->h_NextState);
}
void fn_vSetNextStateInState(tdxHandleToState h_State,tdxHandleToState h_NextState)
{
h_State->h_NextState = h_NextState;
}
/*********** RepeatAnimation *******************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
unsigned char fn_ucGetRepeatAnimationInState(tdxHandleToState h_State)
{
return(h_State->ucRepeatAnimation);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
void fn_vSetRepeatAnimationInState(tdxHandleToState h_State,unsigned char ucRepeatAnimation)
{
h_State->ucRepeatAnimation = ucRepeatAnimation;
}
/*********** TransitionStatusFlag *******************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
unsigned char fn_ucGetTransitionStatusFlagInState(tdxHandleToState h_State)
{
return(h_State->ucTransitionStatusFlag);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
void fn_vSetTransitionStatusFlagInState(tdxHandleToState h_State,unsigned char ucTransitionStatusFlag)
{
h_State->ucTransitionStatusFlag = ucTransitionStatusFlag;
}
/*********** SpeedAnim *******************/
signed char fn_scGetSpeedInState(tdxHandleToState h_State)
{
return(h_State->scSpeedAnim);
}
void fn_vSetSpeedInState(tdxHandleToState h_State,signed char scSpeedAnim)
{
h_State->scSpeedAnim = scSpeedAnim;
}
/* ************* MechanicsIdCard *************/
DNM_tdxHandleToMecIdentityCard fn_hGetStateMechanicsIdCard(tdxHandleToState h_State)
{
return(h_State->h_LinkedMechanicsIdCard);
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vSetStateMechanicsIdCard(tdxHandleToState h_State,DNM_tdxHandleToMecIdentityCard h_LinkedMechanicsIdCard)
{
h_State->h_LinkedMechanicsIdCard = h_LinkedMechanicsIdCard;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/* ANNECY MT - 24/11/98 {*/
/* ******* CustomBits *******/
unsigned char fn_ucGetStateCustomBits(tdxHandleToState h_State)
{
return(h_State->ucCustomBits);
}
void fn_vSetStateCustomBits(tdxHandleToState h_State,unsigned char ucCustomBits)
{
h_State->ucCustomBits = ucCustomBits;
}
/* END ANNECY MT }*/
/*-----------------------------------------------------------------------------
* Description : Transition access functions
*-----------------------------------------------------------------------------
* Input : tdxHandleToTransition + (value)
* Output : (value or pointer)
*-----------------------------------------------------------------------------
* Creation date : 07/02/97 Author : DAVID Sebastien (Gizmo)
*-----------------------------------------------------------------------------
* Modification date : Modification Author :
* Modifications :
*---------------------------------------------------------------------------*/
/*************** TargetState *******************/
tdxHandleToState fn_hGetTargetStateInTransition(tdxHandleToTransition h_Transition)
{
return(h_Transition->h_TargetState);
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vSetTargetStateInTransition(tdxHandleToTransition h_Transition,tdxHandleToState h_TargetState)
{
h_Transition->h_TargetState = h_TargetState;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*************** StateToGo *******************/
tdxHandleToState fn_hGetStateToGoInTransition(tdxHandleToTransition h_Transition)
{
return(h_Transition->h_StateToGo);
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vSetStateToGoInTransition(tdxHandleToTransition h_Transition,tdxHandleToState h_StateToGo)
{
h_Transition->h_StateToGo = h_StateToGo;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*ANNECY CT 11/02/98{*/
/*************** LinkingType *******************/
unsigned char fn_ucGetLinkingTypeInTransition(tdxHandleToTransition h_Transition)
{
return(h_Transition->ucLinkingType);
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vSetLinkingTypeInTransition(tdxHandleToTransition h_Transition,unsigned char ucLinkingType)
{
h_Transition->ucLinkingType = ucLinkingType;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*ENDANNECY CT}*/
/*************** TEST StateToGo *******************/
/*ANNECY CT 11/02/98{*/
/*tdxHandleToState fn_hIfExistTransitionalWithTargetState(tdxHandleToState h_State, tdxHandleToState h_TargetState)*/
tdxHandleToTransition fn_hIfExistTransitionalWithTargetState(tdxHandleToState h_State, tdxHandleToState h_TargetState)
/*ENDANNECY CT}*/
/* AR9808 Function changed to be compatible with optimized static lists*/
{
int i;
struct tdstTransition_ *p_stTransition;
LST2_M_StaticForEachElementOf(&h_State->hForTransitionArray, p_stTransition, i)
{
if (fn_hGetTargetStateInTransition(p_stTransition) == h_TargetState)
{
return p_stTransition;
}
}
return NULL;
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
tdxHandleToState fn_hGetProhibitedStateInProhibit( tdxHandleToProhibit _hProhibit )
{
return ( _hProhibit ? _hProhibit -> h_ProhibitedState : NULL );
}
void fn_vSetProhibitedStateInProhibit( tdxHandleToProhibit _hProhibit, tdxHandleToState _hState )
{
_hProhibit -> h_ProhibitedState = _hState;
}
/*************** GET for EDITOR *******************/
/* AR9808 : Modif for optimized lists compatibility*/
tdxHandleToTransition fn_hGetTransitionalWithTargetState( tdxHandleToState _hState, tdxHandleToState _hTargetState )
{
tdxHandleToTransition hTransition;
int i,max;
hTransition = LST2_M_StaticGetFirstElement( & _hState -> hForTransitionArray );
max=LST2_M_StaticGetNumberOfElements(& _hState -> hForTransitionArray);
i=0;
while( hTransition && (i<max)) /* For optimized lists*/
{
if( fn_hGetTargetStateInTransition( hTransition ) == _hTargetState)
{
return( hTransition );
}
hTransition = LST2_M_StaticGetNextElement( hTransition );
++i;
}
return(NULL);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*************** TEST ProhibitedState *******************/
/* AR9808 : Modif for optimized lists compatibility*/
long fn_hIfExistProhibitedState(tdxHandleToState h_State, tdxHandleToState h_TargetState)
{
struct tdstProhibit_ *p_stProhibit;
int i,max;
p_stProhibit = (struct tdstProhibit_ *) LST2_M_StaticGetFirstElement(&h_State->hForProhibitArray);
max=LST2_M_StaticGetNumberOfElements(&h_State->hForProhibitArray);
i=0;
while((p_stProhibit != NULL)&&(i<max)) /* For optimized lists*/
{
if(p_stProhibit->h_ProhibitedState == h_TargetState)
{
return(1);
}
p_stProhibit = (struct tdstProhibit_ *) LST2_M_StaticGetNextElement(p_stProhibit);
++i;
}
return(0);
}
/*-------------------------------------------------------------------
* End Of file
*-----------------------------------------------------------------*/

View File

@@ -0,0 +1,86 @@
/*=========================================================================
* DspFix.c : Display fix module
* This is a part of the Game project.
*
* Version 1.0
* Creation date 04/05/97
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1997
*=======================================================================*/
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/EngMode.h"
#include "Structur/Objects.h"
#include "Structur/ErrGame.h"
#include "MainChar.h"
#include "ChanList.h"
#include "PlayAnim\PlayAnim.h"
#include "DspFix.h"
#include "PRF.h"
/*#include "ago.h"*/
void AGO_vDisplayGAUGES(GLD_tdstViewportAttributes *p_stVpt);
/*extern ACP_tdxBool g_bUseBinaryData;*/
/**************************************************************************/
void fn_vDisplayFix(void)
{
BOOL bEnabledWrite;
#if defined(GAM_VIGNETTE)
if (g_stDisplayVignetteDuringPlaying.bAskToDisplayVignette) {
VIG_fn_vCopyVignetteToBackBuffer(&g_stDisplayVignetteDuringPlaying.stVignette);
}
#endif /* GAM_VIGNETTE */
GLI_ClearZBufferRegion(g_stEngineStructure.stFixViewportAttr.dwLeftInPixForClip,g_stEngineStructure.stFixViewportAttr.dwRightInPixForClip,g_stEngineStructure.stFixViewportAttr.dwTopInPixForClip,g_stEngineStructure.stFixViewportAttr.dwBottomInPixForClip);
GLI_xClearViewingList();
if (!GLD_bRequestWriteToViewport(g_stEngineStructure.hGLDDevice,g_stEngineStructure.hGLDFixViewport, &g_stEngineStructure.stFixViewportAttr, &bEnabledWrite))
M_GameFatalError(E_uwGameCantWriteToViewPort);
PRF_fn_vStopChrono( PRF_C_ulFctDisplaySpecific, PRF_C_pvSendToList );
PRF_fn_vStartChrono( PRF_C_ulFctDisplay, PRF_C_pvMisc );
PRF_fn_vStartChrono( PRF_C_ulFctDisplayCommon, PRF_C_pvSendFix );
GEO_fn_vComputeCameraParametersForCulling( &g_stEngineStructure.stFixViewportAttr, MTH_C_ZERO );
PRF_fn_vStopChrono( PRF_C_ulFctDisplayCommon, PRF_C_pvSendFix );
FPRF_fn_vStopChrono( PRF_C_ulFctDisplay, PRF_C_pvMisc );
PRF_fn_vStartChrono( PRF_C_ulFctDisplaySpecific, PRF_C_pvSendToList );
HIE_fn_bSendSPOToFixViewport ( &g_stEngineStructure.stFixViewportAttr, g_stEngineStructure.ulDisplayMode );
AGO_vDisplayGAUGES( &g_stEngineStructure.stFixViewportAttr );
GLI_xSendListToViewport(&g_stEngineStructure.stFixViewportAttr);
if (!GLD_bWriteToViewportFinished(g_stEngineStructure.hGLDDevice, g_stEngineStructure.hGLDFixViewport))
M_GameFatalError(E_uwGameCantWriteToViewPortFinished);
}
/*************************************************************************/
void fn_vAskToDisplayVignette(char *szName)
{
#if defined(GAM_VIGNETTE)
if (szName) {
g_stDisplayVignetteDuringPlaying.bAskToDisplayVignette = TRUE;
VIG_fn_vPreLoadVignetteInStructure(&g_stDisplayVignetteDuringPlaying.stVignette,szName,GLI_EVF_BGR565_UL);
}
else {
g_stDisplayVignetteDuringPlaying.bAskToDisplayVignette = FALSE;
VIG_fn_vFreeVignette(&g_stDisplayVignetteDuringPlaying.stVignette);
}
#else /* GAM_VIGNETTE */
g_stDisplayVignetteDuringPlaying.bAskToDisplayVignette = FALSE;
#endif /* GAM_VIGNETTE */
}

View File

@@ -0,0 +1,40 @@
/*=========================================================================
* DspFix.c : Display fix module
* This is a part of the Game project.
*
* Version 1.0
* Creation date 04/05/97
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1997
*=======================================================================*/
#if !defined(__DspFix_h__)
#define __DspFix_h__
/******************************************/
#if _MSC_VER >= 1000
#pragma once
#endif /* _MSC_VER >= 1000 */
/******************************************/
typedef struct tdstDisplayVignetteDuringPlaying_
{
unsigned char bAskToDisplayVignette;
char szName[_MAX_PATH];
#ifdef GAM_VIGNETTE
struct VIG_tdstVignetteStructure_ stVignette;
#endif /* GAM_VIGNETTE */
} tdstDisplayVignetteDuringPlaying;
extern void fn_vAskToDisplayVignette(char *szName);
extern void fn_vDisplayFix(void);
EXTERN tdstDisplayVignetteDuringPlaying g_stDisplayVignetteDuringPlaying;
#if defined(__cplusplus)
}
#endif /* __cplusplus */
#endif /* __DspFix_h__ */

View File

@@ -0,0 +1,702 @@
/*=========================================================================
* GamOpt.c : Game options
* This is a part of the Game project.
*
* Version 1.0
* Creation date 04/05/97
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1997
*=======================================================================*/
#define SCR_DM_OptCFiles
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Structur/MemGame.h"
#include "Structur/EngMode.h"
#include "Structur/ErrGame.h"
#include "Structur/GameScpt.h"
#include "Basic.h"
#include "GamOpt.h"
#include "GamSave.h"
#include "micros.h"
#include "Zemem.h"
#include "CMP.h"
/*ANNECY BBB 03/11/97 {*/
tdstGameOptions g_stGameOptions;
/*ENDANNECY BBB 03/11/97 }*/
#ifdef __cplusplus
extern "C" {
#endif
extern signed char g_cJoystickXmin;
extern signed char g_cJoystickXmax;
extern signed char g_cJoystickYmin;
extern signed char g_cJoystickYmax;
#ifndef U64
extern signed char g_cJoystickXcenter;
extern signed char g_cJoystickYcenter;
#endif
#ifdef __cplusplus
}
#endif
/**************** F PEREZ *******************/
extern long g_ucNbSaveGameSlots;
extern char g_a_szSlotNames[4];
extern BOOL fn_bActualizeSlotPos(void);
extern char * fn_bGetStringSlotDate(unsigned long _ulSlotId);
long fn_lGetNbAvailableSlotPc();
long fn_bRecupSlotNum(long lSlotPosId);
BOOL fn_bActualizeSlotListBis(long lNbAvailableSlots);
BOOL fn_bEraseGameInSlotList( long lSlotId);
char * fn_cRecupSlotName(long lSlotId);
long fn_bScanDir( char *p_cDir, BOOL bRecursive);
int fn_iVersionN64_PC(void);
extern StructRecupPosSlot * g_p_LastStructRecupPosSlot;
/****************************************************/
/**************************************************************************/
void fn_vSetDefaultGameOptionsFileName(char *_szFileName)
{
strcpy(g_stGameOptions.szDefaultFileName,_szFileName);
}
/**************************************************************************/
void fn_vSetCurrentGameOptionsFileName(char *_szFileName)
{
strcpy(g_stGameOptions.szCurrentFileName,_szFileName);
}
/**************************************************************************/
unsigned char fn_bSaveCurrentGameOptions(void)
{
unsigned char bReturn = TRUE;
FILE *p_stTempFile;
char szFileName[MAX_PATH];
char szTempFile[_MAX_PATH];
int Version;
#ifndef U64
/*************** FPEREZ ***************/
long lNbSaveGameSlot;
StructRecupPosSlot *p_StructRecupPosSlot;
/*********************************************/
#endif
/*unsigned long lValue;*/
sprintf(szTempFile,"%s/TT.tmp",fn_szGetTempDataPath());
sprintf(szFileName,"%s/%s",fn_szGetOptionsDataPath(),g_stGameOptions.szCurrentFileName);
FIL_fn_bValidatePath(".",szFileName);
remove(szTempFile);
p_stTempFile = fopen(szTempFile,"wb");
if (p_stTempFile!=NULL)
{
long lIndex;
char * szTag = __DATE__ " " __TIME__ ;
/* version that saved the file */
lIndex = strlen ( szTag ) ;
fwrite(&lIndex,1,sizeof(unsigned long),p_stTempFile);
fwrite(szTag,1,lIndex+1,p_stTempFile);
/**** Player name ****/
/*lValue = strlen(g_stGameOptions.szPlayerName);*/
/*fwrite(&lValue,1,sizeof(unsigned long),p_stTempFile);*/
/*fwrite(g_stGameOptions.szPlayerName,lValue,sizeof(char),p_stTempFile);*/
/**** Slot names ****/
/***************** FPEREZ **************************/
#ifndef U64
#ifdef ACTIVE_EDITOR
Version = fn_iVersionN64_PC();
if( Version == 1 /* N64 */)
{
for ( lIndex = 0; lIndex < C_ucNbSaveGameSlots; lIndex ++ )
{
fwrite(&g_stGameOptions.a_szSlotNames[lIndex], 1, C_ucSaveGameSlotNameLength + 1, p_stTempFile);
}
}
else if( Version == 2 /* PC */)
{
//lNbSaveGameSlot = fn_lGetNbAvailableSlotsPc();
lNbSaveGameSlot = g_ucNbSaveGameSlots;
p_StructRecupPosSlot = g_p_LastStructRecupPosSlot;
for ( lIndex = 0; lIndex < lNbSaveGameSlot; lIndex ++ )
{
fwrite( p_StructRecupPosSlot->a_szSlotNames , 1, C_ucSaveGameSlotNameLength + 1, p_stTempFile);
p_StructRecupPosSlot = p_StructRecupPosSlot->pt_NextStructRecupPosSlot;
}
}
#else // PC sans editeur
//lNbSaveGameSlot = fn_lGetNbAvailableSlotsPc();
lNbSaveGameSlot = g_ucNbSaveGameSlots;
p_StructRecupPosSlot = g_p_LastStructRecupPosSlot;
for ( lIndex = 0; lIndex < lNbSaveGameSlot; lIndex ++ )
{
fwrite( p_StructRecupPosSlot->a_szSlotNames , 1, C_ucSaveGameSlotNameLength + 1, p_stTempFile);
p_StructRecupPosSlot = p_StructRecupPosSlot->pt_NextStructRecupPosSlot;
}
#endif // EDITOR
#else /* U64*/
for ( lIndex = 0; lIndex < C_ucNbSaveGameSlots; lIndex ++ )
{
fwrite(&g_stGameOptions.a_szSlotNames[lIndex], 1, C_ucSaveGameSlotNameLength + 1, p_stTempFile);
}
#endif // U64
/**** Video options ****/
fwrite(&g_stGameOptions.ulDetails,1,sizeof(unsigned long),p_stTempFile);
fwrite(&g_stGameOptions.ulScreenSize,1,sizeof(unsigned long),p_stTempFile);
lIndex = GLI_fn_lGetBrightness() ;
fwrite(&lIndex,1,sizeof(unsigned long),p_stTempFile);
/**** Sound options ****/
fwrite(&g_stGameOptions.ulFxVolume,1,sizeof(unsigned long),p_stTempFile);
fwrite(&g_stGameOptions.ulMusicVolume,1,sizeof(unsigned long),p_stTempFile);
fwrite(&g_stGameOptions.ulVoiceVolume,1,sizeof(unsigned long),p_stTempFile);
#ifdef USE_IPT_DX5
/* Save joystick calibration */
fwrite( &g_cJoystickXmin, sizeof(signed char), 1, p_stTempFile );
fwrite( &g_cJoystickXmax, sizeof(signed char), 1, p_stTempFile );
fwrite( &g_cJoystickYmin, sizeof(signed char), 1, p_stTempFile );
fwrite( &g_cJoystickYmax, sizeof(signed char), 1, p_stTempFile );
#ifndef U64
fwrite( &g_cJoystickXcenter, sizeof(signed char), 1, p_stTempFile );
fwrite( &g_cJoystickYcenter, sizeof(signed char), 1, p_stTempFile );
#endif
#endif
/**** IPT options ****/
IPT_fn_bSaveOptionsInFile(p_stTempFile);
fclose(p_stTempFile);
CMP_fn_vCompressFileIn(szTempFile,szFileName,D_CMP_DIFF);
}
else
bReturn = FALSE;
remove(szTempFile);
return(bReturn);
}
/**************************************************************************/
/* Modif : 25/05/98 Default volume 127 Carlos Torres*/
unsigned char fn_bLoadCurrentGameOptions(void)
{
ACP_tdxBool bReturn = TRUE;
if (!fn_bLoadGameOptions(g_stGameOptions.szCurrentFileName))
{
if (!fn_bLoadDefaultGameOptions())
{
/*fn_vChangePlayerName("NOBODY");*/
bReturn = FALSE;
}
}
/*///////////////////////////////////// en attendant les menus*/
/* default values if no config files:*/
if( !bReturn )
{
long lIndex;
g_stGameOptions.ulFxVolume = 127;
g_stGameOptions.ulVoiceVolume = 127;
g_stGameOptions.ulMusicVolume = 127;
g_stGameOptions.ulDetails = 0;
g_stGameOptions.ulScreenSize = 0;
for ( lIndex = 0; lIndex < C_ucNbSaveGameSlots; lIndex ++ )
{
/* zero-terminated whitespace slot names -> invalid names*/
memset(&g_stGameOptions.a_szSlotNames[lIndex], ' ', C_ucSaveGameSlotNameLength);
g_stGameOptions.a_szSlotNames[lIndex][C_ucSaveGameSlotNameLength] = '\0';
}
}
/*///////////////////////////////////// en attendant les menus*/
return bReturn;
}
/**************************************************************************/
unsigned char fn_bLoadDefaultGameOptions(void)
{
return(fn_bLoadGameOptions(g_stGameOptions.szDefaultFileName));
}
/**************************************************************************/
unsigned char fn_bLoadGameOptions(char *_szFileName)
{
unsigned char bReturn = FALSE;
char szFileName[MAX_PATH];
/*char szTemp[100];*/
FILE *p_stTempFile;
char szTempFile[_MAX_PATH];
int Version;
#ifndef U64
/*************** FPEREZ ***************/
unsigned char a128_cCurrentSlotDir[128];
unsigned char a128_cNextSlotDir[128];
long lNbSaveGameSlot;
StructRecupPosSlot *p_StructRecupPosSlot;
/*********************************************/
#endif
sprintf(szTempFile,"%s/TT.tmp",fn_szGetTempDataPath());
sprintf(szFileName,"%s/%s",fn_szGetOptionsDataPath(),_szFileName);
remove(szTempFile);
if (CMP_fn_bExpandFileIn(szFileName,szTempFile,D_CMP_DIFF))
{
p_stTempFile = fopen(szTempFile,"rb");
if (p_stTempFile!=NULL)
{
long lIndex;
char * szTag = __DATE__ " " __TIME__ , * szTag2 ;
/* version that saved the file */
fread(&lIndex,1,sizeof(unsigned long),p_stTempFile);
szTag2 = alloca(lIndex+1) ;
fread(szTag2,1,lIndex+1,p_stTempFile);
if ( !strcmp(szTag, szTag2) )
{
/**** Player name ****/
/*fread(&lValue,1,sizeof(unsigned long),p_stTempFile);*/
/*fread(szTemp,lValue,sizeof(char),p_stTempFile);*/
/*szTemp[lValue]=0;*/
/*fn_vChangePlayerName(szTemp);*/
/**** Slot names ****/
/***************** FPEREZ **************************/
#ifndef U64
#ifdef ACTIVE_EDITOR
Version = fn_iVersionN64_PC();
if( Version == 1 /* N64 */)
{
for ( lIndex = 0; lIndex < C_ucNbSaveGameSlots; lIndex ++ )
{
fread(&g_stGameOptions.a_szSlotNames[lIndex], 1, C_ucSaveGameSlotNameLength + 1, p_stTempFile);
g_stGameOptions.a_szSlotNames[lIndex][C_ucSaveGameSlotNameLength] = '\0'; /* pour assurer*/
}
}
else if( Version == 2 /* PC */)
{
//lNbSaveGameSlot = fn_lGetNbAvailableSlotsPc();
lNbSaveGameSlot = g_ucNbSaveGameSlots;
p_StructRecupPosSlot = g_p_LastStructRecupPosSlot;
for ( lIndex = 0; lIndex < lNbSaveGameSlot; lIndex ++ )
{
fread( p_StructRecupPosSlot->a_szSlotNames , 1, C_ucSaveGameSlotNameLength + 1, p_stTempFile);
p_StructRecupPosSlot = p_StructRecupPosSlot->pt_NextStructRecupPosSlot;
}
}
#else /* PC sans Editor */
//lNbSaveGameSlot = fn_lGetNbAvailableSlotsPc();
lNbSaveGameSlot = g_ucNbSaveGameSlots;
p_StructRecupPosSlot = g_p_LastStructRecupPosSlot;
for ( lIndex = 0; lIndex < lNbSaveGameSlot; lIndex ++ )
{
fread( p_StructRecupPosSlot->a_szSlotNames , 1, C_ucSaveGameSlotNameLength + 1, p_stTempFile);
p_StructRecupPosSlot = p_StructRecupPosSlot->pt_NextStructRecupPosSlot;
}
#endif // Editor
#else /* U64*/
for ( lIndex = 0; lIndex < C_ucNbSaveGameSlots; lIndex ++ )
{
fread(&g_stGameOptions.a_szSlotNames[lIndex], 1, C_ucSaveGameSlotNameLength + 1, p_stTempFile);
g_stGameOptions.a_szSlotNames[lIndex][C_ucSaveGameSlotNameLength] = '\0'; /* pour assurer*/
}
#endif //
g_stGameOptions.ulCurrentSlot = 0;
/**** Video options ****/
fread(&g_stGameOptions.ulDetails,1,sizeof(unsigned long),p_stTempFile);
fread(&g_stGameOptions.ulScreenSize,1,sizeof(unsigned long),p_stTempFile);
fread(&lIndex,1,sizeof(unsigned long),p_stTempFile);
GLI_fn_vSetBrightness( lIndex ) ;
/**** Sound options ****/
fread(&g_stGameOptions.ulFxVolume,1,sizeof(unsigned long),p_stTempFile);
fread(&g_stGameOptions.ulMusicVolume,1,sizeof(unsigned long),p_stTempFile);
fread(&g_stGameOptions.ulVoiceVolume,1,sizeof(unsigned long),p_stTempFile);
#ifdef USE_IPT_DX5
/* Read joystick calibration */
fread( &g_cJoystickXmin, sizeof(signed char), 1, p_stTempFile );
fread( &g_cJoystickXmax, sizeof(signed char), 1, p_stTempFile );
fread( &g_cJoystickYmin, sizeof(signed char), 1, p_stTempFile );
fread( &g_cJoystickYmax, sizeof(signed char), 1, p_stTempFile );
#ifndef U64
fread( &g_cJoystickXcenter, sizeof(signed char), 1, p_stTempFile );
fread( &g_cJoystickYcenter, sizeof(signed char), 1, p_stTempFile );
#endif
#endif
/**** IPT options ****/
IPT_fn_bLoadOptionsFromFile(p_stTempFile);
fclose(p_stTempFile);
fn_vValidateAllOption();
bReturn = TRUE;
}
}
}
remove(szTempFile);
return(bReturn);
}
#ifndef U64
//********************** FABPEREZ ************************
long fn_bRecupSlotNum(long lSlotPosId)
{
long lSlotPos = 1;
StructRecupPosSlot *p_CurrentStructRecupPosSlot;
p_CurrentStructRecupPosSlot = g_p_LastStructRecupPosSlot;
while( lSlotPos != lSlotPosId && p_CurrentStructRecupPosSlot->pt_NextStructRecupPosSlot != NULL)
{
p_CurrentStructRecupPosSlot = p_CurrentStructRecupPosSlot->pt_NextStructRecupPosSlot;
lSlotPos ++;
}
return p_CurrentStructRecupPosSlot->pos;
}
long fn_bScanDir( char *p_cDir, BOOL bRecursive)
{
struct _finddata_t stFileInfo;
int iHandle;
int i = 0;
long lNbSlotDir = 0;
if ( _chdir(p_cDir) )
return 0 ;
// start scan on directories
iHandle = _findfirst("*.*",&stFileInfo);
if (iHandle == -1)
{
/*if (errno == ENOENT)
{
// no entry... return
return 0;
}
else
{
// real error
sprintf (csText,"error while scanning directories in %s",p_cDir);
MessageBox(NULL,csText,"error",MB_OK );
return -1;
}*/
}
else
{
// file found, loop on all files
do
{
// look if it is a dir
if (stFileInfo.attrib & _A_SUBDIR)
{
if (bRecursive)
{
// directory + recursive, so scan it !
// check if it is not 'this' directory
if (stFileInfo.name[0] != '.')
{
if( strncmp(stFileInfo.name, "Slot", (long) 4) == 0) lNbSlotDir++;
if ( fn_bScanDir( stFileInfo.name, bRecursive) ==-1 )
{
// error !
return -1;
}
else
{
// directory scan successful, come back to current dir
_chdir("..");
}
}
}
}
// loop on find next file
} while (_findnext(iHandle,&stFileInfo) == 0);
// the end, so close handle
_findclose(iHandle);
}
return lNbSlotDir;
}
long fn_lGetNbAvailableSlotsPc()
{
long lNbAvailableSlots = 0;
char a256_cCurDir[255];
int Version =0;
#ifdef ACTIVE_EDITOR
Version = fn_iVersionN64_PC();
if ( Version == 0) return 0;
else if ( Version == 1 /* U64 */) return 3;
else if( Version == 2 /* PC */)
{
GetCurrentDirectory( 256, a256_cCurDir);
lNbAvailableSlots = fn_bScanDir( fn_szGetSaveGameDataPath() , TRUE);
SetCurrentDirectory( a256_cCurDir);
fn_bActualizeSlotListBis(lNbAvailableSlots);
}
#else // Version PC Normale
GetCurrentDirectory( 256, a256_cCurDir);
lNbAvailableSlots = fn_bScanDir( fn_szGetSaveGameDataPath() , TRUE);
SetCurrentDirectory( a256_cCurDir);
fn_bActualizeSlotListBis(lNbAvailableSlots);
#endif // ACTIVE_EDITOR
return lNbAvailableSlots;
}
int fn_iVersionN64_PC(void)
{
char a_c255_gsz_Version[255];
FILE *hIni;
int i;
static int Result = 0;
if(Result) return Result;
hIni = fopen("version.ini", "rt");
if(hIni)
{
*a_c255_gsz_Version = '\0';
fgets(a_c255_gsz_Version, 49, hIni);
fclose(hIni);
if( !strnicmp ( a_c255_gsz_Version, "GameDN64", 8) ) Result = 1;
else if ( !strncmp ( a_c255_gsz_Version, "GameDPC", 7) ) Result = 2;
}
return Result;
}
char * fn_cRecupSlotName(long lSlotId)
{
long pos = 1;
StructRecupPosSlot *p_StructRecupPosSlot;
p_StructRecupPosSlot = g_p_LastStructRecupPosSlot;
while( pos != lSlotId)
{
p_StructRecupPosSlot = p_StructRecupPosSlot->pt_NextStructRecupPosSlot;
pos++;
}
return p_StructRecupPosSlot->a_szSlotNames;
}
BOOL fn_bEraseGameInSlotList( long lSlotId)
{
StructRecupPosSlot *p_CurrentStructRecupPosSlotTmp;
StructRecupPosSlot *p_CurrentStructRecupPosSlot;
int Num = 0;
BOOL Result = TRUE;
// Arret de la recherche sur le slot precedent celui qui va etre effac<61> dans la liste de slot
if( lSlotId > 1)
{
p_CurrentStructRecupPosSlot = g_p_LastStructRecupPosSlot;
p_CurrentStructRecupPosSlotTmp = g_p_LastStructRecupPosSlot;
while( Num != lSlotId-1 && p_CurrentStructRecupPosSlot != NULL)
{
p_CurrentStructRecupPosSlotTmp = p_CurrentStructRecupPosSlot;
p_CurrentStructRecupPosSlot = p_CurrentStructRecupPosSlot->pt_NextStructRecupPosSlot;
Num++;
}
p_CurrentStructRecupPosSlotTmp->pt_NextStructRecupPosSlot = p_CurrentStructRecupPosSlot->pt_NextStructRecupPosSlot;
TMP_M_Free(p_CurrentStructRecupPosSlot);
}
else
{
p_CurrentStructRecupPosSlotTmp = g_p_LastStructRecupPosSlot;
TMP_M_Free(g_p_LastStructRecupPosSlot);
g_p_LastStructRecupPosSlot = p_CurrentStructRecupPosSlotTmp->pt_NextStructRecupPosSlot;
}
g_ucNbSaveGameSlots--;
return Result;
}
BOOL fn_bActualizeSlotListBis(long lNbAvailableSlots)
{
StructRecupPosSlot *p_StructRecupPosSlot;
BOOL bResult = FALSE;
if( lNbAvailableSlots != g_ucNbSaveGameSlots )
{
while (lNbAvailableSlots != g_ucNbSaveGameSlots)
{
p_StructRecupPosSlot = g_p_LastStructRecupPosSlot;
g_p_LastStructRecupPosSlot = (StructRecupPosSlot *) TMP_M_p_Malloc( sizeof(StructRecupPosSlot) );
g_p_LastStructRecupPosSlot->pt_NextStructRecupPosSlot = p_StructRecupPosSlot;
g_p_LastStructRecupPosSlot->pos = ++g_ucNbSaveGameSlots;
strncpy( g_p_LastStructRecupPosSlot->a_szSlotNames, g_a_szSlotNames, 3);
strcpy( g_p_LastStructRecupPosSlot->a_szOldSlotNames, "\\");
}
bResult = fn_bActualizeSlotPos();
}
return bResult;
}
#endif // ! U64
/******************** F PEREZ ********************/
/* FBF {*/
/*
//************************************************************************
void fn_vMenuOptionInitDetails(struct MNU_stMenuItem_ *hMenuItem,char *szText[])
{
MNU_fn_bSetValue(hMenuItem->uItem.hSlider,(short)g_stGameOptions.ulDetails);
}
//************************************************************************
void fn_vMenuOptionChangeDetailsValue(struct MNU_stMenuItem_ *hMenuItem,char *szText[])
{
fn_vChangeDetailsValue(MNU_fn_lGetValue(hMenuItem->uItem.hSlider));
}
//************************************************************************
void fn_vMenuOptionInitScreenSize(struct MNU_stMenuItem_ *hMenuItem,char *szText[])
{
MNU_fn_bSetValue(hMenuItem->uItem.hSlider,(short)g_stGameOptions.ulScreenSize);
}
//************************************************************************
void fn_vMenuOptionChangeScreenSizeValue(struct MNU_stMenuItem_ *hMenuItem,char *szText[])
{
//ANNECY CB
//fn_vChangeScreenSizeValue(MNU_fn_lGetValue(hMenuItem->uItem.hSlider));
//ENDANNECY
}
//************************************************************************
void fn_vMenuOptionInitMusicVolume(struct MNU_stMenuItem_ *hMenuItem,char *szText[])
{
MNU_fn_bSetValue(hMenuItem->uItem.hSlider,(short)g_stGameOptions.ulMusicVolume);
}
//************************************************************************
void fn_vMenuOptionChangeMusicVolumeValue(struct MNU_stMenuItem_ *hMenuItem,char *szText[])
{
fn_vChangeMusicVolumeValue(MNU_fn_lGetValue(hMenuItem->uItem.hSlider));
}
//************************************************************************
void fn_vMenuOptionInitFxVolume(struct MNU_stMenuItem_ *hMenuItem,char *szText[])
{
MNU_fn_bSetValue(hMenuItem->uItem.hSlider,(short)g_stGameOptions.ulFxVolume);
}
//************************************************************************
void fn_vMenuOptionChangeFxVolumeValue(struct MNU_stMenuItem_ *hMenuItem,char *szText[])
{
fn_vChangeFxVolumeValue(MNU_fn_lGetValue(hMenuItem->uItem.hSlider));
}
//************************************************************************
void fn_vMenuOptionInitVoiceVolume(struct MNU_stMenuItem_ *hMenuItem,char *szText[])
{
MNU_fn_bSetValue(hMenuItem->uItem.hSlider,(short)g_stGameOptions.ulVoiceVolume);
}
//************************************************************************
void fn_vMenuOptionChangeVoiceVolumeValue(struct MNU_stMenuItem_ *hMenuItem,char *szText[])
{
fn_vChangeVoiceVolumeValue(MNU_fn_lGetValue(hMenuItem->uItem.hSlider));
}
*/
/* FBF }*/
/**************************************************************************/
/**************************************************************************/
void fn_vValidateAllOption(void)
{
/**** Video options ****/
fn_vChangeDetailsValue(g_stGameOptions.ulDetails);
/*ANNECY CB*/
/* fn_vChangeScreenSizeValue(g_stGameOptions.ulScreenSize);*/
/*END ANNECY*/
/**** Sound options ****/
fn_vChangeMusicVolumeValue(g_stGameOptions.ulMusicVolume);
fn_vChangeFxVolumeValue(g_stGameOptions.ulFxVolume);
#ifdef D_USE_LIPSYNC
fn_vChangeVoiceVolumeValue(g_stGameOptions.ulVoiceVolume);
#endif
}
/**************************************************************************/
/*void fn_vChangePlayerName(char *_szName)
{
GAM_fn_vSetPlayerName(_szName);
}*/
/**************************************************************************/
void fn_vChangeDetailsValue(unsigned long _ulValue)
{
g_stGameOptions.ulDetails = _ulValue;
}
/**************************************************************************/
void fn_vChangeScreenSizeValue(unsigned long _ulValue)
{
/*ANNECY CB*/
#if 0
_ulValue = max(60,min(100,_ulValue));
g_stGameOptions.ulScreenSize = _ulValue;
fn_vChangeViewPortSize(g_stGameOptions.ulScreenSize);
#endif
/*ENDANNECY*/
}
/**************************************************************************/
void fn_vChangeMusicVolumeValue(unsigned long _ulValue)
{
_ulValue = max(0,min(127,_ulValue));
g_stGameOptions.ulMusicVolume = _ulValue;
SND_fn_vSetVolumeLineSound(g_lSoundVolumeLineMusic,g_stGameOptions.ulMusicVolume);
}
/**************************************************************************/
void fn_vChangeFxVolumeValue(unsigned long _ulValue)
{
_ulValue = max(0,min(127,_ulValue));
g_stGameOptions.ulFxVolume = _ulValue;
SND_fn_vSetVolumeLineSound(g_lSoundVolumeLineSound ,g_stGameOptions.ulFxVolume);
}
/**************************************************************************/
#ifdef D_USE_LIPSYNC
void fn_vChangeVoiceVolumeValue(unsigned long _ulValue)
{
_ulValue = max(0,min(127,_ulValue));
g_stGameOptions.ulVoiceVolume = _ulValue;
SND_fn_vSetVolumeLineSound(g_lSoundVolumeLineVoices ,g_stGameOptions.ulVoiceVolume);
}
#endif D_USE_LIPSYNC
/**************************************************************************/
unsigned long fn_ulGetTrameNumber(void) {
return( g_stEngineStructure.stEngineTimer.ulTrameNumber) ;
}

View File

@@ -0,0 +1,829 @@
/*=========================================================================
* GamSave.c : Game save
* This is a part of the Game project.
*
* Version 1.0
* Creation date 03/07/97
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1997
*=======================================================================*/
#define SCR_DM_OptCFiles
#define D_FIL_StructureDefine
#include "ToolsCPA.h"
#include "Options/Options.h"
#include "Macros.h"
#include "Actions/AllActs.h"
#include "Structur/3DOSLktb.h"
#include "Structur/EngMode.h"
#include "Structur/StdObjSt.h"
#include "Structur/Objects.h"
#include "Structur/GameScpt.h"
#include "Structur/ErrGame.h"
#include "Structur/MemGame.h"
#include "gamopt.h"
#include "PlayAnim/PlayAnim.h"
#include "Always.h"
#include "Basic.h"
#include "DspFix.h"
#include "GameEng.h"
#include "GamSave.h"
#include "LoadLvl.h"
#include "ObjInit.h"
#include "ObjType.h"
#include "Zemem.h"
#include "CMP.h"
extern unsigned char FIL_fn_bIsValidPath(char *_szFileName);
const char *g_c_szSlotNames[] = /*extern declared in GamSave.h*/
{
"HiddenSlot",
"Slot1",
"Slot2",
"Slot3"
};
#ifndef U64
/************ FabPerez ***************/
#include <time.h>
#define _MAX_PATH_DIR 128
unsigned char g_ucNbSaveGameSlots = 0;
BOOL g_bIsGameAlreadyExist = FALSE;
//extern StructRecupPosSlot * g_p_LastStructRecupPosSlot;
StructRecupPosSlot * g_p_LastStructRecupPosSlot = NULL;
char g_a_szSlotNames[4] = "\\";
char * fn_bGetStringSlotDate(unsigned long _ulSlotId);
ACP_tdxBool fn_bActualizeSlotList( char *szDstPath, unsigned long _ulSlotId);
ACP_tdxBool fn_bActualizeSlotPos(void);
ACP_tdxBool fn_bCreateSlotDir( char *szDstPath, unsigned long _ulSlotId);
int fn_iCompareSlotDate(unsigned char * CurrentSlotDir, unsigned char * NextSlotDir);
BOOL fn_bGetSlotDate( unsigned char * SlotDate, unsigned long _ulSlotId);
extern int fn_iVersionN64_PC(void);
extern long fn_bRecupSlotNum(long lSlotPosId);
/*************** EndFabPerez **************/
#endif
unsigned char GAM_g_ucSaveGameBeforeChangeLevel = 1;
/**************************************************************************/
unsigned char fn_bPlayerSaveGameAll(void)
{
unsigned char bReturn = TRUE;
char szFileNameGeneral[_MAX_PATH]/*,szFileNameLevel[_MAX_PATH]*/;
sprintf(szFileNameGeneral,"%s\\%s\\General.sav",fn_szGetSaveGameDataPath(),g_c_szSlotNames[0]); /* save in hidden slot*/
bReturn = fn_bPlayerSaveGameGeneral(szFileNameGeneral);
return(bReturn);
}
/**************************************************************************/
unsigned char fn_bLevelSaveGameAll(void)
{
unsigned char bReturn = TRUE;
char szFileName[_MAX_PATH];
sprintf(szFileName,"%s\\%s\\%s_%d.sav",fn_szGetSaveGameDataPath(),g_c_szSlotNames[0],fn_p_szGetLevelName(), GAM_M_GetSubMap(fn_lGetSubMapNumber()));
bReturn = fn_bLevelSaveGameItSelf(szFileName);
return(bReturn);
}
/**************************************************************************/
unsigned char fn_bPlayerSaveGameGeneral(char *_szFileName)
{
return(SAI_fn_ucPlayerSaveValues(_szFileName));
}
/**************************************************************************/
unsigned char fn_bLevelSaveGameItSelf(char *_szFileName)
{
return(SAI_fn_ucLevelSaveValues(_szFileName));
}
/**************************************************************************/
unsigned char fn_bLoadPlayerSaveGameAfterLoadLevel(void)
{
unsigned char bReturn = FALSE;
char szFileName[_MAX_PATH];
sprintf(szFileName,"%s\\%s\\General.sav",fn_szGetSaveGameDataPath(),g_c_szSlotNames[0]); /* save in hidden slot*/
if (SCR_fn_c_RdL0_IsSectionExists(szFileName))
{
/*SAI_fn_ucLoadValues(szFileName);*/
SAI_fn_ucLoadPlayerValues( szFileName );
/* fn_vGameTestMemory();*/
bReturn = TRUE;
}
return(bReturn);
}
/**************************************************************************/
unsigned char fn_bLoadLevelSaveGameAfterLoadLevel(void)
{
unsigned char bReturn = FALSE;
char szFileName[_MAX_PATH];
sprintf(szFileName,"%s\\%s\\%s_%d.sav",fn_szGetSaveGameDataPath(),g_c_szSlotNames[0],fn_p_szGetLevelName(), GAM_M_GetSubMap(fn_lGetSubMapNumber()));
if (SCR_fn_c_RdL0_IsSectionExists(szFileName))
{
/*SAI_fn_ucLoadValues(szFileName);*/
SAI_fn_ucLoadLevelValues( szFileName );
/* fn_vGameTestMemory();*/
bReturn = TRUE;
}
return(bReturn);
}
/**************************************************************************/
ACP_tdxBool fn_bRenameSaveGameSlot(char *_szOldName, char *_szNewName)
{
ACP_tdxBool bReturn = FALSE;
char szOldFileName[_MAX_PATH], szNewFileName[_MAX_PATH];
sprintf(szOldFileName,"%s\\%s",fn_szGetSaveGameDataPath(), _szOldName);
if ( FIL_fn_bIsValidPath(szOldFileName) )
{
sprintf(szNewFileName,"%s\\%s",fn_szGetSaveGameDataPath(), _szNewName);
bReturn = (unsigned char)MoveFile(szOldFileName, szNewFileName);
}
return bReturn;
}
/**************************************************************************/
unsigned char fn_bDestroySavedGame(unsigned long _ulSlotId)
{
unsigned char bReturn = FALSE;
char szFileName[_MAX_PATH];
int Version;
#ifdef U64
if ( !((_ulSlotId >= 1) && (_ulSlotId <= C_ucNbSaveGameSlots)) ) return bReturn;
sprintf(szFileName,"%s\\%s",fn_szGetSaveGameDataPath(),g_c_szSlotNames[_ulSlotId]);
#else // PC
#ifdef ACTIVE_EDITOR
Version = fn_iVersionN64_PC();
if ( Version == 1 /* U64 */)
{
if ( !((_ulSlotId >= 1) && (_ulSlotId <= C_ucNbSaveGameSlots)) ) return bReturn;
sprintf(szFileName,"%s\\%s",fn_szGetSaveGameDataPath(),g_c_szSlotNames[_ulSlotId]);
}
else if( Version == 2 /* PC */)
{
if( _ulSlotId == 0) sprintf(szFileName,"%s\\%s",fn_szGetSaveGameDataPath(),g_c_szSlotNames[_ulSlotId]);
else
{
if ( !((_ulSlotId >= 1) && (_ulSlotId <= g_ucNbSaveGameSlots)) ) return bReturn;;
if( !fn_bCreateSlotDir(szFileName, _ulSlotId) ) return FALSE; // Fct PC
}
}
#else // PC sans editeur
if( _ulSlotId == 0) sprintf(szFileName,"%s\\%s",fn_szGetSaveGameDataPath(),g_c_szSlotNames[_ulSlotId]);
else
{
if ( !((_ulSlotId >= 1) && (_ulSlotId <= g_ucNbSaveGameSlots)) ) return bReturn;;
if( !fn_bCreateSlotDir(szFileName, _ulSlotId) ) return FALSE; // Fct PC
}
#endif // EDITOR
#endif // U64
bReturn = FIL_fn_bDestroyFileOrDirectory(szFileName);
return(bReturn);
}
/**************************************************************************/
/*
----------------------------------------------------------------------------------------
Description : copy directory
Returns (BOOL ) true if success
----------------------------------------------------------------------------------------
*/
BOOL fn_bCopyDirectory(char * _szSrcDir, char * _szDestDir)
{
WIN32_FIND_DATA stFindData;
HANDLE hFind;
char szSrcDir[255];
char szDestDir[255];
char *p_szEndSource;
char *p_szEndTarget;
strcpy(szSrcDir,_szSrcDir);
strcpy(szDestDir,_szDestDir);
p_szEndSource = szSrcDir + strlen( szSrcDir );
p_szEndTarget = szDestDir + strlen( szDestDir );
strcpy( p_szEndSource, "\\*.*" );
if( (hFind = FindFirstFile(szSrcDir, &stFindData )) == INVALID_HANDLE_VALUE)
return FALSE;
do
{
*p_szEndTarget = *p_szEndSource = '\\';
if ( !(stFindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) )
{
strcpy( p_szEndSource + 1, stFindData.cFileName );
strcpy( p_szEndTarget + 1, stFindData.cFileName );
if ( !CopyFile( szSrcDir, szDestDir, FALSE ) )
return FALSE;
}
*p_szEndSource = *p_szEndTarget = 0;
} while(FindNextFile( hFind, &stFindData ));
FindClose( hFind );
return TRUE;
}
/**************************************************************************/
/* Delete all files and sub dirs in a directory but not the dir itself (recursive).*/
/* Return TRUE on success or FALSE on error.*/
BOOL fn_bDeleteDirectoryContent( char * _szDir )
{
WIN32_FIND_DATA stFindData;
HANDLE hFind;
char szDir[255];
char *p_szEndString;
strcpy(szDir,_szDir);
p_szEndString = szDir + strlen( szDir );
if( *(p_szEndString-1) == '\\' )
*(p_szEndString-1) = 0;
strcpy( p_szEndString, "\\*.*" );
if( (hFind = FindFirstFile(szDir, &stFindData )) == INVALID_HANDLE_VALUE)
/* Dir does not exist or is empty, return TRUE.*/
return TRUE;
do
{
if ( !(stFindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) )
{
strcpy( p_szEndString + 1, stFindData.cFileName );
if ( !DeleteFile( szDir ) )
/* Error deleting file, return FALSE*/
return FALSE;
}
else
if( strcmp(stFindData.cFileName,".") && strcmp(stFindData.cFileName,"..") )
{
strcpy( p_szEndString + 1, stFindData.cFileName );
if( !fn_bDeleteDirectoryContent( szDir ) )
/* Error deleting files in subdir, return FALSE*/
return FALSE;
RemoveDirectory( szDir );
}
} while(FindNextFile( hFind, &stFindData ));
FindClose( hFind );
return TRUE;
}
BOOL fn_bDeleteDirectory( char * _szDir )
{
WIN32_FIND_DATA stFindData;
HANDLE hFind;
char szDir[255];
char *p_szEndString;
strcpy(szDir,_szDir);
/*
p_szEndString = szDir + strlen( szDir );
if( *(p_szEndString-1) == '\\' )
*(p_szEndString-1) = 0;
strcpy( p_szEndString, "\\*.*" );
*/
if( (hFind = FindFirstFile(szDir, &stFindData )) == INVALID_HANDLE_VALUE)
// Dir does not exist or is empty, return TRUE.
return TRUE;
if ( !(stFindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) )
{
strcpy( p_szEndString + 1, stFindData.cFileName );
if ( !DeleteFile( szDir ) )
/* Error deleting file, return FALSE*/
return FALSE;
}
FindClose( hFind );
return TRUE;
}
/**************************************************************************/
ACP_tdxBool fn_bSaveGameInSlot(unsigned long _ulSlotId)
{
unsigned char bReturn = FALSE;
char szSrcPath[_MAX_PATH], szDstPath[_MAX_PATH];
int Version;
#ifndef U64
StructRecupPosSlot *p_CurrentStructRecupPosSlot;
int iNum = 1;
#endif // U64
/* if the slot name is valid*/
#ifdef U64
if ( !( ((_ulSlotId >= 1) && (_ulSlotId <= C_ucNbSaveGameSlots)) && GAM_fn_bIsSlotNameValid(g_c_szSlotNames[_ulSlotId]) ) ) return bReturn;
#else // PC
#ifdef ACTIVE_EDITOR
Version = fn_iVersionN64_PC();
if( Version == 1 /* N64 */)
{
if ( !( ((_ulSlotId >= 1) && (_ulSlotId <= C_ucNbSaveGameSlots)) && GAM_fn_bIsSlotNameValid(g_c_szSlotNames[_ulSlotId]) ) ) return bReturn;
}
else if( Version == 2 /* PC */)
{
//if( _ulSlotId > g_ucNbSaveGameSlots ) _ulSlotId = g_ucNbSaveGameSlots;
if ( !((_ulSlotId >= 1) && (_ulSlotId <= g_ucNbSaveGameSlots)) ) return bReturn;
}
#else // PC sans editeur
//if( _ulSlotId > g_ucNbSaveGameSlots ) _ulSlotId = g_ucNbSaveGameSlots;
if ( !((_ulSlotId >= 1) && (_ulSlotId <= g_ucNbSaveGameSlots)) ) return bReturn;
#endif // EDITOR
#endif // U64
sprintf(szSrcPath,"%s\\%s",fn_szGetSaveGameDataPath(),g_c_szSlotNames[0]);
/*make sure the source (the hidden slot) exists*/
if ( FIL_fn_bIsValidPath(szSrcPath) )
{
#ifndef U64
#ifdef ACTIVE_EDITOR
Version = fn_iVersionN64_PC();
if( Version == 1 /* N64 */)
{
sprintf(szDstPath,"%s\\%s",fn_szGetSaveGameDataPath(),g_c_szSlotNames[_ulSlotId]);
}
else if( Version == 2 /* PC */)
{
p_CurrentStructRecupPosSlot = g_p_LastStructRecupPosSlot;
while( iNum != _ulSlotId && g_bIsGameAlreadyExist)
{
p_CurrentStructRecupPosSlot = p_CurrentStructRecupPosSlot->pt_NextStructRecupPosSlot;
iNum++;
}
_ulSlotId = p_CurrentStructRecupPosSlot->pos;
if( !fn_bCreateSlotDir(szDstPath, _ulSlotId) ) return FALSE; // Fct PC
}
#else // PC sans editeur
p_CurrentStructRecupPosSlot = g_p_LastStructRecupPosSlot;
while( iNum != _ulSlotId && g_bIsGameAlreadyExist)
{
p_CurrentStructRecupPosSlot = p_CurrentStructRecupPosSlot->pt_NextStructRecupPosSlot;
iNum++;
}
_ulSlotId = p_CurrentStructRecupPosSlot->pos;
if( !fn_bCreateSlotDir(szDstPath, _ulSlotId) ) return FALSE; // Fct PC
#endif // EDITOR
#else // N64
sprintf(szDstPath,"%s\\%s",fn_szGetSaveGameDataPath(),g_c_szSlotNames[_ulSlotId]);
#endif // U64
/*make sure the destination is cleaned*/
/* if ( FIL_fn_bDestroyFileOrDirectory(szDstPath) )*/
if ( fn_bDeleteDirectoryContent(szDstPath) )
{
/* create the path to the destination if */
FIL_fn_bValidatePath(szDstPath, "");
/* now copy the contents of the source in the destination, replacing existing files*/
bReturn = fn_bCopyDirectory(szSrcPath, szDstPath);
#ifndef U64
#ifdef ACTIVE_EDITOR
Version = fn_iVersionN64_PC();
if( Version == 2 /* PC */) bReturn = fn_bActualizeSlotList(szDstPath, _ulSlotId);
#else // PC sans editeur
bReturn = fn_bActualizeSlotList(szDstPath, _ulSlotId);
#endif // EDITOR
#endif N64
}
#ifndef U64
#ifdef ACTIVE_EDITOR
Version = fn_iVersionN64_PC();
if( Version == 2 /* PC */) fn_bSaveCurrentGameOptions();
#else // PC sans editeur
fn_bSaveCurrentGameOptions();
#endif // EDITOR
#endif // U64
}
return(bReturn);
}
/********************************** FabPerez *********************************/
ACP_tdxBool fn_bCreateSlotDir(char *szDstPath, unsigned long _ulSlotId)
{
unsigned char a_cSlotNameDir[_MAX_PATH_DIR] ;
sprintf(a_cSlotNameDir,"%s\\%s%i", fn_szGetSaveGameDataPath(), "Slot", _ulSlotId);
if( strlen(a_cSlotNameDir) > _MAX_PATH_DIR) return FALSE;
else strcpy(szDstPath, a_cSlotNameDir);
return TRUE;
}
ACP_tdxBool fn_bActualizeSlotList( char *szDstPath, unsigned long _ulSlotId)
{
unsigned char a_cSlotNameDir[_MAX_PATH_DIR] ;
unsigned char a_cSlotNameNb[5] = "Slot";
struct StructRecupPosSlot *p_StructRecupPosSlot;
//SAF_M_AssertWithMsg((_ulSlotId >= 1 && _ulSlotId <= g_ucNbSaveGameSlots ),"Slot inexistant");
if( _ulSlotId >=1 && _ulSlotId <= g_ucNbSaveGameSlots) // Slot existe deja
{
fn_bActualizeSlotPos();
}
else // Nouveau Slot
{
if(g_p_LastStructRecupPosSlot != NULL)
{
p_StructRecupPosSlot = g_p_LastStructRecupPosSlot;
g_p_LastStructRecupPosSlot = TMP_M_p_Malloc( sizeof(StructRecupPosSlot) );
g_p_LastStructRecupPosSlot->pt_NextStructRecupPosSlot = p_StructRecupPosSlot;
g_p_LastStructRecupPosSlot->pos = ++g_ucNbSaveGameSlots;
}
}
strncpy( g_p_LastStructRecupPosSlot->a_szSlotNames, g_a_szSlotNames, 3);
strcpy( g_p_LastStructRecupPosSlot->a_szOldSlotNames, "\\");
return TRUE;
}
ACP_tdxBool fn_bActualizeSlotPos(void)
{
int i, j;
BOOL INVERT;
StructRecupPosSlot * p_CurrentStructRecupPosSlot;
StructRecupPosSlot * p_NextStructRecupPosSlot;
unsigned char a128_cCurrentSlotDir[128];
unsigned char a128_cNextSlotDir[128];
char a_c4TmpName[C_ucSaveGameSlotNameLength + 1];
char a_c4TmpOldName[C_ucSaveGameSlotNameLength + 1];
long TmpPos;
i = 0;
INVERT =TRUE;
while( i < g_ucNbSaveGameSlots && INVERT )
{
INVERT = FALSE;
for( j = g_ucNbSaveGameSlots-1 ; j > i ; j--)
{
if( j == g_ucNbSaveGameSlots-1) // Debut en haut de pile
{
p_CurrentStructRecupPosSlot= g_p_LastStructRecupPosSlot->pt_NextStructRecupPosSlot;
p_NextStructRecupPosSlot = g_p_LastStructRecupPosSlot;
}
else // Suite de la liste
{
p_NextStructRecupPosSlot = p_CurrentStructRecupPosSlot;
p_CurrentStructRecupPosSlot = p_NextStructRecupPosSlot->pt_NextStructRecupPosSlot;
}
sprintf( a128_cCurrentSlotDir, "%s\\%s%i", fn_szGetSaveGameDataPath(),"Slot", p_CurrentStructRecupPosSlot->pos);
sprintf( a128_cNextSlotDir, "%s\\%s%i", fn_szGetSaveGameDataPath(),"Slot", p_NextStructRecupPosSlot->pos);
if( fn_iCompareSlotDate(a128_cCurrentSlotDir, a128_cNextSlotDir) )
{
INVERT =TRUE;
TmpPos = p_CurrentStructRecupPosSlot->pos;
strcpy( a_c4TmpName, p_CurrentStructRecupPosSlot->a_szSlotNames);
strcpy( a_c4TmpOldName, p_CurrentStructRecupPosSlot->a_szOldSlotNames);
p_CurrentStructRecupPosSlot->pos = p_NextStructRecupPosSlot->pos;
strcpy(p_CurrentStructRecupPosSlot->a_szSlotNames, p_NextStructRecupPosSlot->a_szSlotNames);
p_NextStructRecupPosSlot->pos = TmpPos;
strcpy( p_NextStructRecupPosSlot->a_szSlotNames, a_c4TmpName);
strcpy( p_NextStructRecupPosSlot->a_szOldSlotNames, a_c4TmpOldName);
} // If
} // For
i++;
} // While
return 1;
}
int fn_iCompareSlotDate(unsigned char * CurrentSlotDir, unsigned char * NextSlotDir)
{
struct _finddata_t c_file_currentslot, c_file_nextslot;
long hFileCurrentSlot, hFileNextSlot;
unsigned char a128_cTextTmp[128];
double fDiffSeconde;
if( (hFileCurrentSlot = _findfirst( CurrentSlotDir, &c_file_currentslot)) == -1L)
{
sprintf(a128_cTextTmp, "Erreur : impossible de lire la date de creation du repertoire : %s", CurrentSlotDir);
if(MessageBox(NULL, a128_cTextTmp, NULL, MB_RETRYCANCEL) != IDRETRY) return -1;
else fn_iCompareSlotDate(CurrentSlotDir, NextSlotDir);
}
else
{
if( (c_file_currentslot.attrib & _A_RDONLY) == _A_RDONLY) _chmod( CurrentSlotDir, _S_IREAD | _S_IWRITE );
if( (hFileNextSlot = _findfirst( NextSlotDir, &c_file_nextslot)) == -1L)
{
sprintf(a128_cTextTmp, "Erreur : impossible de lire la date de creation du repertoire : %s", NextSlotDir);
if(MessageBox(NULL, a128_cTextTmp, NULL, MB_RETRYCANCEL) != IDRETRY) return -1;
else fn_iCompareSlotDate(CurrentSlotDir, NextSlotDir);
}
else
{
fDiffSeconde = difftime( c_file_currentslot.time_write, c_file_nextslot.time_write);
if( fDiffSeconde <= 0) return 0;
}
}
_findclose( hFileCurrentSlot );
_findclose( hFileNextSlot );
return 1;
}
BOOL fn_bGetSlotDate( unsigned char * SlotDate, unsigned long _ulSlotId)
{
struct _finddata_t c_file_slot;
struct tm *Date;
long hFileSlot;
unsigned char a128_cSlotDir[128];
unsigned char a128_cTextTmp[128];
BOOL bReturn = TRUE;
if( !fn_bCreateSlotDir( a128_cSlotDir, _ulSlotId) ) return FALSE;
sprintf(a128_cSlotDir, "%s\\%s", a128_cSlotDir, "general.sav");
if( (hFileSlot = _findfirst( a128_cSlotDir, &c_file_slot)) == -1L)
{
sprintf(a128_cTextTmp, "Erreur : impossible de lire la date de creation du repertoire : %s", a128_cSlotDir);
if(MessageBox(NULL, a128_cTextTmp, NULL, MB_RETRYCANCEL) != IDRETRY) return FALSE;
else fn_bGetSlotDate(a128_cSlotDir, _ulSlotId);
}
else
{
if( (c_file_slot.attrib & _A_RDONLY) == _A_RDONLY) _chmod( a128_cSlotDir, _S_IREAD | _S_IWRITE );
Date = localtime( &c_file_slot.time_write );
sprintf(SlotDate, "%i/%i %i:%i", Date->tm_mday, Date->tm_mon, Date->tm_hour, Date->tm_min);
}
_findclose( hFileSlot );
return(bReturn);
}
char * fn_bGetStringSlotDate(unsigned long _ulSlotId)
{
struct _finddata_t c_file_slot;
struct tm *Date;
long hFileSlot;
unsigned char a128_cSlotDir[128];
unsigned char a128_cTextTmp[128];
char * tmp = NULL;
if( !fn_bCreateSlotDir( a128_cSlotDir, _ulSlotId) ) return tmp;
sprintf(a128_cSlotDir, "%s\\%s", a128_cSlotDir, "general.sav");
if( (hFileSlot = _findfirst( a128_cSlotDir, &c_file_slot)) == -1L)
{
sprintf(a128_cTextTmp, "Erreur : impossible de lire la date de creation du repertoire : %s", a128_cSlotDir);
if(MessageBox(NULL, a128_cTextTmp, NULL, MB_RETRYCANCEL) != IDRETRY) return tmp;
else fn_bGetSlotDate(a128_cSlotDir, _ulSlotId);
}
else
{
if( (c_file_slot.attrib & _A_RDONLY) == _A_RDONLY) _chmod( a128_cSlotDir, _S_IREAD | _S_IWRITE );
Date = localtime( &c_file_slot.time_write );
sprintf(a128_cSlotDir, "%i.%i %i.%i", Date->tm_mday, Date->tm_mon+1, Date->tm_hour, Date->tm_min);
}
_findclose( hFileSlot );
return(tmp = a128_cSlotDir);
}
/******************************* Fin FabPerez *********************************/
/**************************************************************************/
ACP_tdxBool fn_bIsSlotOccupied(unsigned long _ulSlotId)
{
unsigned char bReturn = FALSE;
char szSrcPath[_MAX_PATH];
int Version;
/* Also test for slot 0 (AI can delete hidden slot) */
#ifdef U64
if ( !((_ulSlotId >= 1) && (_ulSlotId <= C_ucNbSaveGameSlots)) ) return bReturn;
sprintf(szSrcPath,"%s\\%s",fn_szGetSaveGameDataPath(),g_c_szSlotNames[_ulSlotId]);
#else // PC
#ifdef ACTIVE_EDITOR
Version = fn_iVersionN64_PC();
if( Version == 1 /* N64 */)
{
if ( !((_ulSlotId >= 1) && (_ulSlotId <= C_ucNbSaveGameSlots)) ) return bReturn;
sprintf(szSrcPath,"%s\\%s",fn_szGetSaveGameDataPath(),g_c_szSlotNames[_ulSlotId]);
}
else if( Version == 2 /* PC */)
{
if ( !((_ulSlotId >= 1) && (_ulSlotId <= g_ucNbSaveGameSlots)) ) return bReturn;
sprintf(szSrcPath,"%s\\Slot%i",fn_szGetSaveGameDataPath(), fn_bRecupSlotNum(_ulSlotId) );
}
#else // PC sans editeur
if ( !((_ulSlotId >= 1) && (_ulSlotId <= g_ucNbSaveGameSlots)) ) return bReturn;
sprintf(szSrcPath,"%s\\Slot%i",fn_szGetSaveGameDataPath(), fn_bRecupSlotNum(_ulSlotId) );
#endif // EDITOR
#endif // U64
bReturn = (unsigned char) FIL_fn_bIsValidPath(szSrcPath);
return bReturn;
}
/**************************************************************************/
/* move the contents of a registered slot to the hidden slot (where the data will be read when the engine initializes)*/
ACP_tdxBool fn_bLoadGameFromSlot(unsigned long _ulSlotId)
{
unsigned char bReturn = FALSE;
int Version;
if ( fn_bIsSlotOccupied (_ulSlotId) )
{
char szSrcPath[_MAX_PATH], szDstPath[_MAX_PATH];
#ifdef U64
sprintf(szSrcPath,"%s\\%s",fn_szGetSaveGameDataPath(),g_c_szSlotNames[_ulSlotId]);
#else // PC
#ifdef ACTIVE_EDITOR
Version = fn_iVersionN64_PC();
if ( Version == 1 /* U64 */)
{
sprintf(szSrcPath,"%s\\%s",fn_szGetSaveGameDataPath(),g_c_szSlotNames[_ulSlotId]);
}
else if( Version == 2 /* PC */)
{
sprintf(szSrcPath,"%s\\Slot%i",fn_szGetSaveGameDataPath(), fn_bRecupSlotNum( _ulSlotId) );
}
#else // PC sans editeur
sprintf(szSrcPath,"%s\\Slot%i",fn_szGetSaveGameDataPath(), fn_bRecupSlotNum( _ulSlotId) );
#endif // EDITOR
#endif // U64
/*make sure the source exists*/
sprintf(szDstPath,"%s\\%s",fn_szGetSaveGameDataPath(),g_c_szSlotNames[0]);
/*make sure the destination is cleaned*/
/* if ( FIL_fn_bDestroyFileOrDirectory(szDstPath) )*/
if ( fn_bDeleteDirectoryContent(szDstPath) )
{
/* create the path to the destination if necessary*/
FIL_fn_bValidatePath(szDstPath, "");
/* now copy the contents of the source in the destination, replacing existing files*/
bReturn = fn_bCopyDirectory(szSrcPath, szDstPath);
}
}
/* Next time we change level, don't save the current game.*/
GAM_g_ucSaveGameBeforeChangeLevel = 0;
return bReturn;
}
/**************************************************************************/
/*erase the contents of the specified slot*/
ACP_tdxBool fn_bEraseGameInSlot(unsigned long _ulSlotId)
{
unsigned char bReturn = TRUE; /*if the slot is already empty, the function is successful*/
int Version;
if ( fn_bIsSlotOccupied(_ulSlotId) )
{
char szPath[_MAX_PATH];
#ifdef U64
sprintf(szPath,"%s\\%s",fn_szGetSaveGameDataPath(),g_c_szSlotNames[_ulSlotId]);
bReturn = FIL_fn_bDestroyFileOrDirectory(szPath);
#else /* PC*/
#ifdef ACTIVE_EDITOR
Version = fn_iVersionN64_PC();
if ( Version == 1 /* U64 */)
{
sprintf(szPath,"%s\\%s",fn_szGetSaveGameDataPath(),g_c_szSlotNames[_ulSlotId]);
bReturn = FIL_fn_bDestroyFileOrDirectory(szPath);
}
else if( Version == 2 /* PC */)
{
char szSrcPath[_MAX_PATH], szDstPath[_MAX_PATH];
StructRecupPosSlot *p_CurrentStructRecupPosSlot;
sprintf(szSrcPath,"%s\\Slot%i",fn_szGetSaveGameDataPath(), g_ucNbSaveGameSlots );
if(g_ucNbSaveGameSlots != fn_bRecupSlotNum(_ulSlotId) )
{
sprintf(szDstPath,"%s\\Slot%i",fn_szGetSaveGameDataPath(), fn_bRecupSlotNum(_ulSlotId) );
if ( (bReturn = FIL_fn_bValidatePath(szDstPath, "")) != 0 )
{
bReturn = fn_bCopyDirectory(szSrcPath, szDstPath);
}
p_CurrentStructRecupPosSlot = g_p_LastStructRecupPosSlot;
while( p_CurrentStructRecupPosSlot->pt_NextStructRecupPosSlot != NULL && p_CurrentStructRecupPosSlot->pos != g_ucNbSaveGameSlots)
{
p_CurrentStructRecupPosSlot = p_CurrentStructRecupPosSlot->pt_NextStructRecupPosSlot;
}
p_CurrentStructRecupPosSlot->pos = fn_bRecupSlotNum(_ulSlotId);
}
bReturn = FIL_fn_bDestroyFileOrDirectory(szSrcPath);
}
#else // Pc sans editor
char szSrcPath[_MAX_PATH], szDstPath[_MAX_PATH];
StructRecupPosSlot *p_CurrentStructRecupPosSlot;
// Copie du repertoire du dernier slot de la list dans le repertoire du slot qui va etre effac<61>
// => pas de trou dans les repertoire rep 1, rep 2 et rep 4 impossible mais bien rep 1 2 et 3
//fn_bCopyGameInSlotFromSlot( fn_bRecupSlotNum(_ulSlotId), fn_bRecupSlotNum( g_ucNbSaveGameSlots));
sprintf(szSrcPath,"%s\\Slot%i",fn_szGetSaveGameDataPath(), g_ucNbSaveGameSlots );
if(g_ucNbSaveGameSlots != fn_bRecupSlotNum(_ulSlotId) )
{
sprintf(szDstPath,"%s\\Slot%i",fn_szGetSaveGameDataPath(), fn_bRecupSlotNum(_ulSlotId) );
// Verif et creation si necessaire de la destination
if ( (bReturn = FIL_fn_bValidatePath(szDstPath, "")) != 0 )
{
bReturn = fn_bCopyDirectory(szSrcPath, szDstPath);
}
// actualise le num du repertoire du dernier slot de la liste
p_CurrentStructRecupPosSlot = g_p_LastStructRecupPosSlot;
while( p_CurrentStructRecupPosSlot->pt_NextStructRecupPosSlot != NULL && p_CurrentStructRecupPosSlot->pos != g_ucNbSaveGameSlots)
{
p_CurrentStructRecupPosSlot = p_CurrentStructRecupPosSlot->pt_NextStructRecupPosSlot;
}
p_CurrentStructRecupPosSlot->pos = fn_bRecupSlotNum(_ulSlotId);
}
// efface le repertoire du dernier slot de la liste
bReturn = FIL_fn_bDestroyFileOrDirectory(szSrcPath);
#endif // EDITOR
#endif // U64
}
return bReturn;
}
/**************************************************************************/
/*duplicate the contents of the specified slots*/
ACP_tdxBool fn_bCopyGameInSlotFromSlot(unsigned long _ulDstSlotId, unsigned long _ulSrcSlotId)
{
unsigned char bReturn = FALSE;
if
(
fn_bIsSlotOccupied(_ulSrcSlotId) /*we must copy from a non-empty slot*/
&& fn_bEraseGameInSlot(_ulDstSlotId) /*in a cleaned slot*/
)
{
char szSrcPath[_MAX_PATH], szDstPath[_MAX_PATH];
sprintf(szSrcPath,"%s\\%s",fn_szGetSaveGameDataPath(),g_c_szSlotNames[_ulSrcSlotId]);
/*make sure the source exists*/
sprintf(szDstPath,"%s\\%s",fn_szGetSaveGameDataPath(),g_c_szSlotNames[_ulDstSlotId]);
/* create the path to the destination if necessary*/
if ( (bReturn = FIL_fn_bValidatePath(szDstPath, "")) != 0 )
{
/* now copy the contents of the source in the destination, replacing existing files*/
bReturn = fn_bCopyDirectory(szSrcPath, szDstPath);
}
}
return bReturn;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,457 @@
#define D_CineInfo_StructureDefine
#include "ToolsCPA.h"
#include "Structur/State.h"
#include "Actions/AllActs.h"
#include "Actions/collset.h"
#include "structur/StdObjSt.h"
#include "structur/engmode.h"
#include "structur/objects.h"
#include "structur/MemGame.h"
#include "GameEng.h"
#include "ObjType.h"
#include "ia_dnm.h"
#include "ToolCam.h"
#ifdef SOUND_FOR_3DOS
#include "Micros.h"
#endif
#include "TypeCam.h"
#include "ToolMatr.h"
#include "collisio.h"
#include "ZdxStuff.h"
#include "ZeMem.h"
/****************************/
/* ANNECY MT - 14/09/98 { to display info on Wnd screen*/
#if defined(USE_PROFILER) && !defined(PRESS_DEMO)
extern void DisplayPolices (char * _szText , long _lX , long _lY);
#define GLI_vDisplayPolices(Text,X,Y) DisplayPolices((char*)(Text),X,Y)
#endif
/* END ANNECY MT }*/
/****************************/
/* ANNECY AV DEMO {*/
#ifndef U64
#include "Specif/Demos.h"
#endif
/* END ANNECY AV }*/
/*
*=================================================================================================
* Get pointer on the ViewportManagement Structure
*=================================================================================================
*/
tdxHandleToViewportManagement CAM_fn_p_stGetViewPortManagement(long _lViewportNumber)
{
if
(
(_lViewportNumber > CAM_Nb_Viewport)
|| (_lViewportNumber == (long) CAM_e_NoViewport)
)
return NULL;
else
return(&g_stEngineStructure.a_hViewportArray[_lViewportNumber - 1]);
}
/*
*=================================================================================================
* Return handle of game's camera and pointer on camera's structur
*=================================================================================================
*/
HIE_tdxHandleToSuperObject CAM_fn_hGetActiveCamera(long _lViewportNumber)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
tdxHandleToViewportManagement hViewport;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
hViewport = CAM_fn_p_stGetViewPortManagement(_lViewportNumber);
return (hViewport->hCamera);
}
/*
*=================================================================================================
* Assign a camera to a viewport
*=================================================================================================
*/
void CAM_fn_vAssignCameraToAViewport(long _lViewportNumber, HIE_tdxHandleToSuperObject _hCamera)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
tdxHandleToViewportManagement hViewport;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
hViewport = CAM_fn_p_stGetViewPortManagement(_lViewportNumber);
hViewport->hCamera = _hCamera;
hViewport->bValid = TRUE;
}
/*
*=================================================================================================
* Reinitialization of camera's lists
*=================================================================================================
*/
void CAM_fn_vReInitCameras(void)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
long i;
tdstNodeCamera *p_stTempNodeCamera;
tdstNodeCamera *p_stNextNodeCamera;
HIE_tdxHandleToSuperObject hSuperObject ;
tdxHandleToViewportManagement hViewport;
MS_tdxHandleToInternalCineinfo hIntCineinfo;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* Some inits */
for (i = 1; i <= CAM_Nb_Viewport; i++)
{
hViewport = CAM_fn_p_stGetViewPortManagement(i);
hViewport->hTempCamera = NULL;
hViewport->bValid = FALSE;
}
LST2_M_DynamicForEachMovingElementOf(&g_stEngineStructure.hCameraList,p_stTempNodeCamera, p_stNextNodeCamera, i)
{
if (p_stTempNodeCamera != NULL)
{
/* Search the SuperObject with HIE_C_ulActor type */
hSuperObject=p_stTempNodeCamera->p_stSuperObjectCamera;
hIntCineinfo = M_GetCineinfo(hSuperObject,Init);
if
(
(hIntCineinfo -> bIsActive)
&& (hIntCineinfo -> eTypeOfViewport != CAM_e_NoViewport)
)
{
CAM_fn_vAssignCameraToAViewport
(
hIntCineinfo -> eTypeOfViewport,
hSuperObject
);
}
}
}
}
/*
*=================================================================================================
* Initialization of camera's lists
*=================================================================================================
*/
extern void CAM_fn_vLoadCameraConstants(void);
void CAM_fn_vInitCameras(void)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
long lSize;
long i;
tdxHandleToViewportManagement hViewport;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* Allocation */
lSize = sizeof(struct tdstViewportManagement_) * CAM_Nb_Viewport;
MMG_fn_vAddMemoryInfo( MMG_C_lTypeGAM , MMG_C_lSubTypeViewPortArray , 0 );
g_stEngineStructure.a_hViewportArray = (tdxHandleToViewportManagement)M_p_GameMallocInHLM(lSize);
CAM_fn_vReInitCameras();
for (i = 1; i <= CAM_Nb_Viewport; i++)
{
hViewport = CAM_fn_p_stGetViewPortManagement(i);
GLI_xCreateCamera(&hViewport->p_stCamera,GLI_C_lPersCamWithoutDistorsion);
/*GLI_xSetCameraAspectAndRatio(hViewport->p_stCamera, MTH_M_xFloatToReal(1.5f), MTH_C_ONE);*/
GLI_xSetCameraAspectAndRatio(hViewport->p_stCamera, MTH_M_xFloatToReal(1.5f), MTH_M_xFloatToReal(0.75f));
}
CAM_fn_vLoadCameraConstants();
}
/*
*=================================================================================================
* Test if the super object is a camera
*=================================================================================================
*/
ACP_tdxBool CAM_fn_bSuperObjectIsACamera(HIE_tdxHandleToSuperObject _h_SprObj)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
MS_tdxHandleToCineinfo h_Cineinfo;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
if(HIE_fn_ulGetSuperObjectType(_h_SprObj) != HIE_C_ulActor)
return FALSE;
else
{
h_Cineinfo = M_GetMSHandle(_h_SprObj,Cineinfo);
if ((struct tdstCineinfo_ *) h_Cineinfo == NULL)
return FALSE;
else
return TRUE;
}
}
/*
*=================================================================================================
* Actualize a viewport
*=================================================================================================
*/
void CAM_fn_vActualizeAViewport(long _lViewport)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
tdxHandleToViewportManagement hViewport;
struct GLI_tdstCamera_ *p_Camera;
POS_tdstCompletePosition stMatrix;
MTH_tdxReal xAngle,xRatio, xFocal;
MTH3D_tdstVector I,J,K;
POS_tdstCompletePosition *p_stCamera;
HIE_tdxHandleToSuperObject hCamera;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
hViewport = CAM_fn_p_stGetViewPortManagement(_lViewport);
hCamera = hViewport->hCamera;
p_stCamera = HIE_fn_hGetSuperObjectGlobalMatrix(hCamera);
POS_fn_vGetRotationMatrix( p_stCamera, &I, &J, &K );
/* POS_fn_vSetType(&stMatrix, POS_C_xCompletePosition);*/
POS_fn_vCopyMatrix( &stMatrix, p_stCamera );
MTH3D_M_vNegVector( &J, &J );
POS_fn_vSetRotationMatrix( &stMatrix, &I, &K, &J );
POS_fn_vInvertIsoMatrix( &stMatrix, &stMatrix );
#if defined(WIN32)
WaitForSingleObject(g_stEngineStructure.hDrawSem, INFINITE);
#endif /*WIN32*/
p_Camera = hViewport->p_stCamera;
GLI_xSetCameraMatrix(p_Camera, &stMatrix);
GLI_xGetCameraAspectAndRatio(p_Camera, &xAngle, &xRatio);
xFocal = M_GetMSHandle(hCamera, Cineinfo)->hWork->xFocal;
if (MTH_M_bIsNull(xFocal))
xFocal = M_GetMSHandle(hCamera, Cineinfo)->hCurrent->xFocal;
if (!MTH_M_bEqual(xFocal, xAngle))
{
GLI_xSetCameraAspectAndRatio(p_Camera, xFocal, xRatio);
/* XB 23/06/99 */
#ifndef U64
GLI_xSetViewportCamera(g_stEngineStructure.hGLDDevice, g_stEngineStructure.hGLDViewport, p_Camera);
GLI_xAdjustCameraToViewport(g_stEngineStructure.hGLDDevice, g_stEngineStructure.hGLDViewport, p_Camera);
#else /* U64 */
GLI_xSetViewportCamera(NULL, NULL, p_Camera);
GLI_xAdjustCameraToViewport(NULL, NULL, p_Camera);
#endif /* U64 */
/* End XB 23/06/99 */
}
else
/* XB 23/06/99 */
#ifndef U64
GLI_xSetViewportCamera(g_stEngineStructure.hGLDDevice, g_stEngineStructure.hGLDViewport, p_Camera);
#else /* U64 */
GLI_xSetViewportCamera(NULL, NULL, p_Camera);
#endif /* U64 */
/* End XB 23/06/99 */
#if defined(WIN32)
ReleaseSemaphore(g_stEngineStructure.hDrawSem,1,NULL);
#endif /*WIN32*/
}
/*
*=================================================================================================
* Management of all cameras in the game
*=================================================================================================
*/
void CAM_fn_vCameraManagement(void)
{
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
tdxHandleToNodeCamera p_stNodeCamera;
long i;
tdxHandleToViewportManagement hViewport;
HIE_tdxHandleToSuperObject hCamera;
MS_tdxHandleToInternalCineinfo hIntCineinfo;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/*
* Treat each camera.
*/
/* ANNECY AV DEMO {*/
#ifndef U64
if(g_DEMO_KeybTest != DEMO_PLAY)
#endif
/* END ANNECY AV }*/
{
LST2_M_DynamicForEachElementOf(&g_stEngineStructure.hCameraList, p_stNodeCamera, i)
{
if (p_stNodeCamera != NULL)
{
hCamera = p_stNodeCamera->p_stSuperObjectCamera;
if(M_GetMSHandle(hCamera, Cineinfo)->ucVolIAFlags & C_VolIAFlags_CurrentAlreadyCopiedInWork)
{
hIntCineinfo = M_GetCineinfo(hCamera, Work);
}
else
{
hIntCineinfo = M_GetCineinfo(hCamera, Current);
}
if((hIntCineinfo->bIsActive) || (hIntCineinfo->eTypeOfViewport != CAM_e_NoViewport))
{
if(hIntCineinfo->eTypeOfViewport != CAM_e_NoViewport)
fn_vTreatCameraHierarchy(p_stNodeCamera->p_stSuperObjectCamera, TRUE);
else
fn_vTreatCameraHierarchy(p_stNodeCamera->p_stSuperObjectCamera, FALSE);
}
}
}
}
/*
* Actualise all viewports.
*/
for(i = CAM_Nb_Viewport; i > 0; i--)
{
hViewport = CAM_fn_p_stGetViewPortManagement(i);
if(hViewport->bValid)
CAM_fn_vActualizeAViewport(i);
}
}
/*
*=================================================================================================
* Display camera parameters
*=================================================================================================
*/
#if !defined(PRESS_DEMO)
void CAM_vDisplayInfo(void)
{
#ifndef RETAIL
#ifndef U64
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
MS_tdxHandleToDynam h_Dynam = NULL;
DNM_tdstDynamics *p_stDynamics = NULL;
DNM_tdstReport *p_stReport = NULL;
MTH_tdxReal xNorm;
MTH3D_tdstVector stShifting;
unsigned char szLine[100];
long lX;
long lY;
MTH3D_tdstVector *p_stTarget;
HIE_tdxHandleToSuperObject pSuperObjectCamera;
MS_tdxHandleToCineinfo hCineInfo;
MS_tdxHandleToInternalCineinfo hWorkCI;
MTH3D_tdstVector stSightAxis;
MTH3D_tdstVector stFirstComplementaryAxis;
MTH3D_tdstVector stSecondComplementaryAxis;
MTH3D_tdstVector stTempVector, stTempVector1, stTempVector2;
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
pSuperObjectCamera = CAM_fn_hGetActiveCamera(CAM_e_MainViewport);
hCineInfo = M_GetMSHandle(pSuperObjectCamera, Cineinfo);
h_Dynam = M_GetMSHandle(pSuperObjectCamera, Dynam);
if(h_Dynam)
p_stDynamics = fn_p_stDynamGetDynamics(h_Dynam);
if(p_stDynamics)
p_stReport = DNM_M_p_stDynamicsGetReport(p_stDynamics);
if (!(hCineInfo->ucPerIAFlags & C_PerIAFlags_ShowInfo))
return;
hWorkCI = hCineInfo->hWork;
lX = 320;
lY = 0;
p_stTarget = &hWorkCI->stShiftTarget;
sprintf ((char *) szLine, "ShiftTgt<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%.2f<EFBFBD>%.2f<EFBFBD>%.2f", p_stTarget->xX, p_stTarget->xY, p_stTarget->xZ);
GLI_vDisplayPolices(szLine, lX , lY);
lY += 16;
p_stTarget = &hWorkCI->stShiftPos;
sprintf ((char *) szLine, "ShiftPos<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%.2f<EFBFBD>%.2f<EFBFBD>%.2f", p_stTarget->xX, p_stTarget->xY, p_stTarget->xZ);
GLI_vDisplayPolices(szLine, lX , lY);
lY += 16;
sprintf((char *) szLine, "Distance<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%.2f<EFBFBD>%.2f<EFBFBD>%.2f<EFBFBD>%.2f", hWorkCI->xDistMin, hWorkCI->xDistMax, hWorkCI->xBoundDistMin, hWorkCI->xBoundDistMax);
GLI_vDisplayPolices(szLine, lX , lY);
lY += 16;
sprintf ((char *) szLine, "Alpha<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%.2f<EFBFBD>%.2f", hWorkCI->xAngleAlpha, hWorkCI->xAngleShiftAlpha);
GLI_vDisplayPolices(szLine, lX , lY);
lY += 16;
sprintf ((char *) szLine, "Theta<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%.2f<EFBFBD>%.2f", hWorkCI->xAngleTheta, hWorkCI->xAngleShiftTheta);
GLI_vDisplayPolices( szLine, lX , lY);
lY += 16;
sprintf ((char *) szLine, "ZMinMax<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%.2f<EFBFBD>%.2f", hWorkCI->xZMin, hWorkCI->xZMax);
GLI_vDisplayPolices( szLine, lX , lY);
lY += 16;
/* Sight axis of targeted perso */
if(hWorkCI->hSuperObjectTargeted)
{
fn_vGetPersoSightAxisSystem
(
hCineInfo,
&stSightAxis,
&stFirstComplementaryAxis,
&stSecondComplementaryAxis
);
sprintf((char *) szLine, "Sight<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%.2f<EFBFBD>%.2f<EFBFBD>%.2f", stSightAxis.xX, stSightAxis.xY, stSightAxis.xZ);
GLI_vDisplayPolices(szLine, lX , lY);
lY += 16;
}
/* Delta T */
sprintf((char *) szLine, "DeltaT<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%.4f", M_xGetUsefulDeltaTimeInSeconds(g_stEngineStructure.stEngineTimer));
GLI_vDisplayPolices(szLine, lX , lY);
lY += 16;
/* Real move camera */
if(p_stReport != NULL)
{
MTH3D_M_vCopyVector(&stShifting, DNM_M_p_stReportGetLastMove(p_stReport));
xNorm = MTH3D_M_xNormVector(&stShifting);
sprintf((char *) szLine, "RealMove<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%.4f", xNorm);
GLI_vDisplayPolices(szLine, lX , lY);
lY += 16;
}
/* Distance to target */
if(hWorkCI->hSuperObjectTargeted)
{
if (hWorkCI->hSuperObjectTargeted)
{
POS_fn_vGetTranslationVector
(
HIE_fn_hGetSuperObjectGlobalMatrix(pSuperObjectCamera),
&stTempVector1
);
CAM_fn_vAveragePosition(hCineInfo, CAM_g_stCameraConstants.xAverageForComputePos, &stTempVector);
POS_fn_vGetTranslationVector
(
HIE_fn_hGetSuperObjectGlobalMatrix(hWorkCI->hSuperObjectTargeted),
&stTempVector2
);
MTH3D_M_vSubVector(&stTempVector, &stTempVector, &stTempVector1);
MTH3D_M_vSubVector(&stTempVector2, &stTempVector2, &stTempVector1);
sprintf((char *) szLine, "DAver<EFBFBD>DReal<EFBFBD><EFBFBD>%.2f %.2f", MTH3D_M_xNormVector(&stTempVector), MTH3D_M_xNormVector(&stTempVector2));
}
GLI_vDisplayPolices(szLine, lX , lY);
lY += 16;
}
#endif /*!U64*/
#endif /*!RETAIL*/
}
#endif /* PRESS_DEMO */

View File

@@ -0,0 +1,220 @@
/* FM970130 : Matrix tool*/
/*=========================================================================
* ToolMatr.c : This module contain simple used functions
* This is a part of the Game project.
*
* It contains adding function concerning the matrix management
*
* Version 1.0
* Creation date 30/01/97
* Author Fabien MORALES
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1996
*=======================================================================*/
#include "ToolsCPA.h"
#include "Actions\AllActs.h"
#include "ToolMatr.h"
#include "TypeCam.h"
#define CAM_C_xAngleEpsilon ((MTH_tdxReal)1E-4)
/********************************************/
/* Operations on Rotation-Matrices */
/********************************************/
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Description: fn_vSetRotationMatrixX*/
/* Set the absolute angle of rotation (X axis) for a super perso matrix*/
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Methods: */
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Input: POS_tdstCompletePosition *p_stMatrix : super perso matrix*/
/* GLI_tdxValue xAngle*/
/* Output: void*/
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Creation date: Jan.30, 1997 Author: Fabien MORALES*/
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Modifications: */
/* Modification date: Modification Author: Fabien MORALES*/
/*/////////////////////////////////////////////////////////////////////////////////*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vSetRotationMatrixX ( POS_tdstCompletePosition *p_stMatrix ,
GLI_tdxValue xAngle )
{
MTH3D_tdstVector I,J,K;
/* compute the modified angle*/
/* x axis is (-y) axis*/
/* to do...*/
MTH3D_M_vSetVectorElements(&I,MTH_C_ONE,MTH_C_ZERO,MTH_C_ZERO);
MTH3D_M_vSetVectorElements(&J,MTH_C_ZERO,MTH_M_xCos(xAngle),MTH_M_xSin(xAngle));
MTH3D_M_vSetVectorElements(&K,MTH_C_ZERO,MTH_M_xNeg(MTH_M_xSin(xAngle)),MTH_M_xCos(xAngle));
POS_fn_vSetRotationMatrix( p_stMatrix ,&I,&J,&K) ;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Description: fn_vSetRotationMatrixY*/
/* Set the absolute angle of rotation (Y axis) for a superperso matrix*/
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Methods: */
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Input: POS_tdstCompletePosition *p_stMatrix : super perso matrix*/
/* GLI_tdxValue xAngle*/
/* Output: void*/
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Creation date: Jan.30, 1997 Author: Fabien MORALES*/
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Modifications: */
/* Modification date: Modification Author: Fabien MORALES*/
/*/////////////////////////////////////////////////////////////////////////////////*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vSetRotationMatrixY ( POS_tdstCompletePosition *p_stMatrix ,
GLI_tdxValue xAngle )
{
MTH3D_tdstVector I,J,K;
/* compute the modified angle*/
/* x axis is (-y) axis*/
/* to do...*/
MTH3D_M_vSetVectorElements(&I,MTH_M_xCos(xAngle),MTH_C_ZERO,MTH_M_xNeg(MTH_M_xSin(xAngle)));
MTH3D_M_vSetVectorElements(&J,MTH_C_ZERO,MTH_C_ONE,MTH_C_ZERO);
MTH3D_M_vSetVectorElements(&K,MTH_M_xSin(xAngle),MTH_C_ZERO,MTH_M_xCos(xAngle));
POS_fn_vSetRotationMatrix( p_stMatrix ,&I,&J,&K) ;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Description: fn_vSetRotationMatrixZ*/
/* Set the absolute angle of rotation (Z axis) for a superperso matrix*/
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Methods: */
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Input: POS_tdstCompletePosition *p_stMatrix : super perso matrix*/
/* GLI_tdxValue xAngle*/
/* Output: void*/
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Creation date: Jan.30, 1997 Author: Fabien MORALES*/
/*/////////////////////////////////////////////////////////////////////////////////*/
/* Modifications: */
/* Modification date: Modification Author: Fabien MORALES*/
/*/////////////////////////////////////////////////////////////////////////////////*/
void fn_vSetRotationMatrixZ ( POS_tdstCompletePosition *p_stMatrix ,
GLI_tdxValue xAngle )
{
MTH3D_tdstVector I,J,K;
GLI_tdxValue xModifiedAngle;
/* x axis is (-y) axis*/
xModifiedAngle= MTH_M_xAdd(xAngle,MTH_C_PiBy2);
MTH3D_M_vSetVectorElements(&I,MTH_M_xCos(xModifiedAngle),MTH_M_xSin(xModifiedAngle),MTH_C_ZERO);
MTH3D_M_vSetVectorElements(&J,MTH_M_xNeg(MTH_M_xSin(xModifiedAngle)),MTH_M_xCos(xModifiedAngle),MTH_C_ZERO);
MTH3D_M_vSetVectorElements(&K,MTH_C_ZERO,MTH_C_ZERO,MTH_C_ONE);
POS_fn_vSetRotationMatrix( p_stMatrix ,&I,&J,&K) ;
}
/*
*=====================================================================================================
* Set the absolute angle of rotation (X axis) for a super perso matrix
*=====================================================================================================
*/
void fn_vTurnMatrixX(POS_tdstCompletePosition *_p_stMatrix, MTH_tdxReal _xAngle)
{
POS_tdstCompletePosition TmpMatrix;
MTH3D_tdstVector I,J,K;
MTH_tdxReal xCos,xSin;
POS_fn_vSetIdentityMatrix ( &TmpMatrix ) ;
xCos = MTH_M_xCos(_xAngle);
xSin = MTH_M_xSin(_xAngle);
if (MTH_M_bIsNullWithEpsilon(xCos,CAM_C_xAngleEpsilon))
xCos = MTH_C_ZERO;
if (MTH_M_bIsNullWithEpsilon(xSin,CAM_C_xAngleEpsilon))
xSin= MTH_C_ZERO;
MTH3D_M_vSetBaseIVector(&I);
MTH3D_M_vSetVectorElements(&J,MTH_C_ZERO,xCos,xSin);
MTH3D_M_vSetVectorElements(&K,MTH_C_ZERO,MTH_M_xNeg(xSin),xCos);
POS_fn_vSetRotationMatrix ( &TmpMatrix ,&I,&J,&K) ;
POS_fn_vMulMatrixMatrix (_p_stMatrix,&TmpMatrix,_p_stMatrix);
}
/*
*=====================================================================================================
* Set the absolute angle of rotation (Y axis) for a super perso matrix
*
*=====================================================================================================
*/
void fn_vTurnMatrixY
(
POS_tdstCompletePosition *_p_stMatrix ,
MTH_tdxReal _xAngle
)
{
POS_tdstCompletePosition TmpMatrix;
MTH3D_tdstVector I,J,K;
MTH_tdxReal xCos,xSin;
POS_fn_vSetIdentityMatrix ( &TmpMatrix ) ;
xCos = MTH_M_xCos(_xAngle);
xSin = MTH_M_xSin(_xAngle);
if (MTH_M_bIsNullWithEpsilon(xCos,CAM_C_xAngleEpsilon))
xCos = MTH_C_ZERO;
if (MTH_M_bIsNullWithEpsilon(xSin,CAM_C_xAngleEpsilon))
xSin= MTH_C_ZERO;
MTH3D_M_vSetVectorElements(&I,xCos,MTH_C_ZERO,MTH_M_xNeg(xSin));
MTH3D_M_vSetBaseJVector(&J);
MTH3D_M_vSetVectorElements(&K,xSin,MTH_C_ZERO,xCos);
POS_fn_vSetRotationMatrix ( &TmpMatrix ,&I,&J,&K) ;
POS_fn_vMulMatrixMatrix (_p_stMatrix,&TmpMatrix,_p_stMatrix) ;
}
/*
*=====================================================================================================
* Set the absolute angle of rotation (Z axis) for a super perso matrix
*
*=====================================================================================================
*/
void fn_vTurnMatrixZ
(
POS_tdstCompletePosition *_p_stMatrix ,
MTH_tdxReal _xAngle
)
{
POS_tdstCompletePosition TmpMatrix;
MTH3D_tdstVector I,J,K;
MTH_tdxReal xCos,xSin;
POS_fn_vSetIdentityMatrix ( &TmpMatrix ) ;
xCos = MTH_M_xCos(_xAngle);
xSin = MTH_M_xSin(_xAngle);
if (MTH_M_bIsNullWithEpsilon(xCos,CAM_C_xAngleEpsilon))
xCos = MTH_C_ZERO;
if (MTH_M_bIsNullWithEpsilon(xSin,CAM_C_xAngleEpsilon))
xSin= MTH_C_ZERO;
MTH3D_M_vSetVectorElements(&I,xCos,xSin,MTH_C_ZERO);
MTH3D_M_vSetVectorElements(&J,MTH_M_xNeg(xSin),xCos,MTH_C_ZERO);
MTH3D_M_vSetBaseKVector(&K);
POS_fn_vSetRotationMatrix ( &TmpMatrix ,&I,&J,&K) ;
POS_fn_vMulMatrixMatrix (_p_stMatrix,&TmpMatrix,_p_stMatrix) ;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,668 @@
/*=========================================================================
* Memory.h : Contain the memory's functions.
* (based on CAP memory (see Pierrick))
* This is a part of the Game project.
*
* To use memory, use M_p_GameMalloc and M_GameFree macros
*
* Version 1.0
* Creation date 30/08/96
* Revision date
*
* That file needs to be compatible for all platforms.
*
* (c) Ubi Studios 1996
*=======================================================================*/
/*#define GAM_D_DebugMalloc*/
/*#define GAM_D_DebugStatistic*/
#include "ToolsCPA.h"
#include "Structur/ErrGame.h"
#include "Structur/MemGame.h"
#include "Structur/GameScpt.h"
#include "Structur/EngMode.h"
#include "Options/ActBlMal.h"
#include "LSMem.h"
#include "Basic.h"
#include "ZeMem.h"
/* XB 05/05/99 */
#include "TEX.H"
extern void INO_PrintUsedStaticMemory(void);
/* End XB 05/05/99 */
#ifdef GAM_USE_SNA
#include "sna.h"
#endif /* GAM_USE_SNA */
/*XB980825*/
#ifdef U64
extern unsigned long g_ulTotalMemoryUsed;
extern unsigned long g_ulTotalMemoryAllocated;
#endif /* U64 */
/*End XB*/
/**************************************************************************/
void fn_vFirstInitGameMemory(void)
{
/**** Check the ACP memory module ****/
Mmg_M_InitMmg(Game);
Mmg_fn_cCheckAlignmentValidity();
}
/**************************************************************************/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC 04/06/99 */
void fn_vLastDesinitGameMemory(void)
{
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC 04/06/99 */
/**************************************************************************/
void GAM_fn_vSetGameMemoryInFix(void)
{
GAM_g_ucHLMMemoryBlock = (unsigned char)E_ucGameFixMemory;
}
/**************************************************************************/
void GAM_fn_vSetGameMemoryInLevel(void)
{
GAM_g_ucHLMMemoryBlock = (unsigned char)E_ucGameLevelMemory;
}
/**************************************************************************/
#if defined (GAM_D_DebugMalloc)
/*unsigned long g_ulNumberOfAllocation;*/
#endif /* GAM_D_DebugMalloc */
#define GAM_C_NumberOfSource 200
#if defined(_DEBUG)&&(defined(GAM_D_DebugStatistic)||defined(GAM_D_DebugMalloc))
unsigned long GAM_g_ulNumberOfAllocation = 0;
#endif /* _DEBUG&&(GAM_D_DebugStatistic||GAM_D_DebugMalloc) */
#if defined(_DEBUG)&&defined(GAM_D_DebugStatistic)
unsigned long GAM_g_ulMaxSources = 0;
struct GAM_tdstAllocInformation_
{
char szSourceName[_MAX_PATH];
unsigned long ulSourceLine;
unsigned short usSourceBloc;
unsigned long ulSourceSize;
unsigned long ulSourceNumberOfAlloc;
unsigned long ulSourceNumberOfRealloc;
unsigned long ulSourceNumberOfFree;
} GAM_g_a_stAllocInformation[GAM_C_NumberOfSource];
#endif /*_DEBUG&&GAM_D_DebugStatistic*/
void GAM_fn_vMemoryLogFile(void *p_vPointer,unsigned char ucAction,char *szFile,unsigned long ulLine,unsigned long ulSize)
{
#if defined(_DEBUG)&&(defined(GAM_D_DebugStatistic)||defined(GAM_D_DebugMalloc))
/* static unsigned long GAM_s_ulNumberOfAllocation = 0;*/
unsigned short uwBlocId;
void *p_vBeginBloc;
#endif /* _DEBUG&&(GAM_D_DebugStatistic||GAM_D_DebugMalloc) */
#if defined(_DEBUG)&&defined(GAM_D_DebugStatistic)
unsigned long i;
#endif /*_DEBUG&&GAM_D_DebugStatistic*/
#if defined(_DEBUG)&& defined(GAM_D_DebugMalloc)
/* static unsigned long AI_s_ulNumberOfAllocation = 0;*/
FILE *p_stFile;
char szFileName[30];
#endif /* _DEBUG && GAM_D_DebugMalloc */
#if defined(_DEBUG)&&(defined(GAM_D_DebugStatistic)||defined(GAM_D_DebugMalloc))
Mmg_fn_vWhereIs((void*)p_vPointer,&uwBlocId,&p_vBeginBloc);
if (ucAction==GAM_C_ActionMalloc)
GAM_g_ulNumberOfAllocation++;
else if (ucAction==GAM_C_ActionFree)
GAM_g_ulNumberOfAllocation--;
#endif /* _DEBUG&&(GAM_D_DebugStatistic||GAM_D_DebugMalloc) */
#if defined(_DEBUG)&&defined(GAM_D_DebugStatistic)
for (i=0;i<GAM_g_ulMaxSources&&(stricmp(szFile,GAM_g_a_stAllocInformation[i].szSourceName)||GAM_g_a_stAllocInformation[i].ulSourceLine!=ulLine||GAM_g_a_stAllocInformation[i].usSourceBloc!=uwBlocId);i++);
if (i==GAM_g_ulMaxSources)
{
strcpy(GAM_g_a_stAllocInformation[i].szSourceName,szFile);
GAM_g_a_stAllocInformation[i].ulSourceLine=ulLine;
GAM_g_a_stAllocInformation[i].usSourceBloc = uwBlocId;
GAM_g_a_stAllocInformation[i].ulSourceSize=0;
GAM_g_a_stAllocInformation[i].ulSourceNumberOfAlloc=0;
GAM_g_a_stAllocInformation[i].ulSourceNumberOfRealloc=0;
GAM_g_a_stAllocInformation[i].ulSourceNumberOfFree=0;
GAM_g_ulMaxSources++;
if (GAM_g_ulMaxSources>=GAM_C_NumberOfSource)
M_GameFatalError(E_uwGameIncreaseNumberOfSource);
}
if (ucAction==GAM_C_ActionMalloc)
{
GAM_g_a_stAllocInformation[i].ulSourceSize+=ulSize;
GAM_g_a_stAllocInformation[i].ulSourceNumberOfAlloc++;
}
else if (ucAction==GAM_C_ActionRealloc)
{
GAM_g_a_stAllocInformation[i].ulSourceSize+=ulSize;
GAM_g_a_stAllocInformation[i].ulSourceNumberOfRealloc++;
}
else if (ucAction==GAM_C_ActionFree)
{
GAM_g_a_stAllocInformation[i].ulSourceNumberOfFree++;
}
#endif /*_DEBUG&&GAM_D_DebugStatistic*/
#if defined(_DEBUG)&&defined(GAM_D_DebugMalloc)
sprintf(szFileName,"Mem%04x.log",uwBlocId);
if ((p_stFile = fopen(szFileName,"rt"))!=NULL)
fclose(p_stFile);
else
GAM_g_ulNumberOfAllocation = 0;
p_stFile = fopen(szFileName,"at");
if (p_stFile!=NULL)
{
if (ucAction==GAM_C_ActionMalloc)
fprintf(p_stFile,"Malloc : Number=#%010d, Block=#%04x, Offset=%p (%20s,%10d)\n",GAM_g_ulNumberOfAllocation,uwBlocId,(long)p_vPointer-(long)p_vBeginBloc,szFile,ulLine);
else if (ucAction==GAM_C_ActionRealloc)
fprintf(p_stFile,"Realloc : Number=#%010d, Block=#%04x, Offset=%p (%20s,%10d)\n",GAM_g_ulNumberOfAllocation,uwBlocId,(long)p_vPointer-(long)p_vBeginBloc,szFile,ulLine);
else if (ucAction==GAM_C_ActionFree)
fprintf(p_stFile,"Free : Number=#%010d, Block=#%04x, Offset=%p (%20s,%10d)\n",GAM_g_ulNumberOfAllocation,uwBlocId,(long)p_vPointer-(long)p_vBeginBloc,szFile,ulLine);
fclose(p_stFile);
}
#endif /* _DEBUG && GAM_D_DebugMalloc */
}
/**************************************************************************/
#ifndef _FIRE_DEADCODE_U64_
int GAM_fn_vMemorySort(const void *elem1, const void *elem2)
{
#if defined(_DEBUG)&&defined(GAM_D_DebugStatistic)
return(((struct GAM_tdstAllocInformation_*)elem2)->ulSourceSize-((struct GAM_tdstAllocInformation_*)elem1)->ulSourceSize);
#else
return(0);
#endif /*_DEBUG&&GAM_D_DebugStatistic*/
}
/**************************************************************************/
void GAM_fn_vPrintMemoryInformation(void)
{
#if defined(_DEBUG)&&defined(GAM_D_DebugStatistic)
FILE *p_stFile;
unsigned long i;
qsort(GAM_g_a_stAllocInformation,GAM_g_ulMaxSources, sizeof(struct GAM_tdstAllocInformation_),GAM_fn_vMemorySort);
if ((p_stFile = fopen("GamMemInfo.log","wt"))!=NULL)
{
for (i=0;i<GAM_g_ulMaxSources;i++)
{
fprintf(p_stFile,"%s (line %d, bloc %04x) :\n",GAM_g_a_stAllocInformation[i].szSourceName,GAM_g_a_stAllocInformation[i].ulSourceLine,GAM_g_a_stAllocInformation[i].usSourceBloc);
fprintf(p_stFile," Number of allocations : %d\n",GAM_g_a_stAllocInformation[i].ulSourceNumberOfAlloc);
fprintf(p_stFile," Number of reallocations : %d\n",GAM_g_a_stAllocInformation[i].ulSourceNumberOfRealloc);
fprintf(p_stFile," Number of free : %d\n",GAM_g_a_stAllocInformation[i].ulSourceNumberOfFree);
fprintf(p_stFile," Total size of allocation : %d\n",GAM_g_a_stAllocInformation[i].ulSourceSize);
}
fprintf(p_stFile,"\nTotal number of allocation : %d\n",GAM_g_ulNumberOfAllocation);
}
fclose(p_stFile);
#endif /*_DEBUG&&GEO_D_DebugStatistic*/
}
#endif /* _FIRE_DEADCODE_U64_ */
/**************************************************************************/
#ifndef RETAIL
void *fnp_vGameDebugMallocInHLM(unsigned long ulSize,char *szFile,unsigned long ulLine)
{
void *Var;
Var = fnp_vGameMallocInHLM(ulSize);
GAM_fn_vMemoryLogFile(Var,GAM_C_ActionMalloc,szFile,ulLine,ulSize);
return(Var);
}
#endif
/**************************************************************************/
void *fnp_vGameMallocInHLM(unsigned long ulSize)
{
void *p_vPointer = NULL;
#if defined(_DEBUG)
static unsigned char HLM_ucDynamicAlloc = FALSE;
#endif
/**** Check parameters ****/
if (ulSize==0)
{
M_GameFatalError(E_uwGameGameMallocBadSize);
}
if (GAM_g_ucHLMMemoryBlock<E_ucFirstMemoryBlock||GAM_g_ucHLMMemoryBlock>E_ucLastMemoryBlock)
{
M_GameFatalError(E_uwGameGameMallocBadBlock);
}
Mmg_M_SetModeAlloc4Ch(Game,(unsigned char)GAM_g_ucHLMMemoryBlock,C_ucMmgDefaultChannel);
#if defined(U64) && !defined(FINAL_VERSION)
g_ucModuleIdForDebug=2;
#endif
#if defined(_DEBUG)
if (HLM_ucDynamicAlloc||(p_vPointer = Mmg_fn_p_vAlloc4Ch(ulSize,C_ucMmgDefaultChannel))==NULL)
{
if (!HLM_ucDynamicAlloc)
{
Erm_M_ClearLastError(C_ucErmDefaultChannel);
M_GameWarningError(E_uwGameDebugDynamicAllocation);
Erm_M_ClearLastError(C_ucErmDefaultChannel);
HLM_ucDynamicAlloc = TRUE;
}
Mmg_M_SetModeAlloc4Ch(Game,E_ucDynamic,C_ucMmgDefaultChannel);
if ((p_vPointer = Mmg_fn_p_vAlloc4Ch(ulSize,C_ucMmgDefaultChannel))==NULL)
{
M_GameFatalError(E_uwGameGameMallocAlloc);
}
}
#else /* _DEBUG */
if( (p_vPointer = Mmg_fn_p_vAlloc4Ch(ulSize,C_ucMmgDefaultChannel)) == NULL )
M_GameFatalError(E_uwGameGameMallocAlloc);
#endif /* _DEBUG */
#if defined(U64) && !defined(FINAL_VERSION)
g_ucModuleIdForDebug=0xff;
#endif
memset(p_vPointer,0,ulSize);
return (p_vPointer);
}
/**************************************************************************/
void fn_vGameFreeInHLM(void *p_vPointer)
{
#if defined(_DEBUG)
struct tdstBlockInfo_ stMyBlockInfo;
#endif /* _DEBUG */
if (p_vPointer==NULL)
{
M_GameInformationError(E_uwGameGameFreeNullPointer);
/*ANNECY CT 20/02/98{*/
return;
/*ENDANNECY CT}*/
}
#if defined(_DEBUG)
/* Mmg_fn_vTestMallocIntegrityAt(p_vPointer);*/
#endif /*_DEBUG*/
Mmg_M_SetModeAlloc4Ch(Game,(unsigned char)GAM_g_ucHLMMemoryBlock,C_ucMmgDefaultChannel);
#if defined(_DEBUG)
Mmg_fn_vGiveInformationBlock(Erm_M_ucGiveModuleId(Game),(unsigned char)GAM_g_ucHLMMemoryBlock,&stMyBlockInfo);
if (p_vPointer<(void*)stMyBlockInfo.p_cBeginBlock||p_vPointer>(void*)stMyBlockInfo.p_cEndBlock)
Mmg_M_SetModeAlloc4Ch(Game,E_ucDynamic,C_ucMmgDefaultChannel);
#endif /* _DEBUG */
Mmg_fn_vFree4Ch(p_vPointer,C_ucMmgDefaultChannel);
}
/**************************************************************************/
#ifndef _FIRE_DEADCODE_U64_
void fn_vFreeFixAllowedMemory(void)
{
unsigned char i;
for (i=E_ucFirstFixMemoryBlock;i<=E_ucLastFixMemoryBlock;i++)
{
Mmg_M_FreeBlock(Game,i);
Mmg_M_DeleteBlock(Game,i);
}
GEO_xDeleteMemoryChannel(ACP_FixMemoryChannel);
fn_vFreeAIFixMemory();
fn_vDeleteAIFixMemory();
TMP_fn_vFreeFixMemory();
SAI_fn_vDeleteFixMemory();
}
#endif /* _FIRE_DEADCODE_U64_ */
/**************************************************************************/
extern void SAI_fn_vFreeLevelMemory();
void fn_vFreeLevelAllowedMemory(void)
{
unsigned char i;
/* XB 22/06/99 */
#ifndef U64
GLI_TEX_vKillMemoryChannel(ACP_LevelMemoryChannel);
#endif /* U64 */
/* End XB 22/06/99 */
#if !defined(U64)
if (SNA_fn_ucGetLoadType()==SNA_LOAD_SCRIPT)
{
#endif /* U64 */
for (i=E_ucFirstLevelMemoryBlock;i<=E_ucLastLevelMemoryBlock;i++)
{
Mmg_M_FreeBlock(Game,i);
Mmg_M_DeleteBlock(Game,i);
}
GEO_xDeleteMemoryChannel(ACP_LevelMemoryChannel);
#if defined(U64)
GEO_xDeleteMemoryChannel(ACP_U64_LevelMemoryChannel);
#endif /* U64 */
fn_vFreeAILevelMemory();
fn_vDeleteAILevelMemory();
/* Free level saved values list and delete SAI level memory block*/
SAI_fn_vDeleteLevelMemory();
#ifdef U64
//XB 21 April 1999
TMP_fn_vFreeLevelMemory();
#endif
//End XB
#if !defined(U64)
}
else if( SNA_fn_ucGetLoadType() == SNA_LOAD_SNAPSHOT )
{
/* Here, we free the list of saved value for the level WITHOUT deleting SAI level memory block.*/
SAI_fn_vFreeLevelMemory();
}
/*
else if (SNA_fn_ucGetLoadType()==SNA_LOAD_SNAPSHOT)
{
for (i=E_ucFirstLevelMemoryBlock;i<=E_ucLastLevelMemoryBlock;i++)
{
Mmg_M_FreeBlock(Game,i);
}
Mmg_M_FreeBlock(GEO,2);
fn_vFreeAILevelMemory();
}
*/
#endif /* U64 */
/* MR0310*/
/* else
{
for (i=E_ucFirstLevelMemoryBlock;i<=E_ucLastLevelMemoryBlock;i++)
{
if(i%2==1)
Mmg_M_DeleteBlock(Game,i);
}
}*/
GEO_xSelectMemoryChannel(ACP_FixMemoryChannel);
AI_fn_vAIUseFixMemory();
GAM_fn_vSetGameMemoryInFix();
}
/**************************************************************************/
void fn_vGameTestMemory(void)
{
/**** Test the integrity of all memory already allocated ****/
Mmg_fn_vTestMalloc();
}
/**************************************************************************/
#if !defined(RETAIL) || defined(FINAL_VERSION_FOR_TESTERS)
void GAM_PrintUsedStaticMemory(void)
{
Mmg_M_PrintUsedStaticMemoryInModule(Game);
}
#endif /* !defined(RETAIL) || defined(FINAL_VERSION_FOR_TESTERS) */
/**************************************************************************/
/*XB*/
#ifdef CHECK_MEMORY
void GAM_CheckMemory(void)
{
Mmg_M_CheckMemory(Game);
}
#endif /* CHECK_MEMORY */
/*End XB*/
/**************************************************************************/
/* XB 02/06/99 */
#ifndef FINAL_VERSION
unsigned long GAM_fn_ulGetUsedStaticMemory(void)
{
return Mmg_M_GetUsedStaticMemory(Game);
}
#endif /* FINAL_VERSION */
/* End XB 02/06/99 */
/**************************************************************************/
#if !defined(RETAIL) || defined(FINAL_VERSION_FOR_TESTERS)
void GAM_PrintAllUsedStaticMemory(void)
{
/* MR0310 (anti-bug...)*/
#if !defined(U64)
/* if (SNA_fn_ucGetLoadType()!=SNA_LOAD_SNAPSHOT)*/
{
AI_PrintUsedStaticMemory();
/*BIN_fn_vPrintUsedStaticMemory();*/
#ifndef U64
FON_PrintUsedStaticMemory();
#endif
GAM_PrintUsedStaticMemory();
GEO_PrintUsedStaticMemory();
GLD_PrintUsedStaticMemory();
IPT_PrintUsedStaticMemory();
/* FBF {*/
/* MNU_PrintUsedStaticMemory();*/
/* FBF }*/
POS_fn_vPrintUsedStaticMemory();
RND_PrintUsedStaticMemory();
SAI_PrintUsedStaticMemory();
Scr_PrintUsedStaticMemory();
SND_PrintUsedStaticMemory();
TMP_PrintUsedStaticMemory();
}
#else /* U64 */
g_ulTotalMemoryUsed=0;
g_ulTotalMemoryAllocated=0;
osSyncPrintf(("------------> GAM <------------\n"));
GAM_PrintUsedStaticMemory();
osSyncPrintf(("------------> GEO <------------\n"));
GEO_PrintUsedStaticMemory();
osSyncPrintf(("------------> AI <------------\n"));
AI_PrintUsedStaticMemory();
osSyncPrintf(("------------> INO <------------\n"));
INO_PrintUsedStaticMemory();
osSyncPrintf(("------------> IPT <------------\n"));
IPT_PrintUsedStaticMemory();
osSyncPrintf(("------------> FON <------------\n"));
FON_PrintUsedStaticMemory();
osSyncPrintf(("------------> SAI <------------\n"));
SAI_PrintUsedStaticMemory();
osSyncPrintf(("------------> RND <------------\n"));
RND_PrintUsedStaticMemory();
osSyncPrintf(("------------> TMP <------------\n"));
TMP_PrintUsedStaticMemory();
osSyncPrintf(("------------> SND <------------\n"));
SND_PrintUsedStaticMemory();
osSyncPrintf("--> Total = %ld bytes used / %ld bytes allocated (lost %ld bytes)\n",
g_ulTotalMemoryUsed,
g_ulTotalMemoryAllocated,
g_ulTotalMemoryAllocated-g_ulTotalMemoryUsed);
LDR_fn_vPrintMemoryMapping();
#endif /*U64 */
}
#endif /* !defined(RETAIL) || defined(FINAL_VERSION_FOR_TESTERS) */
/**************************************************************************/
#if !defined(U64) && !defined(RETAIL)
/* Modif GuS 08/08/98 : binarisation des scripts.*/
SCR_tde_Anl_ReturnValue fn_eScriptCallBackMemoryDescription(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;
static int iFirst=0;
static void *vTab[50];
static short wNbMalloc=0;
_p_stFile=_p_stFile;
if ( M_IsTitle )
if ( SNA_M_bTestSaveGameMemDesc() )
SNA_fn_vWriteNoParamEntryToCurrentDscFile( SNA_C_ul_MemoryDescTitle );
if (M_IsEntry)
{
if (M_ActionIs(C_Entry_GAM_FixMemory))
{
Mmg_M_InitBlock(Game,E_ucGameFixMemory,(unsigned long)fn_lAToI(_ap_szParams[0]));
GAM_fn_vSetGameMemoryInFix();
if ( SNA_M_bTestSaveGameMemDesc() )
SNA_fn_vWriteLongEntryToCurrentDscFile ( SNA_C_ul_GAMFixMemory, (unsigned long)fn_lAToI(_ap_szParams[0]) );
}
else if (M_ActionIs(C_Entry_GAM_LevelMemory))
{
if((iFirst<2)||(SNA_fn_ucGetLoadType()==SNA_LOAD_SCRIPT))
Mmg_M_InitBlock(Game,E_ucGameLevelMemory,(unsigned long)fn_lAToI(_ap_szParams[0]));
if(iFirst>0)
GAM_fn_vSetGameMemoryInLevel();
if ( SNA_M_bTestSaveGameMemDesc() )
SNA_fn_vWriteLongEntryToCurrentDscFile ( SNA_C_ul_GAMLevelMemory, (unsigned long)fn_lAToI(_ap_szParams[0]) );
}
else if (M_ActionIs(C_Entry_FontMemory))
{
M_CheckScriptParamNumber(1);
FON_fn_vFirstInitFONMemory((unsigned long)fn_lAToI(_ap_szParams[0]));
if ( SNA_M_bTestSaveGameMemDesc() )
SNA_fn_vWriteLongEntryToCurrentDscFile ( SNA_C_ul_FontMemory, (unsigned long)fn_lAToI(_ap_szParams[0]) );
}
else if (M_ActionIs(C_Entry_SAIFixMemory))
{
SAI_fn_vInitFixMemory((unsigned long)fn_lAToI(_ap_szParams[0]));
SAI_fn_vSAIUseFixMemory();
if ( SNA_M_bTestSaveGameMemDesc() )
SNA_fn_vWriteLongEntryToCurrentDscFile ( SNA_C_ul_SAIFixMemory, (unsigned long)fn_lAToI(_ap_szParams[0]) );
}
else if (M_ActionIs(C_Entry_SAILevelMemory))
{
SAI_fn_vInitLevelMemory((unsigned long)fn_lAToI(_ap_szParams[0]));
SAI_fn_vSAIUseLevelMemory();
if ( SNA_M_bTestSaveGameMemDesc() )
SNA_fn_vWriteLongEntryToCurrentDscFile ( SNA_C_ul_SAILevelMemory, (unsigned long)fn_lAToI(_ap_szParams[0]) );
}
else if (M_ActionIs(C_Entry_TMPFixMemory))
{
TMP_fn_vCreateFixMemory((unsigned long)fn_lAToI(_ap_szParams[0]));
if ( SNA_M_bTestSaveGameMemDesc() )
SNA_fn_vWriteLongEntryToCurrentDscFile ( SNA_C_ul_TMPFixMemory, (unsigned long)fn_lAToI(_ap_szParams[0]) );
}
else if (M_ActionIs(C_Entry_AIFixMemory))
{
fn_vInitAIFixMemory((unsigned long)fn_lAToI(_ap_szParams[0]));
AI_fn_vAIUseFixMemory();
if ( SNA_M_bTestSaveGameMemDesc() )
SNA_fn_vWriteLongEntryToCurrentDscFile ( SNA_C_ul_AIFixMemory, (unsigned long)fn_lAToI(_ap_szParams[0]) );
}
else if (M_ActionIs(C_Entry_AIMemory))
{
if((iFirst<2)||(SNA_fn_ucGetLoadType()==SNA_LOAD_SCRIPT))
fn_vInitAILevelMemory((unsigned long)fn_lAToI(_ap_szParams[0]));
AI_fn_vAIUseLevelMemory();
if ( SNA_M_bTestSaveGameMemDesc() )
SNA_fn_vWriteLongEntryToCurrentDscFile ( SNA_C_ul_AILevelMemory, (unsigned long)fn_lAToI(_ap_szParams[0]) );
}
else if (M_ActionIs(C_Entry_ACPTextMemory))
{
GEO_xCreateMemoryChannel(0,(unsigned long)fn_lAToI(_ap_szParams[0]));
if ( SNA_M_bTestSaveGameMemDesc() )
SNA_fn_vWriteLongEntryToCurrentDscFile ( SNA_C_ul_ACPTextMemory, (unsigned long)fn_lAToI(_ap_szParams[0]) );
}
else if (M_ActionIs(C_Entry_ACPFixMemory))
{
GEO_xCreateMemoryChannel(ACP_FixMemoryChannel,(unsigned long)fn_lAToI(_ap_szParams[0]));
GEO_xSelectMemoryChannel(ACP_FixMemoryChannel);
if ( SNA_M_bTestSaveGameMemDesc() )
SNA_fn_vWriteLongEntryToCurrentDscFile ( SNA_C_ul_ACPFixMemory, (unsigned long)fn_lAToI(_ap_szParams[0]) );
}
else if (M_ActionIs(C_Entry_ACPLevelMemory))
{
if((iFirst<2)||(SNA_fn_ucGetLoadType()==SNA_LOAD_SCRIPT))
GEO_xCreateMemoryChannel(ACP_LevelMemoryChannel,(unsigned long)fn_lAToI(_ap_szParams[0]));
if(iFirst>0)
GEO_xSelectMemoryChannel(ACP_LevelMemoryChannel);
if ( SNA_M_bTestSaveGameMemDesc() )
SNA_fn_vWriteLongEntryToCurrentDscFile ( SNA_C_ul_ACPLevelMemory, (unsigned long)fn_lAToI(_ap_szParams[0]) );
}
else if (M_ActionIs(C_Entry_POSMemory))
{
POS_fn_vInitPosMemory((unsigned long)fn_lAToI(_ap_szParams[0]));
if ( SNA_M_bTestSaveGameMemDesc() )
SNA_fn_vWriteLongEntryToCurrentDscFile ( SNA_C_ul_PositionMemory, (unsigned long)fn_lAToI(_ap_szParams[0]) );
}
else if (M_ActionIs(C_Entry_ScriptMemory))
{
g_SCR_a9MemTable[fn_lAToI(_ap_szParams[0])] = fn_lAToI(_ap_szParams[1]);
SCR_fn_v_Mem_InitWithMemLevel(g_SCR_a9MemTable);
if ( SNA_M_bTestSaveGameMemDesc() )
{
SNA_fn_vWrite2LongEntryToCurrentDscFile
(
SNA_C_ul_ScriptMemory,
(unsigned long)fn_lAToI(_ap_szParams[0]),
(unsigned long)fn_lAToI(_ap_szParams[1])
);
}
}
#ifdef D_USE_LIPSYNC
else if (M_ActionIs(C_Entry_LipsSynchMemory)) /* MR0912*/
{
LSY_fn_vFirstInitLSYMemory((unsigned long)fn_lAToI(_ap_szParams[0]));
}
#endif /* D_USE_LIPSYNC*/
else if (M_ActionIs(C_Entry_IPTMemory))
{
IPT_fn_vInitMemory((unsigned long)fn_lAToI(_ap_szParams[0]));
if ( SNA_M_bTestSaveGameMemDesc() )
SNA_fn_vWriteLongEntryToCurrentDscFile ( SNA_C_ul_IPTMemory, (unsigned long)fn_lAToI(_ap_szParams[0]) );
}
/* For BIN*/
else if (M_ActionIs(C_Entry_UseMemorySnapshot)) /* MR0309*/
{
/*g_bMemorySnapshot=TRUE;*/
/*SNA_fn_vSetLoadType(SNA_LOAD_SNAPSHOT);*/
SNA_fn_vSetLoadType((unsigned char)fn_lAToI(_ap_szParams[0]));
}
else if (M_ActionIs("Gap")) /* MR0309*/
{
vTab[wNbMalloc]=malloc((unsigned long)atol(_ap_szParams[0]));
wNbMalloc++;
}
/* For BIN End*/
else
M_GameInformationError(E_uwGameScriptCallBackDescriptionUnknownAction);
}
else if ( M_IsEnd )
{
int i;
for(i=0;i<wNbMalloc;i++)
{
free(vTab[i]);
}
wNbMalloc=0;
iFirst++;
if( (iFirst>1)&&(SNA_fn_ucGetLoadType()==SNA_LOAD_SNAPSHOT) )
{
AI_fn_vAIUseLevelMemory();
GEO_xSelectMemoryChannel(ACP_LevelMemoryChannel);
GAM_fn_vSetGameMemoryInLevel();
}
if ( SNA_M_bTestSaveGameMemDesc() )
SNA_fn_vWriteNoParamEntryToCurrentDscFile ( SNA_C_ulEndOfDescSection );
}
return(eReturnValue);
}
#endif /* U64 */
/**************************************************************************/

View File

@@ -0,0 +1,773 @@
#define D_Effect_StructureDefine
#define D_Effect_VariableDefine
#include "ToolsCPA.h"
#include "Effect.h"
#include "GameEng.h"
#include "ia_dnm.h"
#include "Toolcam.h"
#include "Typecam.h"
#include "Structur/State.h"
#include "Actions/AllActs.h"
#include "Structur/GameScpt.h"
#include "Structur/ErrGame.h"
#include "Structur/MemGame.h"
#include "Structur/StdObjSt.h"
#include "Structur/EngMode.h"
#include "Structur/Objects.h"
#include "Basic.h"
#include "Zemem.h"
#define C_szWaterStreakEffectDescription "WaterStreakDescription"
#define C_Entry_WaterStreakNbFoams "NumberOfFoams"
#define C_Entry_WaterStreakZoomXY "StreakZoom"
#define C_Entry_WaterStreakGeometricObject "GraphicObject"
#define C_Entry_WaterStreakAttenuationCoeff "AttenuationCoeff"
#define C_Entry_WaterStreakLifeTime "LifeTime"
#define C_Entry_WaterStreakTimeBetweenTwoShifts "TimeBetweenShifts"
#define C_Entry_WaterStreakTimeWindow "TimeWindow"
#define C_Entry_WaterStreakGap "StreakGap"
#define C_ulTimeBetweenTwoShifts 50
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
ACP_tdxBool fn_bIsCharacterCrossingASurfaceOfWater(
HIE_tdxHandleToSuperObject _hCharacter,
MTH3D_tdstVector * _p_stRealPoint);
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#if defined(GAM_USE_SCRIPT)
SCR_tde_Anl_ReturnValue fn_eCallBackWaterStreakEffect(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;
tdstWaterStreakEffect * p_stWSE;
_p_stFile=_p_stFile;
if(M_IsTitle)
{
M_CheckScriptParamNumber(2);
p_stWSE = (tdstWaterStreakEffect *)M_p_GameMallocInHLM(sizeof(tdstWaterStreakEffect));
p_stWSE->lNbFoams = atoi(_ap_szParams[0]);
p_stWSE->a_stFoams = (tdstWaterFoam *)M_p_GameMallocInHLM(sizeof(tdstWaterFoam)*p_stWSE->lNbFoams);
p_stWSE->lNbGraphicFoams = atoi(_ap_szParams[1]);
p_stWSE->a_hFoamObjectTable = (ACP_tdxHandleOfObject*)M_p_GameMallocInHLM(sizeof(ACP_tdxHandleOfObject)*p_stWSE->lNbGraphicFoams);
p_stWSE->lNbGraphicFoams = 0;
/*** Default values ***/
p_stWSE->xFoamXZoom = MTH_C_ONE;
p_stWSE->xFoamYZoom = MTH_C_ONE;
p_stWSE->lFoamFrameCounter = 0;
p_stWSE->ulLastTimeOfShift = 0;
p_stWSE->xAttenuationCoeff = 1.5f;
p_stWSE->lLifeTime = 500;
p_stWSE->xLifeTimeFrequency = p_stWSE->xAttenuationCoeff/((float)p_stWSE->lLifeTime);
p_stWSE->lTimeBetweenTwoShifts = 50;
SCR_M_RdL0_SetSectionLong(C_ThisSection,0,p_stWSE);
}
else if (M_IsEntry)
{
SCR_M_RdL0_GetSectionLong(C_ThisSection,0,tdstWaterStreakEffect *,p_stWSE);
if( M_ActionIs(C_Entry_WaterStreakGeometricObject) )
{
*(p_stWSE->a_hFoamObjectTable+p_stWSE->lNbGraphicFoams) = GLI_pLoadGeometricInFile(_ap_szParams[0]);
p_stWSE->lNbGraphicFoams++;
}
else if( M_ActionIs(C_Entry_WaterStreakZoomXY) )
{
p_stWSE->xFoamXZoom = MTH_M_xDoubleToReal(atof(_ap_szParams[0]));
p_stWSE->xFoamYZoom = MTH_M_xDoubleToReal(atof(_ap_szParams[1]));
}
else if( M_ActionIs(C_Entry_WaterStreakTimeBetweenTwoShifts) )
{
p_stWSE->lTimeBetweenTwoShifts = atoi(_ap_szParams[0]);
}
else if( M_ActionIs(C_Entry_WaterStreakAttenuationCoeff) )
{
p_stWSE->xAttenuationCoeff = MTH_M_xDoubleToReal(atof(_ap_szParams[0]));
}
else if( M_ActionIs(C_Entry_WaterStreakLifeTime) )
{
p_stWSE->lLifeTime = atoi(_ap_szParams[0]);
}
else if( M_ActionIs(C_Entry_WaterStreakTimeWindow) )
{
p_stWSE->xTimeWindow = MTH_M_xDoubleToReal(atof(_ap_szParams[0]));
}
else if( M_ActionIs(C_Entry_WaterStreakGap) )
{
p_stWSE->xGap = MTH_M_xDoubleToReal(atof(_ap_szParams[0]));
}
else
{
M_GameInformationError(E_uwGameScriptCallBackDescriptionUnknownAction);
}
}
else if( M_IsEnd )
{
SCR_M_RdL0_GetSectionLong(C_ThisSection,0,tdstWaterStreakEffect *,p_stWSE);
p_stWSE->xLifeTimeFrequency = p_stWSE->xAttenuationCoeff/((float)p_stWSE->lLifeTime);
}
return(eReturnValue);
}
#endif /* GAM_USE_SCRIPT */
/* Init water streak and bubble effects */
void fn_vInitWaterStreakEffect()
{
#if defined(GAM_USE_SCRIPT)
SCR_fn_v_RdL0_RegisterCallback(C_szWaterStreakEffectDescription,
fn_eCallBackWaterStreakEffect, SCR_CRC_c_RdL0_ForSection);
#endif /* GAM_USE_SCRIPT */
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vShiftTableOfPosition(GAM_tdxHandleToWaterStreakEffect _hWSE,MTH3D_tdstVector * _p_stV,ACP_tdxBool _bIsOK)
{
long lI;
tdstWaterFoam * p_stWF;
/* Taking in account real time */
if( (g_stEngineStructure.stEngineTimer.ulCurrentTimerCount-_hWSE->ulLastTimeOfShift) > C_ulTimeBetweenTwoShifts )
{
p_stWF = _hWSE->a_stFoams+_hWSE->lNbFoams-1;
_hWSE->ulLastTimeOfShift = g_stEngineStructure.stEngineTimer.ulCurrentTimerCount;
for( lI=_hWSE->lNbFoams-1; lI>0; lI--,p_stWF-- )
{
MTH3D_M_vCopyVector(&p_stWF->stPosition,&(p_stWF-1)->stPosition);
p_stWF->bFoamIsActive = (p_stWF-1)->bFoamIsActive;
p_stWF->lLifeTime = (p_stWF-1)->lLifeTime - _hWSE->lTimeBetweenTwoShifts;
}
MTH3D_M_vCopyVector( &_hWSE->a_stFoams->stPosition,_p_stV );
_hWSE->a_stFoams->bFoamIsActive = _bIsOK;
_hWSE->a_stFoams->lLifeTime = _hWSE->lLifeTime;
_hWSE->lFoamFrameCounter++;
if( _hWSE->lFoamFrameCounter == _hWSE->lNbGraphicFoams )
_hWSE->lFoamFrameCounter = 0;
}
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vTreatWaterStreak(
GAM_tdxHandleToWaterStreakEffect _hWSE,long _lElapsedTime)
{
long lI;
tdstWaterFoam * p_stWF;
p_stWF = _hWSE->a_stFoams;
for( lI=0; lI<_hWSE->lNbFoams; lI++,p_stWF++ )
{
/* If foam is living*/
if( p_stWF->bFoamIsActive )
{
p_stWF->lLifeTime -= _lElapsedTime;
/* Is foam dead?*/
if( p_stWF->lLifeTime<=0 )
p_stWF->bFoamIsActive = FALSE;
}
}
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vGenerateFoamInStreak(
GAM_tdxHandleToWaterStreakEffect _hWSE,long _lElapsedTime,
MTH3D_tdstVector * _p_stPosition)
{
long lI;
tdstWaterFoam * p_stWF;
if( _hWSE->ulLastTimeOfShift - g_stEngineStructure.stEngineTimer.ulCurrentTimerCount>(unsigned long)_hWSE->lTimeBetweenTwoShifts )
{
_hWSE->ulLastTimeOfShift = g_stEngineStructure.stEngineTimer.ulCurrentTimerCount;
p_stWF = _hWSE->a_stFoams;
for( lI=0; lI<_hWSE->lNbFoams; lI++,p_stWF++ )
{
/* Search for a dead foam*/
if( !p_stWF->bFoamIsActive )
{
/* Initialise datas for foam*/
p_stWF->lLifeTime = _hWSE->lLifeTime;
MTH3D_M_vCopyVector(&p_stWF->stPosition,_p_stPosition);
/* Activate the foam */
p_stWF->bFoamIsActive = TRUE;
break;
}
}
}
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vZoomAndDrawObjectOnXAndY(
GLD_tdstViewportAttributes * _p_stViewportAttr,
ACP_tdxHandleOfObject _hGeoObj,
MTH_tdxReal _xXScale,
MTH_tdxReal _xYScale,
long _lDrawMask);
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vDisplayWaterStreak(GLD_tdstViewportAttributes * _p_stViewportAttr,GAM_tdxHandleToWaterStreakEffect _hWSE,long _lDrawMask)
{
POS_tdstCompletePosition stMatrix;
long lI;
MTH_tdxReal xTmp;
long lTmp;
tdstWaterFoam * p_stWF;
p_stWF = _hWSE->a_stFoams;
POS_fn_vSetIdentityMatrix(&stMatrix);
for( lI=0; lI<_hWSE->lNbFoams; lI++,p_stWF++ )
{
/* if plouf state is correct */
if( p_stWF->bFoamIsActive )
{
/* Let's draw this plouf */
POS_fn_vSetTranslationVector(&stMatrix,&p_stWF->stPosition);
HIE_fn_bLoadMatrix(&stMatrix);
xTmp = _hWSE->xLifeTimeFrequency*(float)(_hWSE->lLifeTime - p_stWF->lLifeTime);
xTmp = 1.0f - _hWSE->xFoamXZoom*xTmp;
lTmp = lI + _hWSE->lFoamFrameCounter;
lTmp = ( lTmp>=_hWSE->lNbGraphicFoams ? lTmp%_hWSE->lNbGraphicFoams : lTmp );
fn_vZoomAndDrawObjectOnXAndY(
_p_stViewportAttr,_hWSE->a_hFoamObjectTable[lTmp],xTmp,xTmp,_lDrawMask);
HIE_fn_vPopMatrix();
}
}
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_vZoomAndDrawObjectOnXAndY(
GLD_tdstViewportAttributes * _p_stViewportAttr,
ACP_tdxHandleOfObject _hGeoObj,
MTH_tdxReal _xXScale,
MTH_tdxReal _xYScale,
long _lDrawMask)
{
MTH3D_tdstVector a_stPoints[4];
MTH3D_tdstVector a_stScaledPoints[4];
MTH_tdxReal xX,xY,xZ;
MTH_tdxReal xXMin,xXMax,xYMin,xYMax;
GEO_vGetPointOfObject(_hGeoObj,&a_stPoints[0],0);
GEO_vGetPointOfObject(_hGeoObj,&a_stPoints[1],1);
GEO_vGetPointOfObject(_hGeoObj,&a_stPoints[2],2);
GEO_vGetPointOfObject(_hGeoObj,&a_stPoints[3],3);
MTH3D_M_vGetVectorElements(&xX,&xY,&xZ,&a_stPoints[0]);
xXMin = xX*_xXScale;
xYMin = xY*_xYScale;
MTH3D_M_vGetVectorElements(&xX,&xY,&xZ,&a_stPoints[2]);
xXMax = xX*_xXScale;
xYMax = xY*_xYScale;
MTH3D_M_vSetVectorElements(&a_stScaledPoints[0],xXMin,xYMin,xZ);
MTH3D_M_vSetVectorElements(&a_stScaledPoints[1],xXMax,xYMin,xZ);
MTH3D_M_vSetVectorElements(&a_stScaledPoints[2],xXMax,xYMax,xZ);
MTH3D_M_vSetVectorElements(&a_stScaledPoints[3],xXMin,xYMax,xZ);
GEO_vSetPointOfObject(_hGeoObj,&a_stScaledPoints[0],0);
GEO_vSetPointOfObject(_hGeoObj,&a_stScaledPoints[1],1);
GEO_vSetPointOfObject(_hGeoObj,&a_stScaledPoints[2],2);
GEO_vSetPointOfObject(_hGeoObj,&a_stScaledPoints[3],3);
GLI_xSendObjectToViewport(
_p_stViewportAttr,_hGeoObj,gp_stLight,
_lDrawMask&(GLI_C_lAllIsEnable-GLI_C_lNotForceZSorting));
GEO_vSetPointOfObject(_hGeoObj,&a_stPoints[0],0);
GEO_vSetPointOfObject(_hGeoObj,&a_stPoints[1],1);
GEO_vSetPointOfObject(_hGeoObj,&a_stPoints[2],2);
GEO_vSetPointOfObject(_hGeoObj,&a_stPoints[3],3);
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
void fn_vWaterStreakEffect(
GLD_tdstViewportAttributes * _p_stViewportAttr,
HIE_tdxHandleToSuperObject _hCharacter,
long _lDrawMask)
{
#ifndef D_THROW_PRT
GAM_tdxHandleToWaterStreakEffect hWaterStreak;
long lElapsedTime;
MTH3D_tdstVector stV;
if( M_GetMSHandle(_hCharacter,MSPrtSrc) )
{
hWaterStreak = fn_hMSPrtSrcGetWaterStreakGenerator( M_GetMSHandle(_hCharacter,MSPrtSrc) );
if( !hWaterStreak )
return;
/* Computing elapsed time*/
lElapsedTime = g_stEngineStructure.stEngineTimer.ulUsefulDeltaTime;
if( fn_bIsCharacterCrossingASurfaceOfWater(_hCharacter,&stV) )
{
/* Generate a foam*/
fn_vGenerateFoamInStreak(hWaterStreak,lElapsedTime,&stV);
}
/* Treat the water streak*/
fn_vTreatWaterStreak(hWaterStreak,lElapsedTime);
}
#endif /* D_THROW_PRT */
}
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
ACP_tdxBool fn_bIsCharacterCrossingASurfaceOfWater(
HIE_tdxHandleToSuperObject _hCharacter,
MTH3D_tdstVector * _p_stRealPoint)
{
/*
DNM_tdeFluidEnvironment eDnmEnvironment;
MTH3D_tdstVector stPositionOnWaterPlane;
MTH_tdxReal xDepth;
if( GAM_fn_bGetEnvironmentOfPointOfType(
_hCharacter,DNM_Point_Feet,&eDnmEnvironment) )
{
if( eDnmEnvironment==DNM_Fluid_Water )
{
if( GAM_fn_bGetEnvironmentOfPointOfType(
_hCharacter,DNM_Point_Head,&eDnmEnvironment) )
{
if( eDnmEnvironment==DNM_Fluid_Air )
{
POS_fn_vGetTranslationVector(HIE_fn_hGetSuperObjectGlobalMatrix(_hCharacter),&stPositionOnWaterPlane);
SECT_hGetDNMEnvironmentAndDepth(
NULL,
&stPositionOnWaterPlane,
fn_h_SectInfoGetCurrentSector(M_GetMSHandle(_hCharacter,SectInfo)),
&xDepth);
MTH3D_M_vSetZofVector(&stPositionOnWaterPlane,MTH3D_M_xGetZofVector(&stPositionOnWaterPlane)+xDepth+0.05f);
MTH3D_M_vCopyVector(_p_stRealPoint,&stPositionOnWaterPlane);
return TRUE;
}
}
}
}*/
return FALSE;
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*ANNECY VL 03/11/97{*/
/*
=======================================================================================
=======================================================================================
special code for footpath effect
=======================================================================================
=======================================================================================
*/
/*
----------------------------------------------------------------------------------------
Description : allocate and initialize a footpath effect structure
Returns (GAM_tdxHandleToFootPathEffect ) allocated footpath structure
----------------------------------------------------------------------------------------
*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
GAM_tdxHandleToFootPathEffect fn_h_FootPath_Alloc()
{
tdstFootPath *p_stFootPath;
p_stFootPath = (tdstFootPath *) M_p_GameMallocInHLM ( sizeof( tdstFootPath) );
memset( p_stFootPath, 0, sizeof( tdstFootPath ) );
return (GAM_tdxHandleToFootPathEffect) p_stFootPath;
}
/*
----------------------------------------------------------------------------------------
Description : create footpath internal data ( geom object )
_hFootPath -> foot path that is to be created
----------------------------------------------------------------------------------------
*/
void fn_v_FootPath_Create( GAM_tdxHandleToFootPathEffect _hFootPath )
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
tdstFootPath *p_stFP;
GMT_tdxHandleToGameMaterial hGMCopy;
ACP_tdxHandleOfMaterial hVisual;
GLI_tdstColor stColor;
ACP_tdxHandleOfElement hElement;
ACP_tdst2DUVValues a_stUV[4] = { {0.0f,0.0f}, {1.0f,0.0f}, {1.0f,1.0f}, {0.0f,1.0f} };
ACP_tdxIndex xPoint, xFace, xObj;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
p_stFP = (tdstFootPath *) _hFootPath;
/* creation of game material that represent a left foot print */
hVisual = GMT_fn_hGetVisualMaterial( p_stFP->hFootPrintMaterial );
GLI_xGetMaterialType( hVisual, (unsigned long *)&xPoint );
xPoint &= ~( GLI_C_lIsNotGrided | GLI_C_lIsNotLightAlphaSensitive );
GLI_xSetMaterialType( hVisual, xPoint );
for (xObj = 0; xObj < p_stFP->xNumberOfAlphaLevels; xObj ++)
{
/* creation of geometric object */
GEO_vCreateGeometricObject( &p_stFP->a8_hGeomObj[ xObj ], p_stFP->a8_xNumberOfPoints[ xObj ], 1 );
p_stFP->a8_xMaxNumberOfFaces[ xObj ] = (ACP_tdxIndex)(p_stFP->a8_xNumberOfPoints[ xObj ] >> 1);
/* creation of element */
GEO_vCreateElementIndexedTriangles( p_stFP->a8_hGeomObj[ xObj ], &hElement, p_stFP->a8_xMaxNumberOfFaces[ xObj ], 4);
/* set material of element */
if (xObj != 0)
{
hGMCopy = GMT_fn_hCreateGameMaterial();
GMT_fn_vCopyGameMaterial( hGMCopy, p_stFP->hFootPrintMaterial );
}
else
hGMCopy = p_stFP->hFootPrintMaterial;
#ifndef CONST_VMT
hVisual = GMT_fn_hGetVisualMaterial( hGMCopy );
GLI_xGetMaterialAmbientCoef( hVisual, &stColor );
stColor.xA = p_stFP->a8_xAlphaColor[ xObj ];
GLI_xSetMaterialAmbientCoef( hVisual, &stColor );
#endif
GEO_vSetGameMaterialOfIndexedTriangles( p_stFP->a8_hGeomObj[ xObj ], hElement, hGMCopy );
/* set uv coordinates */
for (xPoint = 0; xPoint < 4; xPoint++ )
GEO_vSetUVOfIndexedTriangles( p_stFP->a8_hGeomObj[ xObj ], hElement, xPoint, a_stUV + xPoint);
/*for (xPoint = 0, xFace = 0; xFace < g_stFootPath.a8_xMaxNumberOfFaces[ xObj ]; )*/
for (xPoint = 0, xFace = 0; xFace < p_stFP->a8_xMaxNumberOfFaces[ xObj ]; )
{
GEO_vSetFaceOfIndexedTriangles(p_stFP->a8_hGeomObj[ xObj ], hElement, xFace++, xPoint, (ACP_tdxIndex)(xPoint + 1), (ACP_tdxIndex)(xPoint + 3));
GEO_vSetFaceOfIndexedTriangles(p_stFP->a8_hGeomObj[ xObj ], hElement, xFace++, (ACP_tdxIndex)(xPoint + 1), (ACP_tdxIndex)(xPoint + 2), (ACP_tdxIndex)(xPoint + 3));
xPoint += 4;
}
((GEO_tdstElementIndexedTriangles *) p_stFP->a8_hGeomObj[xObj]->d_stListOfElements[ 0 ])->xNbFaces = 0;
}
GLI_vEndofGeometricLoad();
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*
----------------------------------------------------------------------------------------
Description : reinit (emptied the foot path)
_hFootPath -> footpath to clear
Returns (void )
----------------------------------------------------------------------------------------
*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_v_FootPath_ReInit( GAM_tdxHandleToFootPathEffect _hFootPath )
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
tdstFootPath *p_stFP;
ACP_tdxIndex xObj;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
p_stFP = (tdstFootPath *) _hFootPath;
if (p_stFP->a8_hGeomObj[0] == NULL )
return;
for (xObj = 0; xObj < p_stFP->xNumberOfAlphaLevels; xObj++)
{
p_stFP->a8_xNumberOfFaces[ xObj ] = p_stFP->a8_xNextFaces[ xObj ] = 0;
((GEO_tdstElementIndexedTriangles *) p_stFP->a8_hGeomObj[xObj]->d_stListOfElements[ 0 ])->xNbFaces = 0;
}
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_v_FootPath_Compute( HIE_tdxHandleToSuperObject _hCharacter, ACP_tdxIndex _xType );
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*
----------------------------------------------------------------------------------------
Description : add a footprint into the foot path
hHandleOfCharacter -> character that have a footpath
_xFootPrintType -> left (0) or right (1) foot print
----------------------------------------------------------------------------------------
*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_v_FootPath_Add( HIE_tdxHandleToSuperObject _hCharacter, ACP_tdxIndex _xFootPrintType )
{
#ifndef D_THROW_PRT
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
MS_tdxHandleToMSPrtSrc hMSPrtSrc;
tdstFootPath *p_stFP;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/* retrieve footpath information */
hMSPrtSrc = M_GetMSHandle(_hCharacter,MSPrtSrc);
if (hMSPrtSrc == NULL)
return;
p_stFP = (tdstFootPath *) fn_hMSPrtSrcGetFootPath( hMSPrtSrc );
if (p_stFP->a8_hGeomObj[0] == NULL)
return;
fn_v_FootPath_Compute( _hCharacter, _xFootPrintType );
return;
#endif /* D_THROW_PRT */
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*
----------------------------------------------------------------------------------------
Description : display a foot path
_hFootPath -> foot path that is to be displayed
_p_stViewportAttr ->
Returns (void )
----------------------------------------------------------------------------------------
*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_v_FootPath_Display(GAM_tdxHandleToFootPathEffect _hFootPath, GLD_tdstViewportAttributes * _p_stViewportAttr, long _lDrawMask)
{
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
tdstFootPath *p_stFP;
ACP_tdxIndex xObj;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
p_stFP = (tdstFootPath *) _hFootPath;
for (xObj = 0; xObj < p_stFP->xNumberOfAlphaLevels; xObj ++)
{
if (p_stFP->a8_hGeomObj[ xObj ] == NULL)
return;
HIE_fn_bLoadIdentity();
GLI_xSendObjectToViewport( _p_stViewportAttr, p_stFP->a8_hGeomObj[ xObj ], gp_stLight, _lDrawMask );
HIE_fn_vPopMatrix();
}
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/**********************************************************************************************/
/* Name: fn_v_FootPath_Compute*/
/* Goal: Compute geometric point to define a footprint*/
/**********************************************************************************************/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/* Oliv' - Portage v15 - remove warnings and unused variables*/
#ifndef D_THROW_PRT
static float gs_fDeltaZ = 0.01f;
static float gs_fSPZ = 0.3f;
static MTH3D_tdstVector gs_stPicking = { 0, 0, -0.6f};
static ACP_tdxIndex gs_a2a6_xUV[2][6] = { {0,1,3,1,2,3}, {1,0,2,0,3,2} };
static ACP_tdxIndex gs_a4a2_xChangeSign[4][2] = { { 0, 0}, { 1, 0}, { 0, 1}, { 1,0} };
#endif /* D_THROW_PRT */
/* EndOfOliv'*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/*
----------------------------------------------------------------------------------------
Description : compute foot print emplacement
_hCharacter -> caractere that will have a new foot print in it's foot path
_xType -> type of foot print : 0 -> left, 1 -> right
----------------------------------------------------------------------------------------
*/
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
void fn_v_FootPath_Compute( HIE_tdxHandleToSuperObject _hCharacter, ACP_tdxIndex _xType )
{
#ifndef D_THROW_PRT
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
tdstFootPath *p_stFP;
HIE_tdxHandleToSuperObject hSector;
GEO_tdxHandleToMatrix hGlobalMatrixOfCharacter;
MTH3D_tdstVector stVectX, stVectY, stVectZ, stTrans;
MTH3D_tdstVector stEndPicking;
MTH3D_tdstVector stStartPicking;
ACP_tdxIndex xResultIntersection = 0;
MTH3D_tdstVector a4_stPickedPoint[4];
/* HIE_tdxHandleToSuperObject hPickedSpObj;*/
ACP_tdxHandleOfObject hPickedObject = NULL;
ACP_tdxIndex xPickedElement = 0;
/* ACP_tdxIndex xPickedFace;*/
/*XB890504*/
/* short xNbObjPicked=0;*/
/*End XB*/
GMT_tdxHandleToGameMaterial hMaterial;
GMT_tdxHandleToCollideMaterial hCM;
ACP_tdxIndex xPoint, xObj;
ACP_tdxIndex *p_xFaceSource, *p_xFaceDest;
MTH3D_tdstVector *p_stPointSource, *p_stPointDest;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
/* get foot path struct */
p_stFP = (tdstFootPath *) fn_hMSPrtSrcGetFootPath( M_GetMSHandle(_hCharacter,MSPrtSrc) );
/* get sector where perso is */
hSector = fn_h_SectInfoGetCurrentSector( M_GetMSHandle( _hCharacter, SectInfo) );
/* get matrix and position of character */
hGlobalMatrixOfCharacter = HIE_fn_hGetSuperObjectGlobalMatrix( _hCharacter );
POS_fn_vGetTranslationVector( hGlobalMatrixOfCharacter, &stTrans );
POS_fn_vGetRotationMatrix( hGlobalMatrixOfCharacter, &stVectX, &stVectY, &stVectZ );
/* ZVector of rotation matrix isn't used, use it to store rotation of footprint offset */
POS_fn_vRotateVector( &stVectZ, hGlobalMatrixOfCharacter, &p_stFP->a2_stOffset[ _xType ] );
/* shift position of foot print */
MTH3D_M_vAddVector( &stTrans, &stTrans, &stVectZ );
/* increase Z of position to be sure to be above the floor */
stTrans.xZ = MTH_M_xAdd(stTrans.xZ, gs_fSPZ);
/* set X and Y to good foot print dimension */
MTH3D_M_vMulScalarVector( &stVectX, p_stFP->a2_xScale[0], &stVectX );
MTH3D_M_vMulScalarVector( &stVectY, p_stFP->a2_xScale[1], &stVectY );
for ( xPoint = 0; xPoint < 4; xPoint++ )
{
/* compute point position */
if (gs_a4a2_xChangeSign[ xPoint ][ 0 ]) MTH3D_M_vNegVector( &stVectX, &stVectX );
if (gs_a4a2_xChangeSign[ xPoint ][ 1 ]) MTH3D_M_vNegVector( &stVectY, &stVectY );
MTH3D_M_vAddVector( &stStartPicking, &stVectX, &stVectY );
MTH3D_M_vAddVector( &stStartPicking, &stStartPicking, &stTrans );
MTH3D_M_vAddVector( &stEndPicking, &stStartPicking, &gs_stPicking );
/* get impact on the floor of sector */
/*
xResultIntersection = SHW_fn_bIntersectShadowSuperObject
(
&stStartPicking,
&stEndPicking,
&gs_stPicking,
1.1f,
hSector,
&a4_stPickedPoint[ xPoint ],
&hPickedSpObj,
&hPickedObject,
&xPickedElement,
&xPickedFace,
&xNbObjPicked
);
*/
/* xResultIntersection = SHW_fn_bIntersectShadowSuperObjectLevel1
(
&stStartPicking,
&stEndPicking,
&gs_stPicking,
hSector,
&a4_stPickedPoint[ xPoint ],
&hPickedSpObj,
&hPickedObject,
&xPickedElement,
&xPickedFace,
&stVectZ,
_hCharacter
);
*/ /* no impact : stop */
if (xResultIntersection == 0)
break;
/* get material of picked face to know if trace could be leaved */
if ( p_stFP->xConsiderMaterial )
{
hMaterial = NULL;
switch (GEO_xGetElementType( hPickedObject, xPickedElement ) )
{
case GEO_C_xElementIndexedTriangles:
GEO_vGetGameMaterialOfIndexedTriangles( hPickedObject, xPickedElement, &hMaterial );
break;
/* case GEO_C_xElementFaceMapDescriptors:*/
/* break;*/
}
if ( hMaterial == NULL)
break;
hCM = GMT_fn_hGetCollideMaterial( hMaterial );
if (hCM == GMT_C_InvalidCollideMaterial)
break;
if ( (GMT_fn_hGetCollideMaterialIdentifier( hCM ) & p_stFP->xConsiderMaterial ) == 0 )
break;
}
a4_stPickedPoint[ xPoint ].xZ += gs_fDeltaZ;
}
/* all 4 points of foot print are good : add it*/
if (xPoint == 4)
{
/* move erased point to more transparent object */
for (xObj = (ACP_tdxIndex)(p_stFP->xNumberOfAlphaLevels - 2); xObj >= 0; xObj-- )
{
if ( p_stFP->a8_xNextFaces[ xObj ] < p_stFP->a8_xNumberOfFaces[ xObj ] )
{
/* get pointer on data to be moved */
p_xFaceSource = (ACP_tdxIndex *) &((GEO_tdstElementIndexedTriangles *) p_stFP->a8_hGeomObj[ xObj ]->d_stListOfElements[ 0 ])->d_stListOfFacesTripledIndexUV[ p_stFP->a8_xNextFaces[xObj] ];
p_stPointSource = &p_stFP->a8_hGeomObj[ xObj ]->d_stListOfPoints[p_stFP->a8_xNextFaces[xObj] * 2];
/* get pointer where data will be moved (in next object) */
p_xFaceDest = (ACP_tdxIndex *) &((GEO_tdstElementIndexedTriangles *) p_stFP->a8_hGeomObj[ xObj + 1 ]->d_stListOfElements[ 0 ])->d_stListOfFacesTripledIndexUV[ p_stFP->a8_xNextFaces[xObj + 1] ];
p_stPointDest = &p_stFP->a8_hGeomObj[ xObj + 1 ]->d_stListOfPoints[p_stFP->a8_xNextFaces[xObj + 1] * 2];
/* move points : decrease Z of each point*/
memcpy( p_stPointDest, p_stPointSource, 4 * sizeof( MTH3D_tdstVector ) );
for (xPoint = 0; xPoint < 4; xPoint ++ )
p_stPointDest[ xPoint ].xZ -= 0.001f;
/* move uv indexes */
memcpy( p_xFaceDest, p_xFaceSource, 6 * sizeof( ACP_tdxIndex ) );
/* a face is added in object current + 1, change footpath data */
p_stFP->a8_xNextFaces[xObj + 1] += 2;
if (p_stFP->a8_xNextFaces[xObj + 1] > p_stFP->a8_xNumberOfFaces[ xObj + 1])
{
((GEO_tdstElementIndexedTriangles *) p_stFP->a8_hGeomObj[xObj+1]->d_stListOfElements[0])->xNbFaces = p_stFP->a8_xNextFaces[ xObj + 1];
p_stFP->a8_xNumberOfFaces[ xObj + 1] = p_stFP->a8_xNextFaces[ xObj + 1];
}
if (p_stFP->a8_xNextFaces[ xObj + 1] == p_stFP->a8_xMaxNumberOfFaces[ xObj + 1] )
p_stFP->a8_xNextFaces[ xObj + 1] = 0;
}
}
/* add new point to object 0 */
/* get pointer where data will be moved */
p_stPointDest = &p_stFP->a8_hGeomObj[ 0 ]->d_stListOfPoints[p_stFP->a8_xNextFaces[0] * 2];
p_xFaceDest = (ACP_tdxIndex *) &((GEO_tdstElementIndexedTriangles *) p_stFP->a8_hGeomObj[ 0 ]->d_stListOfElements[ 0 ])->d_stListOfFacesTripledIndexUV[ p_stFP->a8_xNextFaces[ 0 ] ];
/* copy point and UV indexes */
memcpy( p_stPointDest, a4_stPickedPoint, 4 * sizeof( MTH3D_tdstVector ) );
memcpy( p_xFaceDest, gs_a2a6_xUV[ _xType ], 6 * sizeof( ACP_tdxIndex ) );
/* update object 0 footpath data */
p_stFP->a8_xNextFaces[ 0 ] += 2;
if (p_stFP->a8_xNextFaces[ 0 ] > p_stFP->a8_xNumberOfFaces[ 0 ] )
{
((GEO_tdstElementIndexedTriangles *) p_stFP->a8_hGeomObj[0]->d_stListOfElements[ 0 ])->xNbFaces = p_stFP->a8_xNextFaces[ 0 ];
p_stFP->a8_xNumberOfFaces[ 0 ] = p_stFP->a8_xNextFaces[ 0 ];
}
if (p_stFP->a8_xNextFaces[ 0 ] == p_stFP->a8_xMaxNumberOfFaces[ 0 ] )
{
p_stFP->a8_xNextFaces[ 0 ] = 0;
}
}
#endif /* D_THROW_PRT */
}
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
/*ENDANNECY VL }*/

Some files were not shown because too many files have changed in this diff Show More