reman3/Rayman_X/cpa/tempgrp/GAM/P5/TBLLoad.c

690 lines
26 KiB
C

/*=========================================================================
* 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.
*/