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,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*/