703 lines
21 KiB
C
703 lines
21 KiB
C
/*=========================================================================
|
||
* GamOpt.c : Game options
|
||
* This is a part of the Game project.
|
||
*
|
||
* Version 1.0
|
||
* Creation date 04/05/97
|
||
* Revision date
|
||
*
|
||
* That file needs to be compatible for all platforms.
|
||
*
|
||
* (c) Ubi Studios 1997
|
||
*=======================================================================*/
|
||
|
||
#define SCR_DM_OptCFiles
|
||
|
||
|
||
|
||
#include "ToolsCPA.h"
|
||
|
||
#include "Options/Options.h"
|
||
#include "Macros.h"
|
||
|
||
#include "Structur/MemGame.h"
|
||
#include "Structur/EngMode.h"
|
||
#include "Structur/ErrGame.h"
|
||
#include "Structur/GameScpt.h"
|
||
|
||
#include "Basic.h"
|
||
#include "GamOpt.h"
|
||
#include "GamSave.h"
|
||
#include "micros.h"
|
||
#include "Zemem.h"
|
||
#include "CMP.h"
|
||
|
||
/*ANNECY BBB 03/11/97 {*/
|
||
tdstGameOptions g_stGameOptions;
|
||
/*ENDANNECY BBB 03/11/97 }*/
|
||
|
||
#ifdef __cplusplus
|
||
extern "C" {
|
||
#endif
|
||
extern signed char g_cJoystickXmin;
|
||
extern signed char g_cJoystickXmax;
|
||
extern signed char g_cJoystickYmin;
|
||
extern signed char g_cJoystickYmax;
|
||
#ifndef U64
|
||
extern signed char g_cJoystickXcenter;
|
||
extern signed char g_cJoystickYcenter;
|
||
#endif
|
||
#ifdef __cplusplus
|
||
}
|
||
#endif
|
||
|
||
/**************** F PEREZ *******************/
|
||
extern long g_ucNbSaveGameSlots;
|
||
extern char g_a_szSlotNames[4];
|
||
|
||
extern BOOL fn_bActualizeSlotPos(void);
|
||
extern char * fn_bGetStringSlotDate(unsigned long _ulSlotId);
|
||
|
||
long fn_lGetNbAvailableSlotPc();
|
||
long fn_bRecupSlotNum(long lSlotPosId);
|
||
BOOL fn_bActualizeSlotListBis(long lNbAvailableSlots);
|
||
BOOL fn_bEraseGameInSlotList( long lSlotId);
|
||
char * fn_cRecupSlotName(long lSlotId);
|
||
long fn_bScanDir( char *p_cDir, BOOL bRecursive);
|
||
|
||
int fn_iVersionN64_PC(void);
|
||
extern StructRecupPosSlot * g_p_LastStructRecupPosSlot;
|
||
/****************************************************/
|
||
|
||
/**************************************************************************/
|
||
void fn_vSetDefaultGameOptionsFileName(char *_szFileName)
|
||
{
|
||
strcpy(g_stGameOptions.szDefaultFileName,_szFileName);
|
||
}
|
||
/**************************************************************************/
|
||
void fn_vSetCurrentGameOptionsFileName(char *_szFileName)
|
||
{
|
||
strcpy(g_stGameOptions.szCurrentFileName,_szFileName);
|
||
}
|
||
/**************************************************************************/
|
||
|
||
unsigned char fn_bSaveCurrentGameOptions(void)
|
||
{
|
||
unsigned char bReturn = TRUE;
|
||
|
||
FILE *p_stTempFile;
|
||
char szFileName[MAX_PATH];
|
||
char szTempFile[_MAX_PATH];
|
||
int Version;
|
||
|
||
#ifndef U64
|
||
/*************** FPEREZ ***************/
|
||
long lNbSaveGameSlot;
|
||
StructRecupPosSlot *p_StructRecupPosSlot;
|
||
/*********************************************/
|
||
#endif
|
||
|
||
/*unsigned long lValue;*/
|
||
|
||
sprintf(szTempFile,"%s/TT.tmp",fn_szGetTempDataPath());
|
||
sprintf(szFileName,"%s/%s",fn_szGetOptionsDataPath(),g_stGameOptions.szCurrentFileName);
|
||
|
||
FIL_fn_bValidatePath(".",szFileName);
|
||
remove(szTempFile);
|
||
p_stTempFile = fopen(szTempFile,"wb");
|
||
if (p_stTempFile!=NULL)
|
||
{
|
||
long lIndex;
|
||
char * szTag = __DATE__ " " __TIME__ ;
|
||
|
||
/* version that saved the file */
|
||
lIndex = strlen ( szTag ) ;
|
||
fwrite(&lIndex,1,sizeof(unsigned long),p_stTempFile);
|
||
fwrite(szTag,1,lIndex+1,p_stTempFile);
|
||
/**** Player name ****/
|
||
/*lValue = strlen(g_stGameOptions.szPlayerName);*/
|
||
/*fwrite(&lValue,1,sizeof(unsigned long),p_stTempFile);*/
|
||
/*fwrite(g_stGameOptions.szPlayerName,lValue,sizeof(char),p_stTempFile);*/
|
||
/**** Slot names ****/
|
||
|
||
/***************** FPEREZ **************************/
|
||
#ifndef U64
|
||
#ifdef ACTIVE_EDITOR
|
||
Version = fn_iVersionN64_PC();
|
||
if( Version == 1 /* N64 */)
|
||
{
|
||
for ( lIndex = 0; lIndex < C_ucNbSaveGameSlots; lIndex ++ )
|
||
{
|
||
fwrite(&g_stGameOptions.a_szSlotNames[lIndex], 1, C_ucSaveGameSlotNameLength + 1, p_stTempFile);
|
||
}
|
||
}
|
||
else if( Version == 2 /* PC */)
|
||
{
|
||
//lNbSaveGameSlot = fn_lGetNbAvailableSlotsPc();
|
||
lNbSaveGameSlot = g_ucNbSaveGameSlots;
|
||
p_StructRecupPosSlot = g_p_LastStructRecupPosSlot;
|
||
for ( lIndex = 0; lIndex < lNbSaveGameSlot; lIndex ++ )
|
||
{
|
||
fwrite( p_StructRecupPosSlot->a_szSlotNames , 1, C_ucSaveGameSlotNameLength + 1, p_stTempFile);
|
||
p_StructRecupPosSlot = p_StructRecupPosSlot->pt_NextStructRecupPosSlot;
|
||
}
|
||
}
|
||
#else // PC sans editeur
|
||
//lNbSaveGameSlot = fn_lGetNbAvailableSlotsPc();
|
||
lNbSaveGameSlot = g_ucNbSaveGameSlots;
|
||
p_StructRecupPosSlot = g_p_LastStructRecupPosSlot;
|
||
for ( lIndex = 0; lIndex < lNbSaveGameSlot; lIndex ++ )
|
||
{
|
||
fwrite( p_StructRecupPosSlot->a_szSlotNames , 1, C_ucSaveGameSlotNameLength + 1, p_stTempFile);
|
||
p_StructRecupPosSlot = p_StructRecupPosSlot->pt_NextStructRecupPosSlot;
|
||
}
|
||
#endif // EDITOR
|
||
#else /* U64*/
|
||
for ( lIndex = 0; lIndex < C_ucNbSaveGameSlots; lIndex ++ )
|
||
{
|
||
fwrite(&g_stGameOptions.a_szSlotNames[lIndex], 1, C_ucSaveGameSlotNameLength + 1, p_stTempFile);
|
||
}
|
||
#endif // U64
|
||
|
||
/**** Video options ****/
|
||
fwrite(&g_stGameOptions.ulDetails,1,sizeof(unsigned long),p_stTempFile);
|
||
fwrite(&g_stGameOptions.ulScreenSize,1,sizeof(unsigned long),p_stTempFile);
|
||
lIndex = GLI_fn_lGetBrightness() ;
|
||
fwrite(&lIndex,1,sizeof(unsigned long),p_stTempFile);
|
||
/**** Sound options ****/
|
||
fwrite(&g_stGameOptions.ulFxVolume,1,sizeof(unsigned long),p_stTempFile);
|
||
fwrite(&g_stGameOptions.ulMusicVolume,1,sizeof(unsigned long),p_stTempFile);
|
||
fwrite(&g_stGameOptions.ulVoiceVolume,1,sizeof(unsigned long),p_stTempFile);
|
||
|
||
#ifdef USE_IPT_DX5
|
||
/* Save joystick calibration */
|
||
fwrite( &g_cJoystickXmin, sizeof(signed char), 1, p_stTempFile );
|
||
fwrite( &g_cJoystickXmax, sizeof(signed char), 1, p_stTempFile );
|
||
fwrite( &g_cJoystickYmin, sizeof(signed char), 1, p_stTempFile );
|
||
fwrite( &g_cJoystickYmax, sizeof(signed char), 1, p_stTempFile );
|
||
|
||
#ifndef U64
|
||
fwrite( &g_cJoystickXcenter, sizeof(signed char), 1, p_stTempFile );
|
||
fwrite( &g_cJoystickYcenter, sizeof(signed char), 1, p_stTempFile );
|
||
#endif
|
||
#endif
|
||
|
||
/**** IPT options ****/
|
||
IPT_fn_bSaveOptionsInFile(p_stTempFile);
|
||
|
||
fclose(p_stTempFile);
|
||
CMP_fn_vCompressFileIn(szTempFile,szFileName,D_CMP_DIFF);
|
||
}
|
||
else
|
||
bReturn = FALSE;
|
||
|
||
remove(szTempFile);
|
||
|
||
return(bReturn);
|
||
}
|
||
/**************************************************************************/
|
||
/* Modif : 25/05/98 Default volume 127 Carlos Torres*/
|
||
unsigned char fn_bLoadCurrentGameOptions(void)
|
||
{
|
||
ACP_tdxBool bReturn = TRUE;
|
||
|
||
if (!fn_bLoadGameOptions(g_stGameOptions.szCurrentFileName))
|
||
{
|
||
if (!fn_bLoadDefaultGameOptions())
|
||
{
|
||
/*fn_vChangePlayerName("NOBODY");*/
|
||
bReturn = FALSE;
|
||
}
|
||
}
|
||
|
||
/*///////////////////////////////////// en attendant les menus*/
|
||
/* default values if no config files:*/
|
||
if( !bReturn )
|
||
{
|
||
long lIndex;
|
||
g_stGameOptions.ulFxVolume = 127;
|
||
g_stGameOptions.ulVoiceVolume = 127;
|
||
g_stGameOptions.ulMusicVolume = 127;
|
||
g_stGameOptions.ulDetails = 0;
|
||
g_stGameOptions.ulScreenSize = 0;
|
||
for ( lIndex = 0; lIndex < C_ucNbSaveGameSlots; lIndex ++ )
|
||
{
|
||
/* zero-terminated whitespace slot names -> invalid names*/
|
||
memset(&g_stGameOptions.a_szSlotNames[lIndex], ' ', C_ucSaveGameSlotNameLength);
|
||
g_stGameOptions.a_szSlotNames[lIndex][C_ucSaveGameSlotNameLength] = '\0';
|
||
}
|
||
}
|
||
/*///////////////////////////////////// en attendant les menus*/
|
||
|
||
return bReturn;
|
||
}
|
||
/**************************************************************************/
|
||
unsigned char fn_bLoadDefaultGameOptions(void)
|
||
{
|
||
return(fn_bLoadGameOptions(g_stGameOptions.szDefaultFileName));
|
||
}
|
||
/**************************************************************************/
|
||
unsigned char fn_bLoadGameOptions(char *_szFileName)
|
||
{
|
||
unsigned char bReturn = FALSE;
|
||
char szFileName[MAX_PATH];
|
||
/*char szTemp[100];*/
|
||
FILE *p_stTempFile;
|
||
char szTempFile[_MAX_PATH];
|
||
int Version;
|
||
|
||
#ifndef U64
|
||
/*************** FPEREZ ***************/
|
||
unsigned char a128_cCurrentSlotDir[128];
|
||
unsigned char a128_cNextSlotDir[128];
|
||
long lNbSaveGameSlot;
|
||
StructRecupPosSlot *p_StructRecupPosSlot;
|
||
/*********************************************/
|
||
#endif
|
||
|
||
sprintf(szTempFile,"%s/TT.tmp",fn_szGetTempDataPath());
|
||
sprintf(szFileName,"%s/%s",fn_szGetOptionsDataPath(),_szFileName);
|
||
|
||
remove(szTempFile);
|
||
if (CMP_fn_bExpandFileIn(szFileName,szTempFile,D_CMP_DIFF))
|
||
{
|
||
p_stTempFile = fopen(szTempFile,"rb");
|
||
if (p_stTempFile!=NULL)
|
||
{
|
||
long lIndex;
|
||
char * szTag = __DATE__ " " __TIME__ , * szTag2 ;
|
||
|
||
/* version that saved the file */
|
||
fread(&lIndex,1,sizeof(unsigned long),p_stTempFile);
|
||
szTag2 = alloca(lIndex+1) ;
|
||
fread(szTag2,1,lIndex+1,p_stTempFile);
|
||
|
||
if ( !strcmp(szTag, szTag2) )
|
||
{
|
||
|
||
/**** Player name ****/
|
||
/*fread(&lValue,1,sizeof(unsigned long),p_stTempFile);*/
|
||
/*fread(szTemp,lValue,sizeof(char),p_stTempFile);*/
|
||
/*szTemp[lValue]=0;*/
|
||
/*fn_vChangePlayerName(szTemp);*/
|
||
/**** Slot names ****/
|
||
|
||
/***************** FPEREZ **************************/
|
||
#ifndef U64
|
||
#ifdef ACTIVE_EDITOR
|
||
Version = fn_iVersionN64_PC();
|
||
if( Version == 1 /* N64 */)
|
||
{
|
||
for ( lIndex = 0; lIndex < C_ucNbSaveGameSlots; lIndex ++ )
|
||
{
|
||
fread(&g_stGameOptions.a_szSlotNames[lIndex], 1, C_ucSaveGameSlotNameLength + 1, p_stTempFile);
|
||
g_stGameOptions.a_szSlotNames[lIndex][C_ucSaveGameSlotNameLength] = '\0'; /* pour assurer*/
|
||
}
|
||
}
|
||
else if( Version == 2 /* PC */)
|
||
{
|
||
//lNbSaveGameSlot = fn_lGetNbAvailableSlotsPc();
|
||
lNbSaveGameSlot = g_ucNbSaveGameSlots;
|
||
p_StructRecupPosSlot = g_p_LastStructRecupPosSlot;
|
||
for ( lIndex = 0; lIndex < lNbSaveGameSlot; lIndex ++ )
|
||
{
|
||
fread( p_StructRecupPosSlot->a_szSlotNames , 1, C_ucSaveGameSlotNameLength + 1, p_stTempFile);
|
||
p_StructRecupPosSlot = p_StructRecupPosSlot->pt_NextStructRecupPosSlot;
|
||
}
|
||
}
|
||
#else /* PC sans Editor */
|
||
//lNbSaveGameSlot = fn_lGetNbAvailableSlotsPc();
|
||
lNbSaveGameSlot = g_ucNbSaveGameSlots;
|
||
p_StructRecupPosSlot = g_p_LastStructRecupPosSlot;
|
||
for ( lIndex = 0; lIndex < lNbSaveGameSlot; lIndex ++ )
|
||
{
|
||
fread( p_StructRecupPosSlot->a_szSlotNames , 1, C_ucSaveGameSlotNameLength + 1, p_stTempFile);
|
||
p_StructRecupPosSlot = p_StructRecupPosSlot->pt_NextStructRecupPosSlot;
|
||
}
|
||
#endif // Editor
|
||
#else /* U64*/
|
||
for ( lIndex = 0; lIndex < C_ucNbSaveGameSlots; lIndex ++ )
|
||
{
|
||
fread(&g_stGameOptions.a_szSlotNames[lIndex], 1, C_ucSaveGameSlotNameLength + 1, p_stTempFile);
|
||
g_stGameOptions.a_szSlotNames[lIndex][C_ucSaveGameSlotNameLength] = '\0'; /* pour assurer*/
|
||
}
|
||
#endif //
|
||
|
||
g_stGameOptions.ulCurrentSlot = 0;
|
||
|
||
/**** Video options ****/
|
||
fread(&g_stGameOptions.ulDetails,1,sizeof(unsigned long),p_stTempFile);
|
||
fread(&g_stGameOptions.ulScreenSize,1,sizeof(unsigned long),p_stTempFile);
|
||
fread(&lIndex,1,sizeof(unsigned long),p_stTempFile);
|
||
GLI_fn_vSetBrightness( lIndex ) ;
|
||
/**** Sound options ****/
|
||
fread(&g_stGameOptions.ulFxVolume,1,sizeof(unsigned long),p_stTempFile);
|
||
fread(&g_stGameOptions.ulMusicVolume,1,sizeof(unsigned long),p_stTempFile);
|
||
fread(&g_stGameOptions.ulVoiceVolume,1,sizeof(unsigned long),p_stTempFile);
|
||
|
||
#ifdef USE_IPT_DX5
|
||
/* Read joystick calibration */
|
||
fread( &g_cJoystickXmin, sizeof(signed char), 1, p_stTempFile );
|
||
fread( &g_cJoystickXmax, sizeof(signed char), 1, p_stTempFile );
|
||
fread( &g_cJoystickYmin, sizeof(signed char), 1, p_stTempFile );
|
||
fread( &g_cJoystickYmax, sizeof(signed char), 1, p_stTempFile );
|
||
|
||
#ifndef U64
|
||
fread( &g_cJoystickXcenter, sizeof(signed char), 1, p_stTempFile );
|
||
fread( &g_cJoystickYcenter, sizeof(signed char), 1, p_stTempFile );
|
||
#endif
|
||
#endif
|
||
|
||
/**** IPT options ****/
|
||
IPT_fn_bLoadOptionsFromFile(p_stTempFile);
|
||
|
||
fclose(p_stTempFile);
|
||
fn_vValidateAllOption();
|
||
bReturn = TRUE;
|
||
}
|
||
}
|
||
}
|
||
remove(szTempFile);
|
||
|
||
return(bReturn);
|
||
}
|
||
|
||
|
||
#ifndef U64
|
||
//********************** FABPEREZ ************************
|
||
long fn_bRecupSlotNum(long lSlotPosId)
|
||
{
|
||
long lSlotPos = 1;
|
||
StructRecupPosSlot *p_CurrentStructRecupPosSlot;
|
||
|
||
p_CurrentStructRecupPosSlot = g_p_LastStructRecupPosSlot;
|
||
|
||
while( lSlotPos != lSlotPosId && p_CurrentStructRecupPosSlot->pt_NextStructRecupPosSlot != NULL)
|
||
{
|
||
p_CurrentStructRecupPosSlot = p_CurrentStructRecupPosSlot->pt_NextStructRecupPosSlot;
|
||
lSlotPos ++;
|
||
}
|
||
|
||
return p_CurrentStructRecupPosSlot->pos;
|
||
}
|
||
|
||
long fn_bScanDir( char *p_cDir, BOOL bRecursive)
|
||
{
|
||
struct _finddata_t stFileInfo;
|
||
int iHandle;
|
||
int i = 0;
|
||
long lNbSlotDir = 0;
|
||
|
||
if ( _chdir(p_cDir) )
|
||
return 0 ;
|
||
|
||
// start scan on directories
|
||
iHandle = _findfirst("*.*",&stFileInfo);
|
||
if (iHandle == -1)
|
||
{
|
||
/*if (errno == ENOENT)
|
||
{
|
||
// no entry... return
|
||
return 0;
|
||
}
|
||
else
|
||
{
|
||
// real error
|
||
sprintf (csText,"error while scanning directories in %s",p_cDir);
|
||
MessageBox(NULL,csText,"error",MB_OK );
|
||
return -1;
|
||
}*/
|
||
|
||
}
|
||
else
|
||
{
|
||
// file found, loop on all files
|
||
do
|
||
{
|
||
// look if it is a dir
|
||
if (stFileInfo.attrib & _A_SUBDIR)
|
||
{
|
||
if (bRecursive)
|
||
{
|
||
// directory + recursive, so scan it !
|
||
// check if it is not 'this' directory
|
||
if (stFileInfo.name[0] != '.')
|
||
{
|
||
if( strncmp(stFileInfo.name, "Slot", (long) 4) == 0) lNbSlotDir++;
|
||
|
||
if ( fn_bScanDir( stFileInfo.name, bRecursive) ==-1 )
|
||
{
|
||
// error !
|
||
return -1;
|
||
}
|
||
else
|
||
{
|
||
// directory scan successful, come back to current dir
|
||
_chdir("..");
|
||
}
|
||
}
|
||
}
|
||
}
|
||
// loop on find next file
|
||
} while (_findnext(iHandle,&stFileInfo) == 0);
|
||
|
||
// the end, so close handle
|
||
_findclose(iHandle);
|
||
}
|
||
|
||
return lNbSlotDir;
|
||
}
|
||
|
||
|
||
long fn_lGetNbAvailableSlotsPc()
|
||
{
|
||
long lNbAvailableSlots = 0;
|
||
char a256_cCurDir[255];
|
||
int Version =0;
|
||
|
||
#ifdef ACTIVE_EDITOR
|
||
Version = fn_iVersionN64_PC();
|
||
if ( Version == 0) return 0;
|
||
else if ( Version == 1 /* U64 */) return 3;
|
||
else if( Version == 2 /* PC */)
|
||
{
|
||
GetCurrentDirectory( 256, a256_cCurDir);
|
||
lNbAvailableSlots = fn_bScanDir( fn_szGetSaveGameDataPath() , TRUE);
|
||
SetCurrentDirectory( a256_cCurDir);
|
||
|
||
fn_bActualizeSlotListBis(lNbAvailableSlots);
|
||
}
|
||
#else // Version PC Normale
|
||
GetCurrentDirectory( 256, a256_cCurDir);
|
||
lNbAvailableSlots = fn_bScanDir( fn_szGetSaveGameDataPath() , TRUE);
|
||
SetCurrentDirectory( a256_cCurDir);
|
||
|
||
fn_bActualizeSlotListBis(lNbAvailableSlots);
|
||
#endif // ACTIVE_EDITOR
|
||
return lNbAvailableSlots;
|
||
}
|
||
|
||
int fn_iVersionN64_PC(void)
|
||
{
|
||
char a_c255_gsz_Version[255];
|
||
FILE *hIni;
|
||
int i;
|
||
static int Result = 0;
|
||
|
||
if(Result) return Result;
|
||
|
||
|
||
hIni = fopen("version.ini", "rt");
|
||
if(hIni)
|
||
{
|
||
*a_c255_gsz_Version = '\0';
|
||
fgets(a_c255_gsz_Version, 49, hIni);
|
||
fclose(hIni);
|
||
|
||
if( !strnicmp ( a_c255_gsz_Version, "GameDN64", 8) ) Result = 1;
|
||
else if ( !strncmp ( a_c255_gsz_Version, "GameDPC", 7) ) Result = 2;
|
||
}
|
||
|
||
return Result;
|
||
}
|
||
|
||
|
||
char * fn_cRecupSlotName(long lSlotId)
|
||
{
|
||
long pos = 1;
|
||
StructRecupPosSlot *p_StructRecupPosSlot;
|
||
|
||
p_StructRecupPosSlot = g_p_LastStructRecupPosSlot;
|
||
while( pos != lSlotId)
|
||
{
|
||
p_StructRecupPosSlot = p_StructRecupPosSlot->pt_NextStructRecupPosSlot;
|
||
pos++;
|
||
}
|
||
|
||
return p_StructRecupPosSlot->a_szSlotNames;
|
||
}
|
||
|
||
|
||
BOOL fn_bEraseGameInSlotList( long lSlotId)
|
||
{
|
||
StructRecupPosSlot *p_CurrentStructRecupPosSlotTmp;
|
||
StructRecupPosSlot *p_CurrentStructRecupPosSlot;
|
||
int Num = 0;
|
||
BOOL Result = TRUE;
|
||
|
||
// Arret de la recherche sur le slot precedent celui qui va etre effac<61> dans la liste de slot
|
||
if( lSlotId > 1)
|
||
{
|
||
p_CurrentStructRecupPosSlot = g_p_LastStructRecupPosSlot;
|
||
p_CurrentStructRecupPosSlotTmp = g_p_LastStructRecupPosSlot;
|
||
while( Num != lSlotId-1 && p_CurrentStructRecupPosSlot != NULL)
|
||
{
|
||
p_CurrentStructRecupPosSlotTmp = p_CurrentStructRecupPosSlot;
|
||
p_CurrentStructRecupPosSlot = p_CurrentStructRecupPosSlot->pt_NextStructRecupPosSlot;
|
||
Num++;
|
||
}
|
||
|
||
p_CurrentStructRecupPosSlotTmp->pt_NextStructRecupPosSlot = p_CurrentStructRecupPosSlot->pt_NextStructRecupPosSlot;
|
||
TMP_M_Free(p_CurrentStructRecupPosSlot);
|
||
}
|
||
else
|
||
{
|
||
p_CurrentStructRecupPosSlotTmp = g_p_LastStructRecupPosSlot;
|
||
TMP_M_Free(g_p_LastStructRecupPosSlot);
|
||
g_p_LastStructRecupPosSlot = p_CurrentStructRecupPosSlotTmp->pt_NextStructRecupPosSlot;
|
||
}
|
||
|
||
g_ucNbSaveGameSlots--;
|
||
|
||
return Result;
|
||
}
|
||
|
||
|
||
BOOL fn_bActualizeSlotListBis(long lNbAvailableSlots)
|
||
{
|
||
StructRecupPosSlot *p_StructRecupPosSlot;
|
||
BOOL bResult = FALSE;
|
||
|
||
if( lNbAvailableSlots != g_ucNbSaveGameSlots )
|
||
{
|
||
while (lNbAvailableSlots != g_ucNbSaveGameSlots)
|
||
{
|
||
p_StructRecupPosSlot = g_p_LastStructRecupPosSlot;
|
||
g_p_LastStructRecupPosSlot = (StructRecupPosSlot *) TMP_M_p_Malloc( sizeof(StructRecupPosSlot) );
|
||
g_p_LastStructRecupPosSlot->pt_NextStructRecupPosSlot = p_StructRecupPosSlot;
|
||
g_p_LastStructRecupPosSlot->pos = ++g_ucNbSaveGameSlots;
|
||
strncpy( g_p_LastStructRecupPosSlot->a_szSlotNames, g_a_szSlotNames, 3);
|
||
strcpy( g_p_LastStructRecupPosSlot->a_szOldSlotNames, "\\");
|
||
}
|
||
|
||
bResult = fn_bActualizeSlotPos();
|
||
}
|
||
return bResult;
|
||
}
|
||
#endif // ! U64
|
||
/******************** F PEREZ ********************/
|
||
|
||
|
||
/* FBF {*/
|
||
/*
|
||
//************************************************************************
|
||
void fn_vMenuOptionInitDetails(struct MNU_stMenuItem_ *hMenuItem,char *szText[])
|
||
{
|
||
MNU_fn_bSetValue(hMenuItem->uItem.hSlider,(short)g_stGameOptions.ulDetails);
|
||
}
|
||
//************************************************************************
|
||
void fn_vMenuOptionChangeDetailsValue(struct MNU_stMenuItem_ *hMenuItem,char *szText[])
|
||
{
|
||
fn_vChangeDetailsValue(MNU_fn_lGetValue(hMenuItem->uItem.hSlider));
|
||
}
|
||
//************************************************************************
|
||
void fn_vMenuOptionInitScreenSize(struct MNU_stMenuItem_ *hMenuItem,char *szText[])
|
||
{
|
||
MNU_fn_bSetValue(hMenuItem->uItem.hSlider,(short)g_stGameOptions.ulScreenSize);
|
||
}
|
||
//************************************************************************
|
||
void fn_vMenuOptionChangeScreenSizeValue(struct MNU_stMenuItem_ *hMenuItem,char *szText[])
|
||
{
|
||
//ANNECY CB
|
||
//fn_vChangeScreenSizeValue(MNU_fn_lGetValue(hMenuItem->uItem.hSlider));
|
||
//ENDANNECY
|
||
}
|
||
//************************************************************************
|
||
void fn_vMenuOptionInitMusicVolume(struct MNU_stMenuItem_ *hMenuItem,char *szText[])
|
||
{
|
||
MNU_fn_bSetValue(hMenuItem->uItem.hSlider,(short)g_stGameOptions.ulMusicVolume);
|
||
}
|
||
//************************************************************************
|
||
void fn_vMenuOptionChangeMusicVolumeValue(struct MNU_stMenuItem_ *hMenuItem,char *szText[])
|
||
{
|
||
fn_vChangeMusicVolumeValue(MNU_fn_lGetValue(hMenuItem->uItem.hSlider));
|
||
}
|
||
//************************************************************************
|
||
void fn_vMenuOptionInitFxVolume(struct MNU_stMenuItem_ *hMenuItem,char *szText[])
|
||
{
|
||
MNU_fn_bSetValue(hMenuItem->uItem.hSlider,(short)g_stGameOptions.ulFxVolume);
|
||
}
|
||
//************************************************************************
|
||
void fn_vMenuOptionChangeFxVolumeValue(struct MNU_stMenuItem_ *hMenuItem,char *szText[])
|
||
{
|
||
fn_vChangeFxVolumeValue(MNU_fn_lGetValue(hMenuItem->uItem.hSlider));
|
||
}
|
||
//************************************************************************
|
||
void fn_vMenuOptionInitVoiceVolume(struct MNU_stMenuItem_ *hMenuItem,char *szText[])
|
||
{
|
||
MNU_fn_bSetValue(hMenuItem->uItem.hSlider,(short)g_stGameOptions.ulVoiceVolume);
|
||
}
|
||
//************************************************************************
|
||
void fn_vMenuOptionChangeVoiceVolumeValue(struct MNU_stMenuItem_ *hMenuItem,char *szText[])
|
||
{
|
||
fn_vChangeVoiceVolumeValue(MNU_fn_lGetValue(hMenuItem->uItem.hSlider));
|
||
}
|
||
*/
|
||
/* FBF }*/
|
||
/**************************************************************************/
|
||
/**************************************************************************/
|
||
void fn_vValidateAllOption(void)
|
||
{
|
||
/**** Video options ****/
|
||
fn_vChangeDetailsValue(g_stGameOptions.ulDetails);
|
||
/*ANNECY CB*/
|
||
/* fn_vChangeScreenSizeValue(g_stGameOptions.ulScreenSize);*/
|
||
/*END ANNECY*/
|
||
/**** Sound options ****/
|
||
|
||
fn_vChangeMusicVolumeValue(g_stGameOptions.ulMusicVolume);
|
||
fn_vChangeFxVolumeValue(g_stGameOptions.ulFxVolume);
|
||
#ifdef D_USE_LIPSYNC
|
||
fn_vChangeVoiceVolumeValue(g_stGameOptions.ulVoiceVolume);
|
||
#endif
|
||
}
|
||
/**************************************************************************/
|
||
/*void fn_vChangePlayerName(char *_szName)
|
||
{
|
||
GAM_fn_vSetPlayerName(_szName);
|
||
}*/
|
||
/**************************************************************************/
|
||
void fn_vChangeDetailsValue(unsigned long _ulValue)
|
||
{
|
||
g_stGameOptions.ulDetails = _ulValue;
|
||
}
|
||
/**************************************************************************/
|
||
void fn_vChangeScreenSizeValue(unsigned long _ulValue)
|
||
{
|
||
/*ANNECY CB*/
|
||
#if 0
|
||
_ulValue = max(60,min(100,_ulValue));
|
||
g_stGameOptions.ulScreenSize = _ulValue;
|
||
fn_vChangeViewPortSize(g_stGameOptions.ulScreenSize);
|
||
#endif
|
||
/*ENDANNECY*/
|
||
}
|
||
/**************************************************************************/
|
||
void fn_vChangeMusicVolumeValue(unsigned long _ulValue)
|
||
{
|
||
_ulValue = max(0,min(127,_ulValue));
|
||
g_stGameOptions.ulMusicVolume = _ulValue;
|
||
SND_fn_vSetVolumeLineSound(g_lSoundVolumeLineMusic,g_stGameOptions.ulMusicVolume);
|
||
}
|
||
/**************************************************************************/
|
||
void fn_vChangeFxVolumeValue(unsigned long _ulValue)
|
||
{
|
||
_ulValue = max(0,min(127,_ulValue));
|
||
g_stGameOptions.ulFxVolume = _ulValue;
|
||
SND_fn_vSetVolumeLineSound(g_lSoundVolumeLineSound ,g_stGameOptions.ulFxVolume);
|
||
}
|
||
/**************************************************************************/
|
||
#ifdef D_USE_LIPSYNC
|
||
void fn_vChangeVoiceVolumeValue(unsigned long _ulValue)
|
||
{
|
||
_ulValue = max(0,min(127,_ulValue));
|
||
g_stGameOptions.ulVoiceVolume = _ulValue;
|
||
SND_fn_vSetVolumeLineSound(g_lSoundVolumeLineVoices ,g_stGameOptions.ulVoiceVolume);
|
||
}
|
||
#endif D_USE_LIPSYNC
|
||
/**************************************************************************/
|
||
|
||
unsigned long fn_ulGetTrameNumber(void) {
|
||
return( g_stEngineStructure.stEngineTimer.ulTrameNumber) ;
|
||
}
|