1215 lines
39 KiB
C
1215 lines
39 KiB
C
/*=========================================================================
|
|
* LoadGls.cpp : This module contain all functions used to load
|
|
* globals variables.
|
|
* This is a part of the Game project.
|
|
*
|
|
* Version 1.0
|
|
* Creation date 28/08/96
|
|
* Revision date
|
|
*
|
|
* That file needs to be compatible for all platforms.
|
|
*
|
|
* (c) Ubi Studios 1996
|
|
*=======================================================================*/
|
|
#include "ToolsCPA.h"
|
|
|
|
#include "Options/Options.h"
|
|
#include "macros.h"
|
|
|
|
#include "Main.h"
|
|
|
|
#include "Actions/AllActs.h"
|
|
|
|
#include "Structur/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 "PlayAnim/Interpol/a3x_mem.h"
|
|
|
|
#include "sna.h"
|
|
|
|
#ifndef U64
|
|
extern char g_cCDROM;
|
|
extern int g_iComplete;
|
|
#endif
|
|
extern char g_sLanguage[255];
|
|
|
|
/*-----------------------------------------------------------------------------
|
|
* Description : Read the script describing all globals variables
|
|
*-----------------------------------------------------------------------------
|
|
* Input : void
|
|
* Output : void
|
|
*-----------------------------------------------------------------------------
|
|
* Creation date : 30/08/96 Author : Francois
|
|
*-----------------------------------------------------------------------------
|
|
* Modification date : Modification Author :
|
|
* Modifications :
|
|
*---------------------------------------------------------------------------*/
|
|
/**************************************************************************/
|
|
void fn_vLoadGameMemoryScript(void)
|
|
{
|
|
#ifndef ACTIVE_EDITOR
|
|
char a256_cGameMemoryFile[256];
|
|
#endif /* !ACTIVE_EDITOR */
|
|
|
|
SCR_fn_v_Mem_SetCurrentLevel(GAM_C_FixDynamicScriptPriority);
|
|
SCR_fn_v_Mem_SetCurrentLinkLevel(GAM_C_FixDynamicScriptPriority);
|
|
|
|
#ifdef ACTIVE_EDITOR
|
|
SCR_fnp_st_RdL0_AnalyseSection(C_GameMemoryFile, SCR_CDF_uw_Anl_Normal);
|
|
#else
|
|
strcpy(a256_cGameMemoryFile,g_a64_cGameDataDirectory);
|
|
strcat(a256_cGameMemoryFile,"\\");
|
|
strcat(a256_cGameMemoryFile, C_GameMemoryFileName);
|
|
SCR_fnp_st_RdL0_AnalyseSection(a256_cGameMemoryFile, SCR_CDF_uw_Anl_Normal);
|
|
|
|
#endif /* ACTIVE_EDITOR */
|
|
|
|
SCR_fn_v_Mem_SetCurrentLevel(GAM_C_FixScriptPriority);
|
|
SCR_fn_v_Mem_SetCurrentLinkLevel(GAM_C_FixScriptPriority);
|
|
}
|
|
/**************************************************************************/
|
|
void fn_vLoadGameScript(void)
|
|
{
|
|
#ifndef ACTIVE_EDITOR
|
|
char a256_cFile[256];
|
|
#endif /* !ACTIVE_EDITOR */
|
|
|
|
fn_vChangeWindowTitle("Chargement du jeu.");
|
|
|
|
#ifdef ACTIVE_EDITOR
|
|
SCR_fnp_st_RdL0_AnalyseSection(C_GameScriptFile, SCR_CDF_uw_Anl_Normal);
|
|
#else
|
|
|
|
strcpy(a256_cFile,g_a64_cGameDataDirectory);
|
|
strcat(a256_cFile,"\\");
|
|
strcat(a256_cFile, C_GameScriptFileName);
|
|
SCR_fnp_st_RdL0_AnalyseSection(a256_cFile, SCR_CDF_uw_Anl_Normal);
|
|
|
|
#endif /* ACTIVE_EDITOR */
|
|
|
|
GAM_fn_vSetEngineInFixMode();
|
|
#ifdef ACTIVE_EDITOR
|
|
SCR_fnp_st_RdL0_AnalyseSection(C_GameVignetteFile, SCR_CDF_uw_Anl_Normal);
|
|
#else
|
|
strcpy(a256_cFile,g_a64_cGameDataDirectory);
|
|
strcat(a256_cFile,"\\");
|
|
strcat(a256_cFile, C_GameVignetteFileName);
|
|
SCR_fnp_st_RdL0_AnalyseSection(a256_cFile, SCR_CDF_uw_Anl_Normal);
|
|
#endif /* ACTIVE_EDITOR */
|
|
|
|
/* fn_vGameTestMemory();*/
|
|
}
|
|
/**************************************************************************/
|
|
/* Added 98/08/11 GuS*/
|
|
/* Chargement du game.dsc reduit a tout ce qui n'est pas encore binarise.*/
|
|
/* Cette fonction est appelee a la place de LoadGameScript lors d'un chargement binaire.*/
|
|
/* Cette fonction devrait etre temporaire...*/
|
|
void fn_vLoadReducedGameScript(void)
|
|
{
|
|
char a256_cFile[256];
|
|
char a256_cSection[256];
|
|
|
|
fn_vChangeWindowTitle("Chargement du jeu.");
|
|
|
|
strcpy(a256_cFile,g_a64_cGameDataDirectory);
|
|
strcat(a256_cFile,"\\");
|
|
strcat(a256_cFile, C_GameScriptFileName);
|
|
|
|
/* In case we load binary dsc without normal binary loading*/
|
|
if ( SNA_fn_ucGetLoadType()!=SNA_LOAD_SNAPSHOT )
|
|
{
|
|
/* Those are handled by SNA binary snapshot method.*/
|
|
sprintf( a256_cSection, "%s^InputDeviceManagerDescription", a256_cFile );
|
|
SCR_fnp_st_RdL0_AnalyseSection(a256_cSection, SCR_CDF_uw_Anl_Normal);
|
|
sprintf( a256_cSection, "%s^Texts", a256_cFile );
|
|
SCR_fnp_st_RdL0_AnalyseSection(a256_cSection, SCR_CDF_uw_Anl_Normal);
|
|
}
|
|
|
|
/* In case we load binary snapshots without loading binary dsc*/
|
|
if ( SNA_fn_ucGetLoadDscType()!=SNA_C_LoadBinaryDsc )
|
|
{
|
|
/* Those are handled by SNA binary dsc method*/
|
|
sprintf( a256_cSection, "%s^DirectoriesDescription", a256_cFile );
|
|
SCR_fnp_st_RdL0_AnalyseSection(a256_cSection, SCR_CDF_uw_Anl_Normal);
|
|
sprintf( a256_cSection, "%s^RandomManagerDescription", a256_cFile );
|
|
SCR_fnp_st_RdL0_AnalyseSection(a256_cSection, SCR_CDF_uw_Anl_Normal);
|
|
sprintf( a256_cSection, "%s^FirstLevelDescription", a256_cFile );
|
|
SCR_fnp_st_RdL0_AnalyseSection(a256_cSection, SCR_CDF_uw_Anl_Normal);
|
|
sprintf( a256_cSection, "%s^Vignette", a256_cFile );
|
|
SCR_fnp_st_RdL0_AnalyseSection(a256_cSection, SCR_CDF_uw_Anl_Normal);
|
|
sprintf( a256_cSection, "%s^BigFiles", a256_cFile );
|
|
SCR_fnp_st_RdL0_AnalyseSection(a256_cSection, SCR_CDF_uw_Anl_Normal);
|
|
sprintf( a256_cSection, "%s^GameOptionsFile", a256_cFile );
|
|
SCR_fnp_st_RdL0_AnalyseSection(a256_cSection, SCR_CDF_uw_Anl_Normal);
|
|
}
|
|
GAM_fn_vSetEngineInFixMode();
|
|
/* fn_vGameTestMemory();*/
|
|
}
|
|
/**************************************************************************/
|
|
void fn_vLoadGameFixScript(void)
|
|
{
|
|
#ifndef ACTIVE_EDITOR
|
|
char a256_cFile[256];
|
|
#endif /* !ACTIVE_EDITOR */
|
|
|
|
fn_vChangeWindowTitle("Chargement du Fix.");
|
|
#ifdef ACTIVE_EDITOR
|
|
VIG_fn_vSaveProgressBarStandardInfo(&VIG_g_stActualVignette,C_GameVignetteFile);
|
|
#else
|
|
SCR_fnp_st_RdL0_AnalyseSection(C_GameFixScriptFile, SCR_CDF_uw_Anl_Normal);
|
|
strcpy(a256_cFile,g_a64_cGameDataDirectory);
|
|
strcat(a256_cFile,"\\");
|
|
strcat(a256_cFile, C_GameVignetteFileName);
|
|
VIG_fn_vSaveProgressBarStandardInfo(&VIG_g_stActualVignette,a256_cFile);
|
|
#endif /* ACTIVE_EDITOR */
|
|
|
|
VIG_fn_vFreeVignette(&VIG_g_stActualVignette);
|
|
|
|
/* fn_vGameTestMemory();*/
|
|
}
|
|
/**************************************************************************/
|
|
|
|
/*-----------------------------------------------------------------------------
|
|
* Description : Read the script file describing the directories scripts
|
|
*-----------------------------------------------------------------------------
|
|
* Input : ...
|
|
* Output : void
|
|
*-----------------------------------------------------------------------------
|
|
* Creation date : 30/08/96 Author : Francois
|
|
*-----------------------------------------------------------------------------
|
|
* Modification date : Modification Author :
|
|
* Modifications :
|
|
*---------------------------------------------------------------------------*/
|
|
SCR_tde_Anl_ReturnValue fn_eScriptCallBackDirectoriesDescription(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 szFileName[_MAX_PATH];
|
|
char szPath[_MAX_PATH];
|
|
static char szInventorDirectory[_MAX_PATH];
|
|
char a256_cDataDirectory[_MAX_PATH];
|
|
|
|
_p_stFile=_p_stFile;
|
|
|
|
if ( M_IsTitle )
|
|
{
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteNoParamEntryToCurrentDscFile( SNA_C_ul_DirectoryDescTitle );
|
|
#endif
|
|
}
|
|
else
|
|
{
|
|
if (M_IsEntry)
|
|
{
|
|
if (M_ActionIs("DirectoryOfEngineDLL"))
|
|
{
|
|
fn_vSetEngineDLLPath(_ap_szParams[0]);
|
|
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteStringEntryToCurrentDscFile
|
|
(
|
|
SNA_C_ul_DirectoryOfEngineDLL,
|
|
_ap_szParams[0]
|
|
);
|
|
#endif
|
|
}
|
|
else if (M_ActionIs("DirectoryOfGameData"))
|
|
{
|
|
SCR_fn_v_RdL0_RegisterPath(_ap_szParams[0]);
|
|
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteStringEntryToCurrentDscFile
|
|
(
|
|
SNA_C_ul_DirectoryOfGameData,
|
|
_ap_szParams[0]
|
|
);
|
|
#endif
|
|
}
|
|
else if (M_ActionIs("DirectoryOfTexts"))
|
|
{
|
|
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
|
|
strcat(a256_cDataDirectory,_ap_szParams[0]);
|
|
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);
|
|
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteStringEntryToCurrentDscFile
|
|
(
|
|
SNA_C_ul_DirectoryOfTexts,
|
|
_ap_szParams[0]
|
|
);
|
|
#endif
|
|
}
|
|
else if (M_ActionIs("DirectoryOfWorld"))
|
|
{
|
|
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
|
|
strcat(a256_cDataDirectory,_ap_szParams[0]);
|
|
fn_vSetWorldDataPath(a256_cDataDirectory);
|
|
SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);
|
|
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteStringEntryToCurrentDscFile
|
|
(
|
|
SNA_C_ul_DirectoryOfWorld,
|
|
_ap_szParams[0]
|
|
);
|
|
#endif
|
|
}
|
|
else if (M_ActionIs("DirectoryOfLevels"))
|
|
{
|
|
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
|
|
strcat(a256_cDataDirectory,_ap_szParams[0]);
|
|
fn_vSetLevelsDataPath(a256_cDataDirectory);
|
|
SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);
|
|
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteStringEntryToCurrentDscFile
|
|
(
|
|
SNA_C_ul_DirectoryOfLevels,
|
|
_ap_szParams[0]
|
|
);
|
|
#endif
|
|
}
|
|
else if (M_ActionIs("DirectoryOfFamilies"))
|
|
{
|
|
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
|
|
strcat(a256_cDataDirectory,_ap_szParams[0]);
|
|
fn_vSetFamiliesDataPath(a256_cDataDirectory);
|
|
SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);
|
|
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteStringEntryToCurrentDscFile
|
|
(
|
|
SNA_C_ul_DirectoryOfFamilies,
|
|
_ap_szParams[0]
|
|
);
|
|
#endif
|
|
}
|
|
else if (M_ActionIs("DirectoryOfCharacters"))
|
|
{
|
|
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
|
|
strcat(a256_cDataDirectory,_ap_szParams[0]);
|
|
fn_vSetCharactersDataPath(a256_cDataDirectory);
|
|
SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);
|
|
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteStringEntryToCurrentDscFile
|
|
(
|
|
SNA_C_ul_DirectoryOfCharacters,
|
|
_ap_szParams[0]
|
|
);
|
|
#endif
|
|
}
|
|
else if (M_ActionIs("DirectoryOfAnimations"))
|
|
{
|
|
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
|
|
strcat(a256_cDataDirectory,_ap_szParams[0]);
|
|
fn_vSetAnimDataPath(a256_cDataDirectory);
|
|
SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);
|
|
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteStringEntryToCurrentDscFile
|
|
(
|
|
SNA_C_ul_DirectoryOfAnimations,
|
|
_ap_szParams[0]
|
|
);
|
|
#endif
|
|
}
|
|
else if (M_ActionIs("DirectoryOfGraphicsClasses"))
|
|
{
|
|
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
|
|
strcat(a256_cDataDirectory,_ap_szParams[0]);
|
|
fn_vSetGraphicsClassesDataPath(a256_cDataDirectory);
|
|
SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);
|
|
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteStringEntryToCurrentDscFile
|
|
(
|
|
SNA_C_ul_DirectoryOfGraphicsClasses,
|
|
_ap_szParams[0]
|
|
);
|
|
#endif
|
|
}
|
|
else if (M_ActionIs("DirectoryOfGraphicsBanks"))
|
|
{
|
|
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
|
|
strcat(a256_cDataDirectory,_ap_szParams[0]);
|
|
fn_vSetGraphicsBanksDataPath(a256_cDataDirectory);
|
|
SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);
|
|
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteStringEntryToCurrentDscFile
|
|
(
|
|
SNA_C_ul_DirectoryOfGraphicsBanks,
|
|
_ap_szParams[0]
|
|
);
|
|
#endif
|
|
}
|
|
else if (M_ActionIs("DirectoryOfMechanics"))
|
|
{
|
|
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
|
|
strcat(a256_cDataDirectory,_ap_szParams[0]);
|
|
fn_vSetMechanicsDataPath(a256_cDataDirectory);
|
|
SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);
|
|
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteStringEntryToCurrentDscFile
|
|
(
|
|
SNA_C_ul_DirectoryOfMechanics,
|
|
_ap_szParams[0]
|
|
);
|
|
#endif
|
|
}
|
|
else if (M_ActionIs("DirectoryOfSound"))
|
|
{
|
|
// ANNECY MT - 15/02/99 {
|
|
FILE *pFile;
|
|
char szSoundDirectory[255];
|
|
char *p_cSeparator;
|
|
|
|
// register GameData Directory
|
|
strcpy(szFileName, g_a64_cGameDataDirectory);
|
|
strcat(szFileName,_ap_szParams[0]);
|
|
fn_vSetSoundDataPath(szFileName);
|
|
SCR_fn_v_RdL0_RegisterPath(szFileName);
|
|
strcat(szFileName,"\\");
|
|
SND_fn_vAddDataDirectory(szFileName);
|
|
sprintf(szPath,"%s%s\\",szFileName,g_sLanguage);
|
|
SND_fn_vAddDataDirectory(szPath);
|
|
|
|
// register Specific Directory
|
|
pFile = fopen("SoundVersion.ini","rt");
|
|
if(pFile)
|
|
{
|
|
fgets(szSoundDirectory,255,pFile);
|
|
if(szSoundDirectory[ strlen(szSoundDirectory) - 1] == 0x0a)
|
|
szSoundDirectory[ strlen(szSoundDirectory) - 1] = 0;
|
|
//
|
|
strcpy(szFileName, szSoundDirectory);
|
|
strcat(szFileName,_ap_szParams[0]);
|
|
SCR_fn_v_RdL0_RegisterPath(szFileName);
|
|
strcat(szFileName,"\\");
|
|
SND_fn_vAddDataDirectory(szFileName);
|
|
sprintf(szPath,"%s%s\\",szFileName,g_sLanguage);
|
|
SND_fn_vAddDataDirectory(szPath);
|
|
//
|
|
fclose(pFile);
|
|
}
|
|
else
|
|
{
|
|
pFile = fopen("Version.ini","rt");
|
|
if(pFile)
|
|
{
|
|
fgets(szSoundDirectory,255,pFile);
|
|
p_cSeparator = strchr (szSoundDirectory,',');
|
|
if (p_cSeparator)
|
|
{
|
|
*p_cSeparator = 0;
|
|
}
|
|
else if(szSoundDirectory[ strlen(szSoundDirectory) - 1] == 0x0a)
|
|
{
|
|
szSoundDirectory[ strlen(szSoundDirectory) - 1] = 0;
|
|
}
|
|
//
|
|
strcpy(szFileName, szSoundDirectory);
|
|
strcat(szFileName,_ap_szParams[0]);
|
|
SCR_fn_v_RdL0_RegisterPath(szFileName);
|
|
strcat(szFileName,"\\");
|
|
SND_fn_vAddDataDirectory(szFileName);
|
|
sprintf(szPath,"%s%s\\",szFileName,g_sLanguage);
|
|
SND_fn_vAddDataDirectory(szPath);
|
|
//
|
|
fclose(pFile);
|
|
}
|
|
}
|
|
// END ANNECY MT }
|
|
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteStringEntryToCurrentDscFile
|
|
(
|
|
SNA_C_ul_DirectoryOfSound,
|
|
_ap_szParams[0]
|
|
);
|
|
#endif
|
|
}
|
|
else if (M_ActionIs("DirectoryOfVisuals"))
|
|
{
|
|
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
|
|
strcat(a256_cDataDirectory,_ap_szParams[0]);
|
|
fn_vSetVisualMaterialDataPath(a256_cDataDirectory);
|
|
SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);
|
|
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteStringEntryToCurrentDscFile
|
|
(
|
|
SNA_C_ul_DirectoryOfVisuals,
|
|
_ap_szParams[0]
|
|
);
|
|
#endif
|
|
}
|
|
else if (M_ActionIs("DirectoryOfEnvironment"))
|
|
{
|
|
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
|
|
strcat(a256_cDataDirectory,_ap_szParams[0]);
|
|
fn_vSetEnvironmentDataPath(a256_cDataDirectory);
|
|
SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);
|
|
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteStringEntryToCurrentDscFile
|
|
(
|
|
SNA_C_ul_DirectoryOfEnvironment,
|
|
_ap_szParams[0]
|
|
);
|
|
#endif
|
|
}
|
|
else if (M_ActionIs("DirectoryOfMaterials"))
|
|
{
|
|
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
|
|
strcat(a256_cDataDirectory,_ap_szParams[0]);
|
|
fn_vSetCollideMaterialDataPath(a256_cDataDirectory);
|
|
fn_vSetSoundMaterialDataPath(a256_cDataDirectory);
|
|
fn_vSetMechanicsMaterialDataPath(a256_cDataDirectory);
|
|
fn_vSetGameMaterialDataPath(a256_cDataDirectory);
|
|
SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);
|
|
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteStringEntryToCurrentDscFile
|
|
(
|
|
SNA_C_ul_DirectoryOfMaterials,
|
|
_ap_szParams[0]
|
|
);
|
|
#endif
|
|
}
|
|
else if (M_ActionIs("DirectoryOfSaveGame"))
|
|
{
|
|
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
|
|
strcat(a256_cDataDirectory,_ap_szParams[0]);
|
|
fn_vSetSaveGameDataPath(a256_cDataDirectory);
|
|
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteStringEntryToCurrentDscFile
|
|
(
|
|
SNA_C_ul_DirectoryOfSaveGame,
|
|
_ap_szParams[0]
|
|
);
|
|
#endif
|
|
}
|
|
else if (M_ActionIs("DirectoryOfExtras"))
|
|
{
|
|
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
|
|
strcat(a256_cDataDirectory,_ap_szParams[0]);
|
|
fn_vSetExtrasDataPath(a256_cDataDirectory);
|
|
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteStringEntryToCurrentDscFile
|
|
(
|
|
SNA_C_ul_DirectoryOfExtras,
|
|
_ap_szParams[0]
|
|
);
|
|
#endif
|
|
}
|
|
else if (M_ActionIs("DirectoryOfTexture"))
|
|
{
|
|
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
|
|
strcat(a256_cDataDirectory,_ap_szParams[0]);
|
|
fn_vSetTexturesDataPath(a256_cDataDirectory);
|
|
GLI_vSetPathOfTexture(fn_szGetTexturesDataPath());
|
|
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteStringEntryToCurrentDscFile
|
|
(
|
|
SNA_C_ul_DirectoryOfTexture,
|
|
_ap_szParams[0]
|
|
);
|
|
#endif
|
|
}
|
|
else if (M_ActionIs("DirectoryOfVignettes"))
|
|
{
|
|
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
|
|
strcat(a256_cDataDirectory,_ap_szParams[0]);
|
|
fn_vSetVignettesDataPath(a256_cDataDirectory);
|
|
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteStringEntryToCurrentDscFile
|
|
(
|
|
SNA_C_ul_DirectoryOfVignettes,
|
|
_ap_szParams[0]
|
|
);
|
|
#endif
|
|
}
|
|
else if (M_ActionIs("DirectoryOfOptions"))
|
|
{
|
|
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
|
|
strcat(a256_cDataDirectory,_ap_szParams[0]);
|
|
fn_vSetOptionsDataPath(a256_cDataDirectory);
|
|
SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);
|
|
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteStringEntryToCurrentDscFile
|
|
(
|
|
SNA_C_ul_DirectoryOfOptions,
|
|
_ap_szParams[0]
|
|
);
|
|
#endif
|
|
}
|
|
else if (M_ActionIs("DirectoryOfLipsSync"))
|
|
{
|
|
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
|
|
strcat(a256_cDataDirectory,_ap_szParams[0]);
|
|
SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);
|
|
sprintf(szPath,"%s\\%s",a256_cDataDirectory,g_sLanguage);
|
|
fn_vSetSyncLipsDataPath(szPath);
|
|
SCR_fn_v_RdL0_RegisterPath(szPath);
|
|
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteStringEntryToCurrentDscFile
|
|
(
|
|
SNA_C_ul_DirectoryOfLipsSync,
|
|
_ap_szParams[0]
|
|
);
|
|
#endif
|
|
}
|
|
else if (M_ActionIs("DirectoryOfZdx"))
|
|
{
|
|
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
|
|
strcat(a256_cDataDirectory,_ap_szParams[0]);
|
|
fn_vSetZdxDataPath(a256_cDataDirectory);
|
|
|
|
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteStringEntryToCurrentDscFile
|
|
(
|
|
SNA_C_ul_DirectoryOfZdx,
|
|
_ap_szParams[0]
|
|
);
|
|
#endif
|
|
}
|
|
else if (M_ActionIs("DirectoryOfEffects"))
|
|
{
|
|
strcpy(a256_cDataDirectory, g_a64_cGameDataDirectory);
|
|
strcat(a256_cDataDirectory,_ap_szParams[0]);
|
|
fn_vSetEffectsDataPath(a256_cDataDirectory);
|
|
SCR_fn_v_RdL0_RegisterPath(a256_cDataDirectory);
|
|
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteStringEntryToCurrentDscFile
|
|
(
|
|
SNA_C_ul_DirectoryOfEffects,
|
|
_ap_szParams[0]
|
|
);
|
|
#endif
|
|
}
|
|
}
|
|
else if (M_IsEnd)
|
|
{
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteNoParamEntryToCurrentDscFile( SNA_C_ulEndOfDescSection );
|
|
#endif
|
|
|
|
#ifndef U64
|
|
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
|
|
}
|
|
}
|
|
return(eReturnValue);
|
|
}
|
|
|
|
/*-----------------------------------------------------------------------------
|
|
* Description : Read the script file describing the input devices manager
|
|
*-----------------------------------------------------------------------------
|
|
* Input : ...
|
|
* Output : void
|
|
*-----------------------------------------------------------------------------
|
|
* Creation date : 10/04/97 Author : Francois
|
|
*-----------------------------------------------------------------------------
|
|
* Modification date : Modification Author :
|
|
* Modifications :
|
|
*---------------------------------------------------------------------------*/
|
|
SCR_tde_Anl_ReturnValue fn_eScriptCallBackInputDeviceManagerDescription(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;
|
|
|
|
_p_stFile=_p_stFile;
|
|
|
|
if (M_IsEntry)
|
|
{
|
|
if (M_ActionIs(C_Entry_InitInputDeviceManager))
|
|
{
|
|
short wHistSize = (short) fn_lAToI(_ap_szParams[0]) ;
|
|
#ifdef USE_IPT_DX5
|
|
IPT_fn_vInitInput ( wHistSize , fn_hGetApplicationInstance ( ) , fn_hGetApplicationWindow ( ) , ( GLD_tdhDevice ) 0 ) ;
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc ( ) )
|
|
{
|
|
SNA_fn_vWriteLongEntryToCurrentDscFile ( SNA_C_ul_InitInputDeviceManager , wHistSize ) ;
|
|
}
|
|
#endif /* RETAIL */
|
|
#else /* USE_IPT_WIN */
|
|
IPT_fn_vInitInput ( wHistSize , fn_hGetApplicationInstance ( ) , fn_hGetApplicationWindow ( ) ) ;
|
|
#endif /* USE_IPT_WIN */
|
|
}
|
|
if (M_ActionIs(C_Entry_AddInputDeviceFile))
|
|
IPT_fn_vReadInputScript(_ap_szParams[0]);
|
|
if (M_ActionIs(C_Entry_Computable))
|
|
IPT_fn_vEndReadInputScript();
|
|
}
|
|
return(eReturnValue);
|
|
}
|
|
|
|
/*-----------------------------------------------------------------------------
|
|
* Description : Read the script file describing the random manager
|
|
*-----------------------------------------------------------------------------
|
|
* Input : ...
|
|
* Output : void
|
|
*-----------------------------------------------------------------------------
|
|
* Creation date : 22/04/97 Author : Francois
|
|
*-----------------------------------------------------------------------------
|
|
* Modification date : Modification Author :
|
|
* Modifications :
|
|
*---------------------------------------------------------------------------*/
|
|
SCR_tde_Anl_ReturnValue fn_eScriptCallBackRandomManagerDescription(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;
|
|
|
|
_p_stFile=_p_stFile;
|
|
|
|
if (M_IsEntry)
|
|
{
|
|
if (M_ActionIs(C_Entry_InitRandomManager))
|
|
{
|
|
RND_fn_vInitRandom();
|
|
RND_fn_vReadRandomScript(_ap_szParams[0]);
|
|
}
|
|
}
|
|
|
|
return(eReturnValue);
|
|
}
|
|
|
|
/*-----------------------------------------------------------------------------
|
|
* Description : Read the script file describing the random manager
|
|
*-----------------------------------------------------------------------------
|
|
* Input : ...
|
|
* Output : void
|
|
*-----------------------------------------------------------------------------
|
|
* Creation date : 22/04/97 Author : Francois
|
|
*-----------------------------------------------------------------------------
|
|
* Modification date : Modification Author :
|
|
* Modifications :
|
|
*---------------------------------------------------------------------------*/
|
|
SCR_tde_Anl_ReturnValue fn_eScriptCallBackGameOptionsFileDescription(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;
|
|
|
|
_p_stFile=_p_stFile;
|
|
|
|
if (M_IsTitle)
|
|
{
|
|
/* if((SNA_fn_ucGetLoadType()==SNA_SAVE_SNAPSHOT))
|
|
{
|
|
g_stEngineStructure.bSkipMainMenu = TRUE;
|
|
}
|
|
else
|
|
{
|
|
g_stEngineStructure.bSkipMainMenu = FALSE;
|
|
}
|
|
*/
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteNoParamEntryToCurrentDscFile( SNA_C_ul_GameOptionDescTitle );
|
|
#endif
|
|
|
|
}
|
|
else if (M_IsEntry)
|
|
{
|
|
/*
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteNoParamEntryToCurrentDscFile( SNA_C_ul_GameOptionDescTitle );
|
|
*/
|
|
/*if (M_ActionIs(C_Entry_CreditsLevel))
|
|
{
|
|
strcpy(g_stEngineStructure.szCreditsLevelName,_ap_szParams[0]);
|
|
}
|
|
else*/
|
|
/*if (M_ActionIs("SkipMainMenu"))
|
|
{
|
|
g_stEngineStructure.bSkipMainMenu = TRUE;
|
|
}*/
|
|
if (M_ActionIs(C_Entry_GameOptionsDefault))
|
|
{
|
|
fn_vSetDefaultGameOptionsFileName(_ap_szParams[0]);
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteStringEntryToCurrentDscFile
|
|
(
|
|
SNA_C_ul_DefaultFile,
|
|
_ap_szParams[0]
|
|
);
|
|
#endif
|
|
}
|
|
else if (M_ActionIs(C_Entry_GameOptionsCurrent))
|
|
{
|
|
fn_vSetCurrentGameOptionsFileName(_ap_szParams[0]);
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteStringEntryToCurrentDscFile
|
|
(
|
|
SNA_C_ul_CurrentFile,
|
|
_ap_szParams[0]
|
|
);
|
|
#endif
|
|
}
|
|
else if (M_ActionIs(C_Entry_FrameSynchro))
|
|
{
|
|
/* ON/OFF, NbFrame (0 for hysteresis) and %limit for hysteresis*/
|
|
GLD_vSetFrameSynchro(_ap_szParams[0],_ap_szParams[1],_ap_szParams[2]);
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWrite3StringsEntryToCurrentDscFile(SNA_C_ul_FrameSynchro, _ap_szParams[0],_ap_szParams[1],_ap_szParams[2]);
|
|
#endif
|
|
}
|
|
}
|
|
else
|
|
if (M_IsEnd)
|
|
{
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteNoParamEntryToCurrentDscFile( SNA_C_ulEndOfDescSection );
|
|
#endif
|
|
}
|
|
return(eReturnValue);
|
|
}
|
|
|
|
/*-----------------------------------------------------------------------------
|
|
* Description : Read the script file describing the size of anim stacks
|
|
*-----------------------------------------------------------------------------
|
|
* Creation date : 27/10/98 Author : Carlos Torres
|
|
*-----------------------------------------------------------------------------*/
|
|
SCR_tde_Anl_ReturnValue fn_eScriptCallBackAnimStacksDescription(SCR_tdst_File_Description *_p_stFile,char *_p_szName,char *_ap_szParams[],SCR_tde_Anl_Action _eAction) {
|
|
SCR_tde_Anl_ReturnValue eReturnValue = SCR_ERV_Anl_NormalReturn;
|
|
unsigned long ulSize;
|
|
|
|
if (M_IsEntry) {
|
|
ulSize = atol(_ap_szParams[0]);
|
|
|
|
if (M_ActionIs(C_Entry_A3dGeneral)) {
|
|
fn_vSetStackSize(eStackA3dGENERAL,ulSize);
|
|
}
|
|
else if (M_ActionIs(C_Entry_Vertexes)) {
|
|
fn_vSetStackSize(eStackVertexes,ulSize);
|
|
}
|
|
else if (M_ActionIs(C_Entry_Quaternions)) {
|
|
fn_vSetStackSize(eStackQuaternions,ulSize);
|
|
}
|
|
else if (M_ActionIs(C_Entry_Hierarchies)) {
|
|
fn_vSetStackSize(eStackHierarchies,ulSize);
|
|
}
|
|
else if (M_ActionIs(C_Entry_NTTO)) {
|
|
fn_vSetStackSize(eStackNTTO,ulSize);
|
|
}
|
|
else if (M_ActionIs(C_Entry_OnlyFrames)) {
|
|
fn_vSetStackSize(eStackOnlyFrames,ulSize);
|
|
}
|
|
else if (M_ActionIs(C_Entry_Channels)) {
|
|
fn_vSetStackSize(eStackChannels,ulSize);
|
|
}
|
|
else if (M_ActionIs(C_Entry_Frames)) {
|
|
fn_vSetStackSize(eStackFrames,ulSize);
|
|
}
|
|
else if (M_ActionIs(C_Entry_FramesKF)) {
|
|
fn_vSetStackSize(eStackFramesKF,ulSize);
|
|
}
|
|
else if (M_ActionIs(C_Entry_KeyFrames)) {
|
|
fn_vSetStackSize(eStackKeyFrames,ulSize);
|
|
}
|
|
else if (M_ActionIs(C_Entry_Events)) {
|
|
fn_vSetStackSize(eStackEvents,ulSize);
|
|
}
|
|
else if (M_ActionIs(C_Entry_MorphData)) {
|
|
fn_vSetStackSize(eStackMorphData,ulSize);
|
|
}
|
|
}
|
|
|
|
return(eReturnValue);
|
|
}
|
|
|
|
/**************************************************************************/
|
|
/*
|
|
SCR_tde_Anl_ReturnValue fn_eScriptCallBackPreloadSectionInFix(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;
|
|
|
|
_p_stFile=_p_stFile;
|
|
|
|
if (M_IsEntry)
|
|
{
|
|
if ((M_ActionIs(C_Entry_PreloadSection))&&(SNA_fn_ucGetLoadType()!=SNA_LOAD_SNAPSHOT))
|
|
{
|
|
SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[0], SCR_CDF_uw_Anl_Normal);
|
|
SNA_g_stFixInfo.ulNbObject=0;
|
|
}
|
|
else if (M_ActionIs(C_Entry_SecondPassForCharacter)&&(SNA_fn_ucGetLoadType()!=SNA_LOAD_SNAPSHOT))
|
|
{
|
|
static tdstEngineObject *p_stEngineObject = NULL;
|
|
SCR_tdst_Cxt_Values *p_stValues ;
|
|
|
|
p_stValues = SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[0], SCR_CDF_uw_Anl_Normal);
|
|
if(p_stValues)
|
|
p_stEngineObject=(tdstEngineObject *)(p_stValues->a_ulValues[0]);
|
|
|
|
SNA_g_stFixInfo.a20_stObjects[SNA_g_stFixInfo.ulNbObject]=p_stEngineObject;
|
|
SNA_g_stFixInfo.ulNbObject++;
|
|
}
|
|
}
|
|
return(eReturnValue);
|
|
}
|
|
*/
|
|
/**************************************************************************/
|
|
/*
|
|
* GuS 98/08/07: *Attention* si vous modifiez cette fonction et que cela change
|
|
* les traitements lors du chargement du jeu, il faut egalement modifier
|
|
* le module SNA (SnaNoScr).
|
|
*/
|
|
SCR_tde_Anl_ReturnValue fn_eScriptCallBackFirstLevel(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;
|
|
|
|
_p_stFile=_p_stFile;
|
|
|
|
if (M_IsTitle)
|
|
{
|
|
#ifndef RETAIL
|
|
g_cChooseLevel = -1;
|
|
#endif /* !RETAIL */
|
|
g_stEngineStructure.ucNumberOfLevels = 0;
|
|
g_stEngineStructure.ucCurrentLevel =(unsigned char) ((_ap_szParams[0] != NULL ) ? atoi( _ap_szParams[0] ) : 0);
|
|
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteLongEntryToCurrentDscFile
|
|
(
|
|
SNA_C_ul_LevelNameTitle,
|
|
(unsigned char) ((_ap_szParams[0] != NULL ) ? atoi( _ap_szParams[0] ) : 0)
|
|
);
|
|
#endif
|
|
}
|
|
if (M_IsEntry)
|
|
{
|
|
if (M_ActionIs("LevelName"))
|
|
{
|
|
M_CheckScriptParamNumber(1);
|
|
/* 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(_ap_szParams[0]);
|
|
}
|
|
strcpy( g_stEngineStructure.a_szLevelName[ g_stEngineStructure.ucNumberOfLevels++], _ap_szParams[0] );
|
|
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteStringEntryToCurrentDscFile ( SNA_C_ul_LevelName, _ap_szParams[0] );
|
|
|
|
#endif
|
|
}
|
|
}
|
|
else if ( M_IsEnd )
|
|
{
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteNoParamEntryToCurrentDscFile ( SNA_C_ulEndOfDescSection );
|
|
#endif
|
|
}
|
|
|
|
|
|
return(eReturnValue);
|
|
}
|
|
|
|
/**************************************************************************/
|
|
extern void GAM_fn_vReadStringInUbiIniFile( char *_szKey, char *_szID, long _lBufferLength, char *_szBuffer ) ;
|
|
|
|
SCR_tde_Anl_ReturnValue fn_eScriptCallBackLanguage(SCR_tdst_File_Description *_p_stFile,char *_p_szName,char *_ap_szParams[],SCR_tde_Anl_Action _eAction)
|
|
{
|
|
SCR_tde_Anl_ReturnValue eReturnValue = SCR_ERV_Anl_NormalReturn;
|
|
static unsigned char s_ucLanguage ;
|
|
|
|
_p_stFile = _p_stFile ;
|
|
|
|
if ( M_IsTitle )
|
|
{
|
|
if ( g_stEngineStructure . ucNbLanguages )
|
|
{
|
|
M_GameFatalError ( E_uwGameLanguageDefinition ) ;
|
|
return ( eReturnValue ) ;
|
|
}
|
|
g_stEngineStructure . ucNbLanguages = ( unsigned char ) ( ( _ap_szParams [ 0 ] != NULL ) ? atoi ( _ap_szParams [ 0 ] ) : 0 ) ;
|
|
g_stEngineStructure . p_stLanguageTable = M_p_GameMallocInHLM ( g_stEngineStructure . ucNbLanguages * sizeof ( tdstLanguageStructure ) ) ;
|
|
s_ucLanguage = 0 ;
|
|
}
|
|
if ( M_IsEntry )
|
|
{
|
|
if ( M_ActionIs ( C_AddLanguage ) )
|
|
{
|
|
M_CheckScriptParamNumber ( 2 ) ;
|
|
/* ignore the "Common" language definition, useless for PC, but necessary for N64 */
|
|
if ( stricmp ( _ap_szParams[0] , "Common" ) )
|
|
{
|
|
if ( s_ucLanguage < g_stEngineStructure.ucNbLanguages )
|
|
{
|
|
strcpy ( g_stEngineStructure . p_stLanguageTable [ s_ucLanguage ] . szLanguageCode , _ap_szParams [ 0 ] ) ;
|
|
strcpy ( g_stEngineStructure . p_stLanguageTable [ s_ucLanguage ] . szLanguageText , _ap_szParams [ 1 ] ) ;
|
|
s_ucLanguage ++ ;
|
|
}
|
|
else
|
|
{
|
|
M_GameFatalError ( E_uwGameLanguage ) ;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if ( M_IsEnd )
|
|
{
|
|
char szBuffer [ _MAX_PATH ] ;
|
|
int j ;
|
|
szBuffer [ 0 ] = 0 ;
|
|
GAM_fn_vReadStringInUbiIniFile ( "RAYMAN2" , "Language" , _MAX_PATH, szBuffer ) ;
|
|
j = 0 ;
|
|
g_stEngineStructure . ucCurrentLanguage = 0 ;
|
|
while ( j < g_stEngineStructure . ucNbLanguages )
|
|
{
|
|
if ( stricmp ( szBuffer , g_stEngineStructure . p_stLanguageTable [ j ] . szLanguageCode ) == 0 )
|
|
{
|
|
g_stEngineStructure . ucCurrentLanguage = ( unsigned char ) j ;
|
|
break ;
|
|
}
|
|
j ++ ;
|
|
}
|
|
}
|
|
return eReturnValue ;
|
|
}
|
|
|
|
/**************************************************************************/
|
|
SCR_tde_Anl_ReturnValue fn_eScriptCallBackAddStringsFiles(SCR_tdst_File_Description *_p_stFile,char *_p_szName,char *_ap_szParams[],SCR_tde_Anl_Action _eAction)
|
|
{
|
|
SCR_tde_Anl_ReturnValue eReturnValue = SCR_ERV_Anl_NormalReturn;
|
|
/*unsigned char ucOldACPModeMalloc;*/
|
|
|
|
_p_stFile=_p_stFile;
|
|
|
|
if (M_IsEntry)
|
|
{
|
|
if (M_ActionIs(C_EntryAddStringsFile))
|
|
{
|
|
M_CheckScriptParamNumber(1);
|
|
|
|
/*ucOldACPModeMalloc = GEO_M_ucGetMemMallocMode();*/
|
|
/*GEO_xSelectMemoryChannel(ACP_TextMemoryChannel);*/
|
|
|
|
SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[0], SCR_CDF_uw_Anl_Normal);
|
|
/*GEO_xSelectMemoryChannel(ucOldACPModeMalloc);*/
|
|
|
|
/* fn_vGameTestMemory();*/
|
|
}
|
|
/* else if (M_ActionIs(C_EntryAddFontFile))
|
|
{
|
|
M_CheckScriptParamNumber(1);
|
|
if(SNA_fn_ucGetLoadType()!=SNA_LOAD_SNAPSHOT)
|
|
SCR_fnp_st_RdL0_AnalyseSection(_ap_szParams[0], SCR_CDF_uw_Anl_Normal);
|
|
fn_vGameTestMemory();
|
|
}*/
|
|
}
|
|
|
|
return(eReturnValue);
|
|
}
|
|
/**************************************************************************/
|
|
SCR_tde_Anl_ReturnValue fn_eScriptCallBackBigFile(SCR_tdst_File_Description *_p_stFile,char *_p_szName,char *_ap_szParams[],SCR_tde_Anl_Action _eAction)
|
|
{
|
|
char a256_cGameMemoryFile[256];
|
|
SCR_tde_Anl_ReturnValue eReturnValue = SCR_ERV_Anl_NormalReturn;
|
|
|
|
_p_stFile=_p_stFile;
|
|
|
|
if ( M_IsTitle )
|
|
{
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteNoParamEntryToCurrentDscFile( SNA_C_ul_BigFileDescTitle );
|
|
#endif
|
|
}
|
|
else
|
|
{
|
|
if (M_IsEntry)
|
|
{
|
|
if (M_ActionIs(C_Entry_BigFileVignettes))
|
|
{
|
|
M_CheckScriptParamNumber(1);
|
|
VIG_fn_vCloseBigFileVignette();
|
|
strcpy(a256_cGameMemoryFile,g_a64_cGameDataDirectory);
|
|
strcat(a256_cGameMemoryFile, _ap_szParams[0]);
|
|
VIG_fn_vOpenBigFileVignette(a256_cGameMemoryFile);
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteStringEntryToCurrentDscFile
|
|
(
|
|
SNA_C_ul_BigFileVignettes,
|
|
_ap_szParams[0]
|
|
);
|
|
#endif
|
|
}
|
|
else if (M_ActionIs(C_Entry_BigFileTextures))
|
|
{
|
|
M_CheckScriptParamNumber(1);
|
|
GLI_fn_vCloseBigFileTextures();
|
|
strcpy(a256_cGameMemoryFile,g_a64_cGameDataDirectory);
|
|
strcat(a256_cGameMemoryFile, _ap_szParams[0]);
|
|
GLI_fn_vOpenBigFileTextures(a256_cGameMemoryFile);
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteStringEntryToCurrentDscFile
|
|
(
|
|
SNA_C_ul_BigFileTextures,
|
|
_ap_szParams[0]
|
|
);
|
|
#endif
|
|
}
|
|
}
|
|
else
|
|
if (M_IsEnd)
|
|
{
|
|
#ifndef RETAIL
|
|
if ( SNA_M_bTestSaveGameDesc() )
|
|
SNA_fn_vWriteNoParamEntryToCurrentDscFile( SNA_C_ulEndOfDescSection );
|
|
#endif
|
|
}
|
|
}
|
|
|
|
return(eReturnValue);
|
|
}
|
|
/**************************************************************************/
|
|
void fn_vDeleteAllFixReUsableSections(void)
|
|
{
|
|
SCR_fn_v_RdL0_DeleteOpenFile(".dsc",SCR_CDR_c_RdL0_Contains);
|
|
SCR_fn_v_RdL0_DeleteOpenSection(".dsc",SCR_CDR_c_RdL0_Contains);
|
|
SCR_fn_v_RdL0_DeleteOpenFile(".ipt",SCR_CDR_c_RdL0_Contains);
|
|
SCR_fn_v_RdL0_DeleteOpenSection(".ipt",SCR_CDR_c_RdL0_Contains);
|
|
SCR_fn_v_RdL0_DeleteOpenFile(".mnu",SCR_CDR_c_RdL0_Contains);
|
|
SCR_fn_v_RdL0_DeleteOpenSection(".mnu",SCR_CDR_c_RdL0_Contains);
|
|
SCR_fn_v_RdL0_DeleteOpenFile(".rnd",SCR_CDR_c_RdL0_Contains);
|
|
SCR_fn_v_RdL0_DeleteOpenSection(".rnd",SCR_CDR_c_RdL0_Contains);
|
|
SCR_fn_v_RdL0_DeleteOpenFile(".fix",SCR_CDR_c_RdL0_Contains);
|
|
SCR_fn_v_RdL0_DeleteOpenSection(".fix",SCR_CDR_c_RdL0_Contains);
|
|
}
|
|
/**************************************************************************/
|