#if defined (WIN32) #include #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*/