Add rayman2 source files
This commit is contained in:
2209
Rayman_X/cpa/tempgrp/SCT/P5/Sectload.c
Normal file
2209
Rayman_X/cpa/tempgrp/SCT/P5/Sectload.c
Normal file
File diff suppressed because it is too large
Load Diff
372
Rayman_X/cpa/tempgrp/SCT/P5/sectLoadCB.c
Normal file
372
Rayman_X/cpa/tempgrp/SCT/P5/sectLoadCB.c
Normal file
@@ -0,0 +1,372 @@
|
||||
/* (c) Ubi Studios 1998*/
|
||||
|
||||
/*For game material*/
|
||||
#include "GMT/GmtHandl.h"
|
||||
|
||||
#include "ACP_base.h"
|
||||
/*memory management of geometry.*/
|
||||
#include "GEO.h"
|
||||
#include "GLI.h"
|
||||
#include "SCR.h"
|
||||
|
||||
/*Include For "Sector.h"*/
|
||||
#include "MTH.h"
|
||||
#include "COL.h"
|
||||
#include "SPO.h"
|
||||
#include "LST.h"
|
||||
|
||||
#include "VIG.h"
|
||||
|
||||
/*For the sound*/
|
||||
#include "SND.h"
|
||||
|
||||
#include "SCT.h"
|
||||
|
||||
/*PATH NAME*/
|
||||
#include "DPT.h"
|
||||
|
||||
#include "SNA.h"
|
||||
|
||||
#include "ldt.h"
|
||||
|
||||
extern SCR_tdst_Link_Table SECT_stLinkTable;
|
||||
|
||||
#define lTagMinPointOfBorder 'PniM'
|
||||
#define lTagMaxPointOfBorder 'PxaM'
|
||||
#define lTagZmaxOfBorder 'xamZ'
|
||||
|
||||
#define lTagAddLst 'LddA'
|
||||
#define lTagAddLstActivity 'itcA'
|
||||
#define lTagAddLstGraphic 'parG'
|
||||
#define lTagAddLstCollision 'lloC'
|
||||
#define lTagAddLstSound 'nuoS'
|
||||
#define lTagVirtual 'triV'
|
||||
#define lTagCameraType 'emaC'
|
||||
#define lTagZFar 'raFZ'
|
||||
|
||||
|
||||
/*****************************************************************
|
||||
Function name : fn_iCreateSector
|
||||
Description :
|
||||
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
|
||||
Creation Date : 14-Oct-98
|
||||
Modified :
|
||||
Return type : int
|
||||
Argument : LDT_tdst_Link *pLink
|
||||
*****************************************************************/
|
||||
int fn_iCreateSector( LDT_tdst_Link *pLink )
|
||||
{
|
||||
/* new Sector for that section*/
|
||||
pLink->pObject = (void*)SECT_fn_hCreateSector();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*****************************************************************
|
||||
Function name : fn_iLoadSector
|
||||
Description :
|
||||
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
|
||||
Creation Date : 14-Oct-98
|
||||
Modified :
|
||||
Return type : int
|
||||
Argument : LDT_tdst_Link *pLink
|
||||
*****************************************************************/
|
||||
int fn_iLoadSector( LDT_tdst_Link *pLink )
|
||||
{
|
||||
LDT_tdeParseResult result=ParseResult_BeginSection;
|
||||
char a255_cLinkKey[255];
|
||||
SECT_tdxHandleOfSectorObject hNewSector = (SECT_tdxHandleOfSectorObject)pLink->pObject;
|
||||
int nLen;
|
||||
|
||||
VIG_fn_vAddToProgressBar(1);
|
||||
nLen = LDT_ComputeSectionName( pLink, a255_cLinkKey );
|
||||
#ifdef _DEBUG
|
||||
strcpy(hNewSector->szSectorName, a255_cLinkKey);
|
||||
#endif /* _DEBUG */
|
||||
|
||||
SCR_M_v_Link_SetAdditionalLong(
|
||||
SCR_fnp_st_Link_SetValue(&SECT_stLinkTable, a255_cLinkKey, (unsigned long)hNewSector),
|
||||
1, nLen) ;
|
||||
|
||||
do{
|
||||
result=LDT_GetNextEntry();
|
||||
if( result== ParseResult_BeginSection )
|
||||
LDT_LoadSection( NULL );
|
||||
}while ( result!=ParseResult_EndSection );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*****************************************************************
|
||||
Function name : fn_iLoadSectorBorder
|
||||
Description :
|
||||
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
|
||||
Creation Date : 14-Oct-98
|
||||
Modified :
|
||||
Return type : int
|
||||
Argument : LDT_tdst_Link *pLink
|
||||
*****************************************************************/
|
||||
int fn_iLoadSectorBorder( LDT_tdst_Link *pLink )
|
||||
{
|
||||
LDT_tdeParseResult result=ParseResult_BeginSection;
|
||||
SECT_tdxHandleOfSectorObject hSector = (SECT_tdxHandleOfSectorObject)pLink->pParent->pObject;
|
||||
MTH3D_tdstVector stMaxPoint, stMinPoint;
|
||||
|
||||
|
||||
while( result!=ParseResult_EndSection )
|
||||
{
|
||||
result=LDT_GetNextEntry();
|
||||
switch( result )
|
||||
{
|
||||
case ParseResult_Entry: /* an entry */
|
||||
{
|
||||
char *szEntry=LDT_szGetEntryName();
|
||||
switch (*(long*)szEntry)
|
||||
{
|
||||
|
||||
case lTagMinPointOfBorder : /* */
|
||||
{
|
||||
MTH3D_M_vSetVectorElements(&stMinPoint,
|
||||
GLI_M_FloatToValue(atof(LDT_szGetParam(1))),
|
||||
GLI_M_FloatToValue(atof(LDT_szGetParam(2))),
|
||||
GLI_M_FloatToValue(atof(LDT_szGetParam(3))));
|
||||
SECT_fn_vSetMinPointInBorder(hSector, &stMinPoint);
|
||||
|
||||
}
|
||||
break;
|
||||
case lTagMaxPointOfBorder : /* */
|
||||
{
|
||||
MTH3D_M_vSetVectorElements(&stMaxPoint,
|
||||
GLI_M_FloatToValue(atof(LDT_szGetParam(1))),
|
||||
GLI_M_FloatToValue(atof(LDT_szGetParam(2))),
|
||||
GLI_M_FloatToValue(atof(LDT_szGetParam(3))));
|
||||
SECT_fn_vSetMaxPointInBorder(hSector, &stMaxPoint);
|
||||
}
|
||||
break;
|
||||
case lTagZmaxOfBorder : /* */
|
||||
{
|
||||
stMaxPoint.xX = stMaxPoint.xY = MTH_C_InfinitMinus;
|
||||
stMaxPoint.xZ = GLI_M_FloatToValue(atof(LDT_szGetParam(1)));
|
||||
SECT_fn_vSetMaxPointInBorder(hSector, &stMaxPoint);
|
||||
|
||||
#ifdef ACTIVE_EDITOR
|
||||
SECT_fn_vSetZmaxOfBorder(hSector, GLI_M_FloatToValue(atof(LDT_szGetParam(1))));
|
||||
#endif /*ACTIVE_EDITOR*/
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*****************************************************************
|
||||
Function name : fn_iLoadSectorsLink
|
||||
Description :
|
||||
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
|
||||
Creation Date : 14-Oct-98
|
||||
Modified :
|
||||
Return type : int
|
||||
Argument : LDT_tdst_Link *pLink
|
||||
*****************************************************************/
|
||||
int fn_iLoadSectorsLink( LDT_tdst_Link *pLink )
|
||||
{
|
||||
LDT_tdeParseResult result=ParseResult_BeginSection;
|
||||
SECT_tdxHandleOfSectorObject hSector = (SECT_tdxHandleOfSectorObject)pLink->pParent->pObject;
|
||||
SECT_tdxHandleOfElementLstGraphicInteraction hGElement;
|
||||
SECT_tdxHandleOfElementLstCollisionInteraction hColElement;
|
||||
SECT_tdxHandleOfElementLstActivityInteraction hActElement;
|
||||
SECT_tdxHandleOfElementLstSoundInteraction hSoundElement;
|
||||
SCT_tdxHandleOfLstSoundEvent hSoundEventElement;
|
||||
|
||||
while( result!=ParseResult_EndSection )
|
||||
{
|
||||
result=LDT_GetNextEntry();
|
||||
switch( result )
|
||||
{
|
||||
case ParseResult_Entry: /* an entry */
|
||||
{
|
||||
char *szEntry=LDT_szGetEntryName();
|
||||
switch (*(long*)szEntry)
|
||||
{
|
||||
|
||||
case lTagAddLst : /* */
|
||||
{
|
||||
switch (*(long*)(szEntry+6))
|
||||
{
|
||||
|
||||
case lTagAddLstActivity : /* */
|
||||
{
|
||||
HIE_tdxHandleToSuperObject hSPO = (HIE_tdxHandleToSuperObject)LDT_LoadSection(LDT_szGetParam(1));
|
||||
if (hSPO)
|
||||
{
|
||||
hActElement=SECT_fn_hCreateElementLstActivityInteraction();
|
||||
SECT_fn_vSetSectorPointedElementLSTActivityInt(hActElement, hSPO);
|
||||
LST2_M_StaticAddTail(&(hSector->stListOfSectorsInActivityInteraction),hActElement);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case lTagAddLstGraphic : /* */
|
||||
{
|
||||
HIE_tdxHandleToSuperObject hSPO = (HIE_tdxHandleToSuperObject)LDT_LoadSection(LDT_szGetParam(1));
|
||||
if (hSPO)
|
||||
{
|
||||
hGElement=SECT_fn_hCreateElementLstGraphicInteraction();
|
||||
SECT_fn_vSetSectorPointedElementLSTGraphicInt(hGElement, hSPO);
|
||||
SECT_fn_vSetLevelElementLSTGraphicInt(hGElement, (short)atoi(LDT_szGetParam(2)));
|
||||
LST2_M_StaticAddTail(&(hSector->stListOfSectorsInGraphicInteraction),hGElement);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case lTagAddLstCollision : /* */
|
||||
{
|
||||
HIE_tdxHandleToSuperObject hSPO = (HIE_tdxHandleToSuperObject)LDT_LoadSection(LDT_szGetParam(1));
|
||||
if (hSPO)
|
||||
{
|
||||
hColElement=SECT_fn_hCreateElementLstCollisionInteraction();
|
||||
SECT_fn_vSetSectorPointedElementLSTCollisionInt(hColElement, hSPO);
|
||||
LST2_M_StaticAddTail(&(hSector->stListOfSectorsInCollisionInteraction),hColElement);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case lTagAddLstSound : /* */
|
||||
{
|
||||
if (strlen(szEntry)>12) /*AddLstSoundEvent*/
|
||||
{
|
||||
if( strcmp(LDT_szGetParam(1),"FromAllSectors")==0 )
|
||||
{
|
||||
SND_tdxHandleToSoundEvent handle;
|
||||
hSoundEventElement = SCT_fn_hCreateElementLstSoundEvent();
|
||||
SCT_fn_vSetSectorPointedElementLSTSoundEvent(hSoundEventElement,NULL);
|
||||
handle = (SND_tdxHandleToSoundEvent) LDT_LoadSection(LDT_szGetParam(2));
|
||||
if(handle)
|
||||
{
|
||||
if (SNA_fn_ucGetLoadType()==SNA_SAVE_SNAPSHOT) /* MR0110*/
|
||||
SNA_fn_vWriteSoundEntryInSoundTableFile(SND_fn_ulGetEventBinIdFromPointer(handle) ,(unsigned long)&(hSoundEventElement->uSoundEvent.pstPtr));
|
||||
SCT_fn_vSetEventListElementLSTSoundEvent(hSoundEventElement, handle);
|
||||
}
|
||||
LST2_M_StaticAddTail(&(hSector->stListOfSoundEvent),hSoundEventElement);
|
||||
}
|
||||
else
|
||||
{
|
||||
HIE_tdxHandleToSuperObject hSPO = (HIE_tdxHandleToSuperObject)LDT_LoadSection(LDT_szGetParam(1));
|
||||
if (hSPO)
|
||||
{
|
||||
SND_tdxHandleToSoundEvent handle;
|
||||
hSoundEventElement=SCT_fn_hCreateElementLstSoundEvent();
|
||||
SCT_fn_vSetSectorPointedElementLSTSoundEvent(hSoundEventElement, hSPO);
|
||||
handle = (SND_tdxHandleToSoundEvent) LDT_LoadSection(LDT_szGetParam(2));
|
||||
if(handle)
|
||||
{
|
||||
if (SNA_fn_ucGetLoadType()==SNA_SAVE_SNAPSHOT) /* MR0110*/
|
||||
SNA_fn_vWriteSoundEntryInSoundTableFile(SND_fn_ulGetEventBinIdFromPointer(handle) ,(unsigned long)&(hSoundEventElement->uSoundEvent.pstPtr));
|
||||
SCT_fn_vSetEventListElementLSTSoundEvent(hSoundEventElement, handle);
|
||||
}
|
||||
LST2_M_StaticAddTail(&(hSector->stListOfSoundEvent),hSoundEventElement);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else /*AddLstSound*/
|
||||
{
|
||||
HIE_tdxHandleToSuperObject hSPO = (HIE_tdxHandleToSuperObject)LDT_LoadSection(LDT_szGetParam(1));
|
||||
if (hSPO)
|
||||
{
|
||||
hSoundElement=SECT_fn_hCreateElementLstSoundInteraction();
|
||||
SECT_fn_vSetSectorPointedElementLSTSoundInt(hSoundElement, hSPO);
|
||||
SCT_fn_vSetVolumeLSTSoundInt(hSoundElement,atol(LDT_szGetParam(2)));
|
||||
LST2_M_StaticAddTail(&(hSector->stListOfSectorsInSoundInteraction),hSoundElement);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case lTagVirtual : /* */
|
||||
{
|
||||
SECT_fn_vSetOnVirtualSector(hSector);
|
||||
}
|
||||
break;
|
||||
case lTagCameraType : /* */
|
||||
{
|
||||
hSector->cCameraType = atoi(LDT_szGetParam(1));
|
||||
}
|
||||
break;
|
||||
case lTagZFar : /* */
|
||||
{
|
||||
hSector->xZFar = (MTH_tdxReal) atof(LDT_szGetParam(1));
|
||||
}
|
||||
break;
|
||||
case 'oirP' : /* Priority */
|
||||
{
|
||||
SECT_fn_vSetSectorPriority(hSector, (char)atoi(LDT_szGetParam(1)));
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*****************************************************************
|
||||
Function name : fn_iLoadStaticLightsSector
|
||||
Description :
|
||||
Author : Ovidiu Scripa (oscripa@ubisoft.ro) - ROMTEAM
|
||||
Creation Date : 14-Oct-98
|
||||
Modified :
|
||||
Return type : int
|
||||
Argument : LDT_tdst_Link *pLink
|
||||
*****************************************************************/
|
||||
int fn_iLoadStaticLightsSector( LDT_tdst_Link *pLink )
|
||||
{
|
||||
LDT_tdeParseResult result=ParseResult_BeginSection;
|
||||
SECT_tdxHandleOfSectorObject hSector = (SECT_tdxHandleOfSectorObject)pLink->pParent->pObject;
|
||||
SECT_tdxHandleOfElementLstStaticLights hStaticLightsElement;
|
||||
|
||||
while( result!=ParseResult_EndSection )
|
||||
{
|
||||
result=LDT_GetNextEntry();
|
||||
switch( result )
|
||||
{
|
||||
case ParseResult_Entry: /* an entry */
|
||||
{
|
||||
GLI_tdxHandleToLight hLight= (GLI_tdxHandleToLight)LDT_LoadSection(LDT_szGetParam(1));
|
||||
|
||||
if(hLight)
|
||||
{
|
||||
hStaticLightsElement=SECT_fn_hCreateElementLstStaticLights();
|
||||
SECT_fn_vSetHandleOfLightsInStaticLightsList(hStaticLightsElement,hLight);
|
||||
LST2_M_StaticAddTail(&(hSector->stListOfStaticLights),hStaticLightsElement);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user