1685 lines
55 KiB
C
1685 lines
55 KiB
C
/*=========================================================================
|
||
* Basic.c : This module contain simple used functions
|
||
* This is a part of the Game project.
|
||
*
|
||
* Version 1.0
|
||
* Creation date 09/08/96
|
||
* Revision date
|
||
*
|
||
* That file needs to be compatible for all platforms.
|
||
*
|
||
* (c) Ubi Studios 1996
|
||
*=======================================================================*/
|
||
|
||
#if defined(WIN32)
|
||
#include <direct.h>
|
||
#endif
|
||
|
||
#define D_FIL_StructureDefine
|
||
#define D_SectInfo_StructureDefine
|
||
#include "acp_driver.h"
|
||
#include "acp_opfi.h"
|
||
#include "ToolsCPA.h"
|
||
#include "Main.h"
|
||
|
||
#include "Options/Options.h"
|
||
#include "Macros.h"
|
||
|
||
#include "Actions/AllActs.h"
|
||
|
||
#include "Structur/EngMode.h"
|
||
#include "Structur/ErrGame.h"
|
||
#include "Structur/GameScpt.h"
|
||
#include "Structur/StdObjSt.h"
|
||
#include "Structur/Objects.h"
|
||
#include "Structur/MemGame.h"
|
||
#include "Structur/Anim_s.h"
|
||
#include "Structur/State.h"
|
||
#include "Structur/Input_s.h"
|
||
/*
|
||
#include "Actions/SectInfo.h"
|
||
#undef D_SectInfo_StructureDefine
|
||
*/
|
||
|
||
#include "Basic.h"
|
||
#include "DspFix.h"
|
||
#include "GamOpt.h"
|
||
#include "GamSave.h"
|
||
#include "LoadAni.h"
|
||
#include "LoadGame.h"
|
||
#include "LoadFml.h"
|
||
#include "LoadLvl.h"
|
||
#ifdef U64
|
||
#include "LoadMem.h"
|
||
#include "SPO/Specif/HieLoad.h"
|
||
#endif
|
||
#include "ObjType.h"
|
||
#include "PhysiCol.h"
|
||
#include "ZdxStuff.h"
|
||
#include "ZeMem.h"
|
||
#include "TBLLoad.h"
|
||
#include "CHLLoad.h"
|
||
#include "gameeng.h"
|
||
|
||
#include "AI.h"
|
||
#include "mainchar.h"
|
||
/* Oliv' - Portage v15*/
|
||
/* Please, move this include in basic.cxx*/
|
||
/*#include "options/specif/submapps.h"*/
|
||
/* EndOfOliv'*/
|
||
#include "clock.h"
|
||
/*
|
||
#include "SPO/Specif/HieLoad.h" //for HIE_fn_bInitSPOLoading2()
|
||
#if defined(BIN_LoadBin)
|
||
#include "LoadBin.h"
|
||
#endif
|
||
*/
|
||
/* BIN_LoadBin */
|
||
|
||
#include "Input.h"
|
||
|
||
|
||
#include "LoadLSyn.h"
|
||
#ifdef GAM_USE_SNA
|
||
#include "sna\snaglob.h"
|
||
#include "sna\snanoscr.h"
|
||
#endif /* GAM_USE_SNA */
|
||
|
||
#include "PRF.h"
|
||
|
||
/* Multi-install and multi-language */
|
||
|
||
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
|
||
char g_cCDROM = '\0';
|
||
char g_sLanguage[255];
|
||
int g_iSoundOnHD=0;
|
||
int g_iComplete=0;
|
||
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
|
||
|
||
#include "Specif\Basic.cxx"
|
||
#ifndef U64
|
||
extern void CAM_fn_vForceBestPosition(HIE_tdxHandleToSuperObject _hCamera);
|
||
extern void CAM_fn_vForceCameraPos(HIE_tdxHandleToSuperObject, MTH3D_tdstVector *);
|
||
extern void CAM_fn_vForceCameraTgt(HIE_tdxHandleToSuperObject, MTH3D_tdstVector *, MTH3D_tdstVector *);
|
||
extern POS_tdxHandleToPosition GAM_fn_hGetSubMapPosition(long _lSubMapNumber , long _lEntryNumber);
|
||
extern void fn_vInitAveragePositionDatasIfNecessary(MS_tdxHandleToCineinfo _hCineinfo);
|
||
#endif /* !U64*/
|
||
|
||
extern void CAM_fn_vForceBestPosition(HIE_tdxHandleToSuperObject _hCamera);
|
||
|
||
extern void GLI_fn_vLoadDisplayMode( void );
|
||
extern long GLI_fn_lChooseDisplayMode( void );
|
||
extern long GLI_fn_lIsFullScreenMode( void );
|
||
extern long GLI_fn_lDisplayModeWidth( void );
|
||
extern long GLI_fn_lDisplayModeHeight( void );
|
||
extern long GLI_fnl_InitDll( void );
|
||
extern void GLI_fnv_SetDllFileName( char *);
|
||
extern void GLI_fnv_SetDllName( char *);
|
||
extern void GLI_fnv_SetDriverName( char *);
|
||
extern void GLI_fnv_SetDeviceName( char *);
|
||
extern void GLI_fnv_SetMode( long , long , long , long );
|
||
extern void GLI_fnv_SetModeByString( char *);
|
||
|
||
#ifndef U64
|
||
ACP_tdxBool g_bDumpMemory = FALSE;
|
||
#endif /* U64 */
|
||
|
||
#ifndef U64
|
||
/**************** F PEREZ *******************/
|
||
#include "GamOpt.h"
|
||
extern int fn_iVersionN64_PC(void);
|
||
extern StructRecupPosSlot * g_p_LastStructRecupPosSlot;
|
||
extern long fn_lGetNbAvailableSlotsPc();
|
||
#endif // ! U64
|
||
|
||
/*-----------------------------------------------------------------------------
|
||
* Description : Verify and change the engine mode.
|
||
*-----------------------------------------------------------------------------
|
||
* Input : object type
|
||
* Output : Size of structure
|
||
*-----------------------------------------------------------------------------
|
||
* Creation date : 28/02/96 Author : Francois
|
||
*-----------------------------------------------------------------------------
|
||
* Modification date : Modification Author :
|
||
* Modifications :
|
||
*---------------------------------------------------------------------------*/
|
||
|
||
#ifdef U64 //FB for demo
|
||
extern char g_cEndOfDemo;
|
||
#endif
|
||
|
||
void fn_vChangeEngineMode(tdeEngineMode eNewMode)
|
||
{
|
||
#ifdef U64
|
||
if (g_cEndOfDemo==1) return;
|
||
#endif
|
||
if (g_stEngineStructure.eEngineMode==EM_ModeInvalid)
|
||
{
|
||
M_GameWarningError(E_uwGameChangeEngineModeOldMode);
|
||
}
|
||
if (eNewMode==EM_ModeInvalid||eNewMode>=NbTotalEngineMode)
|
||
{
|
||
M_GameFatalError(E_uwGameChangeEngineModeNewMode);
|
||
}
|
||
g_stEngineStructure.eEngineMode = eNewMode;
|
||
}
|
||
|
||
/*-----------------------------------------------------------------------------
|
||
* Description : Return the current engine mode.
|
||
*-----------------------------------------------------------------------------
|
||
* Input : none
|
||
* Output : current engine mode
|
||
*-----------------------------------------------------------------------------
|
||
* Creation date : 22/09/97 Author : st<73>phane RONSE
|
||
*-----------------------------------------------------------------------------
|
||
* Modification date : Modification Author :
|
||
* Modifications :
|
||
*---------------------------------------------------------------------------*/
|
||
|
||
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
|
||
tdeEngineMode fn_eGetEngineMode()
|
||
{
|
||
return g_stEngineStructure.eEngineMode;
|
||
}
|
||
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
|
||
|
||
|
||
/*-----------------------------------------------------------------------------
|
||
* Description : Get the GameData's filenames
|
||
*-----------------------------------------------------------------------------
|
||
* Input : String,SO Character,extension
|
||
* Output : Filename
|
||
*-----------------------------------------------------------------------------
|
||
* Creation date : 26/03/97 Author : Francois
|
||
*-----------------------------------------------------------------------------
|
||
* Modification date : Modification Author :
|
||
* Modifications :
|
||
*---------------------------------------------------------------------------*/
|
||
/* 007*/
|
||
#ifdef GAM_USE_SCRIPT
|
||
char *fn_zsGetCharaterFilenameByEngineObject(char *_szFilename,struct tdstEngineObject_ *_stEngineObject,unsigned char _bCommon)
|
||
{
|
||
if (_bCommon)
|
||
{
|
||
sprintf(_szFilename,"%s\\_Common\\Families\\%s\\%s\\%s\\%s.car",
|
||
fn_szGetCharactersDataPath(),
|
||
fn_szFindFamilyTypeNameOfFamilyType(M_ObjectGetFamilyType(_stEngineObject)),
|
||
fn_szFindModelTypeNameOfModelType(M_ObjectGetModelType(_stEngineObject)),
|
||
C_ScriptCharacterDirectory,
|
||
fn_szFindPersonalTypeNameOfPersonalType(M_ObjectGetPersonalType(_stEngineObject)));
|
||
}
|
||
else
|
||
{
|
||
sprintf(_szFilename,"%s\\%s\\Families\\%s\\%s\\%s\\%s.car",
|
||
fn_szGetCharactersDataPath(),
|
||
fn_p_szGetLevelName(),
|
||
fn_szFindFamilyTypeNameOfFamilyType(M_ObjectGetFamilyType(_stEngineObject)),
|
||
fn_szFindModelTypeNameOfModelType(M_ObjectGetModelType(_stEngineObject)),
|
||
C_ScriptCharacterDirectory,
|
||
fn_szFindPersonalTypeNameOfPersonalType(M_ObjectGetPersonalType(_stEngineObject)));
|
||
}
|
||
|
||
return(_szFilename);
|
||
}
|
||
|
||
char *fn_zsGetCharaterFilenameByTypeName(char *_szFilename,char *_szFamily,char *_szModel,char *_szPersonnal,unsigned char _bCommon)
|
||
{
|
||
if (_bCommon)
|
||
{
|
||
sprintf(_szFilename,"%s\\_Common\\Families\\%s\\%s\\%s\\%s.car",
|
||
fn_szGetCharactersDataPath(),
|
||
_szFamily,
|
||
_szModel,
|
||
C_ScriptCharacterDirectory,
|
||
_szPersonnal);
|
||
}
|
||
else
|
||
{
|
||
sprintf(_szFilename,"%s\\%s\\Families\\%s\\%s\\%s\\%s.car",
|
||
fn_szGetCharactersDataPath(),
|
||
fn_p_szGetLevelName(),
|
||
_szFamily,
|
||
_szModel,
|
||
C_ScriptCharacterDirectory,
|
||
_szPersonnal);
|
||
}
|
||
|
||
return(_szFilename);
|
||
}
|
||
|
||
char *fn_zsGetActualLevelFilename(char *_szFilename,char *_szExtension)
|
||
{
|
||
return(fn_zsGetLevelFilename(_szFilename,fn_p_szGetLevelName(),_szExtension));
|
||
}
|
||
|
||
char *fn_zsGetLevelFilename(char *_szFilename,char *_szLevelName,char *_szExtension)
|
||
{
|
||
sprintf(_szFilename,"%s\\%s\\%s.%s",
|
||
fn_szGetLevelsDataPath(),
|
||
_szLevelName,
|
||
_szLevelName,
|
||
_szExtension);
|
||
|
||
return(_szFilename);
|
||
}
|
||
#endif /* GAM_USE_SCRIPT*/
|
||
|
||
/*-----------------------------------------------------------------------------
|
||
* Description : Return the value of a string (with tests)
|
||
*-----------------------------------------------------------------------------
|
||
* Input : object type
|
||
* Output : Size of structure
|
||
*-----------------------------------------------------------------------------
|
||
* Creation date : 02/09/96 Author : Francois
|
||
*-----------------------------------------------------------------------------
|
||
* Modification date : Modification Author :
|
||
* Modifications :
|
||
*---------------------------------------------------------------------------*/
|
||
|
||
|
||
long fn_lAToI(char *szString)
|
||
{
|
||
if ((szString[0]<'0'&&szString[0]>'9')&&szString[0]!='+'&&szString[0]!='-')
|
||
{
|
||
M_GameFatalError(E_uwGameAToIBadEntry);
|
||
}
|
||
return (atoi(szString));
|
||
}
|
||
|
||
|
||
|
||
/*-----------------------------------------------------------------------------
|
||
* Description : Return the value of a string (with tests)
|
||
*-----------------------------------------------------------------------------
|
||
* Input : object type
|
||
* Output : double value
|
||
*-----------------------------------------------------------------------------
|
||
* Creation date : 05/11/96 Author : Francois
|
||
*-----------------------------------------------------------------------------
|
||
* Modification date : Modification Author :
|
||
* Modifications :
|
||
*---------------------------------------------------------------------------*/
|
||
|
||
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
|
||
MTH_tdxReal fn_fAToF(char *szString)
|
||
{
|
||
if ((szString[0]<'0'&&szString[0]>'9')&&szString[0]!='+'&&szString[0]!='-'&&szString[0]!='.')
|
||
{
|
||
M_GameFatalError(E_uwGameAToFBadEntry);
|
||
}
|
||
return ((MTH_tdxReal)atof(szString));
|
||
}
|
||
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
|
||
|
||
|
||
/*-----------------------------------------------------------------------------
|
||
* Description : Used to register all script callback functions
|
||
*-----------------------------------------------------------------------------
|
||
* Input : object type
|
||
* Output : Size of structure
|
||
*-----------------------------------------------------------------------------
|
||
* Creation date : 02/09/96 Author : Francois
|
||
*-----------------------------------------------------------------------------
|
||
* Modification date : January 1997 Modification Author : Albert
|
||
* Modifications : Adding script registration for way and waypoints
|
||
*-----------------------------------------------------------------------------
|
||
* Modification date : Modification Author :
|
||
* Modifications :
|
||
*---------------------------------------------------------------------------*/
|
||
void fn_vInitAndRegisterAllScriptSections()
|
||
{
|
||
#if defined(GAM_USE_SCRIPT)
|
||
/**** All sections are defined in GameScript.h ****/
|
||
#ifndef RETAIL
|
||
switch (g_cMemMode)
|
||
{
|
||
case 1 :
|
||
SCR_fn_v_RdL0_RegisterCallback(C_Section_BinaryMemoryDescription,fn_eScriptCallBackMemoryDescription,SCR_CRC_c_RdL0_ForSection);
|
||
break;
|
||
case 2 :
|
||
SCR_fn_v_RdL0_RegisterCallback(C_Section_BinaryMemoryDescriptionPass1,fn_eScriptCallBackMemoryDescription,SCR_CRC_c_RdL0_ForSection);
|
||
break;
|
||
case 3 :
|
||
SCR_fn_v_RdL0_RegisterCallback(C_Section_BinaryMemoryDescriptionPass2,fn_eScriptCallBackMemoryDescription,SCR_CRC_c_RdL0_ForSection);
|
||
break;
|
||
default :
|
||
SCR_fn_v_RdL0_RegisterCallback(C_Section_MemoryDescription,fn_eScriptCallBackMemoryDescription,SCR_CRC_c_RdL0_ForSection);
|
||
break;
|
||
}
|
||
#endif
|
||
SCR_fn_v_RdL0_RegisterCallback(C_Section_DirectoriesDescription,fn_eScriptCallBackDirectoriesDescription,SCR_CRC_c_RdL0_ForSection);
|
||
SCR_fn_v_RdL0_RegisterCallback(C_Section_InputDeviceManagerDescription,fn_eScriptCallBackInputDeviceManagerDescription,SCR_CRC_c_RdL0_ForSection);
|
||
SCR_fn_v_RdL0_RegisterCallback(C_Section_RandomManagerDescription,fn_eScriptCallBackRandomManagerDescription,SCR_CRC_c_RdL0_ForSection);
|
||
SCR_fn_v_RdL0_RegisterCallback(C_Section_BigFile,fn_eScriptCallBackBigFile,SCR_CRC_c_RdL0_ForSection);
|
||
/**** Objects family's scripts (in LoadFml.h) ****/
|
||
/*SCR_fn_v_RdL0_RegisterCallback(C_SectionCreateNewActionsArray,fn_eScriptCallBackCreateNewActionsArray,SCR_CRC_c_RdL0_ForSection);*/
|
||
/*SCR_fn_v_RdL0_RegisterCallback(C_SubSectionCreateNewAction,fn_eScriptCallBackCreateNewAction,SCR_CRC_c_RdL0_ForSection);*/
|
||
SCR_fn_v_RdL0_RegisterCallback(C_SectionCreateNewState,fn_eScriptCallBackCreateNewState,SCR_CRC_c_RdL0_ForSection);
|
||
// Shaitan => state list in the level
|
||
SCR_fn_v_RdL0_RegisterCallback(C_SectionCreateListOfState,fn_eScriptCallBackCreateListOfState,SCR_CRC_c_RdL0_ForSection);
|
||
// End Shaitan => state list in the level
|
||
// Shaitan => module list in the level
|
||
SCR_fn_v_RdL0_RegisterCallback(C_SectionCreateListOfPOs,fn_eScriptCallBackCreateListOfPOs,SCR_CRC_c_RdL0_ForSection);
|
||
// End Shaitan => module list in the level
|
||
|
||
SCR_fn_v_RdL0_RegisterCallback(C_SectionFirstLevelDescription,fn_eScriptCallBackFirstLevel,SCR_CRC_c_RdL0_ForSection);
|
||
SCR_fn_v_RdL0_RegisterCallback(C_SectionLanguage,fn_eScriptCallBackLanguage,SCR_CRC_c_RdL0_ForSection);
|
||
|
||
/**** Level's scripts (in LoadLvl.h) ****/
|
||
SCR_fn_v_RdL0_RegisterCallback(C_SectionLevelDescription,fn_eScriptCallBackLevelDescription,SCR_CRC_c_RdL0_ForSection);
|
||
SCR_fn_v_RdL0_RegisterCallback(C_SectionLevelOptions,fn_eScriptCallBackLevelOptions,SCR_CRC_c_RdL0_ForSection);
|
||
SCR_fn_v_RdL0_RegisterCallback(C_SectionLevelCharacters,fn_eScriptCallBackLevelCharacters,SCR_CRC_c_RdL0_ForSection);
|
||
SCR_fn_v_RdL0_RegisterCallback(C_SectionLevelAlways,fn_eScriptCallBackLevelAlways,SCR_CRC_c_RdL0_ForSection);
|
||
SCR_fn_v_RdL0_RegisterCallback(C_SectionOneCharacters,fn_eScriptCallBackOneCharacter,SCR_CRC_c_RdL0_ForSection);
|
||
#ifdef ACTIVE_EDITOR
|
||
SCR_fn_v_RdL0_RegisterCallback(C_SectionUseSAIWithEditor,fn_eScriptCallBackLevelUseSAIWithEditor,SCR_CRC_c_RdL0_ForSection);
|
||
#endif /* ACTIVE_EDITOR */
|
||
|
||
SCR_fn_v_RdL0_RegisterCallback(C_SectionCreateNewArrayOfZdx,fn_eScriptCallBackZdxArrayDescription,SCR_CRC_c_RdL0_ForSection);
|
||
SCR_fn_v_RdL0_RegisterCallback(C_SectionCreateNewZoneSetArray,fn_eScriptCallBackCreateNewZoneSetArray,SCR_CRC_c_RdL0_ForSection);
|
||
SCR_fn_v_RdL0_RegisterCallback(C_SectionNewActivationZone,fn_eScriptCallBackCreateNewActivationZone,SCR_CRC_c_RdL0_ForSection);
|
||
SCR_fn_v_RdL0_RegisterCallback(C_SectionAddActivation,fn_eScriptCallBackCreateActivation,SCR_CRC_c_RdL0_ForSection);
|
||
|
||
SCR_fn_v_RdL0_RegisterCallback(C_SubSectionIsolateWayPointDescription,WP_fne_WayPoint_ScriptSubSectionCallBackLoad,SCR_CRC_c_RdL0_ForSection);
|
||
SCR_fn_v_RdL0_RegisterCallback(C_SubSectionInWayWayPointDescription,WP_fne_WayPoint_ScriptSubSectionCallBackLoad,SCR_CRC_c_RdL0_ForSection);
|
||
|
||
SCR_fn_v_RdL0_RegisterCallback(C_SectionWayPointDescription,WP_fne_WayPoint_ScriptCallBackLoad,SCR_CRC_c_RdL0_ForSection);
|
||
|
||
/*ANNECY Bart 19/01/98 {*/
|
||
SCR_fn_v_RdL0_RegisterCallback(C_SectionWPGraphDescription,WP_fne_WPGraph_ScriptCallBackLoad,SCR_CRC_c_RdL0_ForSection);
|
||
SCR_fn_v_RdL0_RegisterCallback(C_SectionWPSommetDescription,WP_fne_WPSommet_ScriptCallBackLoad,SCR_CRC_c_RdL0_ForSection);
|
||
/*ENDANNECY Bart }*/
|
||
|
||
|
||
/*SCR_fn_v_RdL0_RegisterCallback(C_SectionPhysicalCollideSetDescription,fn_eScriptCallBackPhysicalCollideSetDescription,SCR_CRC_c_RdL0_ForSection);*/
|
||
SCR_fn_v_RdL0_RegisterCallback(C_Section_GameOptionsFile,fn_eScriptCallBackGameOptionsFileDescription,SCR_CRC_c_RdL0_ForSection);
|
||
|
||
/* call back for anim stacks*/
|
||
SCR_fn_v_RdL0_RegisterCallback(C_Section_Animstacks,fn_eScriptCallBackAnimStacksDescription,SCR_CRC_c_RdL0_ForSection);
|
||
|
||
/* Fred d. 15/08/97 */
|
||
SCR_fn_v_RdL0_RegisterCallback("LevelSoundBanks",fn_eScriptCallBackLevelSoundBank,SCR_CRC_c_RdL0_ForSection);
|
||
SCR_fn_v_RdL0_RegisterCallback("SoundBanksBlock",fn_eScriptCallBackLevelSoundBankBlock,SCR_CRC_c_RdL0_ForSection);
|
||
|
||
/* SCR_fn_v_RdL0_RegisterCallback(C_SectionPreloadSectionInFix,fn_eScriptCallBackPreloadSectionInFix,SCR_CRC_c_RdL0_ForSection);*/
|
||
SCR_fn_v_RdL0_RegisterCallback(C_SectionAddStringsFiles,fn_eScriptCallBackAddStringsFiles,SCR_CRC_c_RdL0_ForSection);
|
||
|
||
SCR_fn_v_RdL0_RegisterCallback(C_Section_IPTLink,fn_eScriptCallBackIPTLink,SCR_CRC_c_RdL0_ForSection);
|
||
#else /* U64 */
|
||
|
||
/* GAM_fn_vFirstLoading(); I*/
|
||
|
||
#endif /* GAM_USE_SCRIPT */
|
||
|
||
|
||
/* DNM_fn_vInitLoadMecEnvironment();*/
|
||
/*ENV_fn_vInitLoadEnvironment();*/
|
||
DNM_fn_vInitLoadIdCard();
|
||
#ifdef GAM_USE_SCRIPT
|
||
fn_vRegisterAllActionsScriptSections();
|
||
fn_vRegisterAllRulesScriptSections();
|
||
fn_vRegisterAllBdVolumeScriptSections();
|
||
#endif /*GAM_USE_SCRIPT*/
|
||
/* SRF_fn_bInitModuleSurface();*/
|
||
SECT_fn_bInitSectorLoading();
|
||
HIE_fn_bInitSPOLoading2();
|
||
LGT_fn_bInitLGTLoading();
|
||
GLI_vInitLoad();
|
||
GMT_fn_vInitLoadGameMaterial();
|
||
|
||
/*XB980821*/
|
||
#ifndef D_THROW_IPO
|
||
IPO_fn_vRegisterAllScriptSections();
|
||
#endif /* D_THROW_IPO */
|
||
/*End XB*/
|
||
PO_fn_vRegisterAllScriptSections();
|
||
#ifndef D_THROW_VISUAL_SET
|
||
VS_fn_vRegisterAllScriptSections();
|
||
#endif /* D_THROW_VISUAL_SET */
|
||
#ifdef GAM_USE_SCRIPT
|
||
CS_fn_vRegisterAllScriptSections();
|
||
TBL_fn_vRegisterAllScriptSections();
|
||
CHL_fn_vRegisterAllScriptSections();
|
||
#endif /*GAM_USE_SCRIPT*/
|
||
#ifdef GAM_VIGNETTE
|
||
VIG_fn_vRegisterSection();
|
||
#endif /* GAM_VIGNETTE */
|
||
/*XB980821*/
|
||
#ifndef D_THROW_IPO
|
||
ISI_vInitLoad();
|
||
#endif /* D_THROW_IPO */
|
||
/*End XB*/
|
||
#ifndef U64
|
||
FON_fn_vInitLoad();
|
||
#endif
|
||
#ifdef D_USE_LIPSYNC
|
||
fn_vLipsSynchroLoadInit();
|
||
#endif /* D_USE_LIPSYNC*/
|
||
#if defined(GAM_USE_SCRIPT)
|
||
fn_vRegisterAllGamParticlesCallBacks();
|
||
#endif /* GAM_USE_SCRIPT */
|
||
}
|
||
|
||
/*************************************************************************/
|
||
void fn_vSetFirstLevelName(char * _szName)
|
||
{
|
||
strcpy(g_stEngineStructure.szFirstLevelName,_szName);
|
||
}
|
||
/*************************************************************************/
|
||
char *fn_p_szGetFirstLevelName(void)
|
||
{
|
||
return(g_stEngineStructure.szFirstLevelName);
|
||
}
|
||
/*************************************************************************/
|
||
void fn_vSetLevelName(char * _szName)
|
||
{
|
||
/* ANNECY MT - 07/09/98 {*/
|
||
char *p_cDelimiter;
|
||
|
||
strcpy(g_stEngineStructure.szLevelName,_szName);
|
||
p_cDelimiter = strchr(g_stEngineStructure.szLevelName,'$');
|
||
if(p_cDelimiter==0)
|
||
{
|
||
g_stEngineStructure.lSubMapNumber = 0;
|
||
}
|
||
else
|
||
{
|
||
long lSubMap,lEntry;
|
||
|
||
*p_cDelimiter++=0;
|
||
#ifndef U64 /* Oliv' - 11/06/1999 - N64 always use SubMaps */
|
||
if (g_stEngineStructure.lSubMapNumber == 0)
|
||
lSubMap = 0;
|
||
else
|
||
#endif /* U64 */
|
||
lSubMap = fn_lAToI(p_cDelimiter);
|
||
|
||
p_cDelimiter = strchr(p_cDelimiter,'$');
|
||
if(p_cDelimiter==0) lEntry = 0;
|
||
else lEntry = fn_lAToI(++p_cDelimiter);
|
||
g_stEngineStructure.lSubMapNumber = GAM_M_MakeSubMapNumber(lSubMap,lEntry);
|
||
}
|
||
/* END ANNECY MT }*/
|
||
}
|
||
/*************************************************************************/
|
||
char *fn_p_szGetLevelName(void)
|
||
{
|
||
return(g_stEngineStructure.szLevelName);
|
||
}
|
||
/*************************************************************************/
|
||
/* ANNECY MT - 07/09/98 {*/
|
||
long fn_lGetSubMapNumber(void)
|
||
{
|
||
return(g_stEngineStructure.lSubMapNumber);
|
||
}
|
||
/* END ANNECY MT }*/
|
||
/*************************************************************************/
|
||
void fn_vSetNextLevelName(char * _szName)
|
||
{
|
||
strcpy(g_stEngineStructure.szNextLevelName,_szName);
|
||
}
|
||
/*************************************************************************/
|
||
char *fn_p_szGetNextLevelName(void)
|
||
{
|
||
return(g_stEngineStructure.szNextLevelName);
|
||
}
|
||
/*************************************************************************/
|
||
void fn_vFreeNextLevelName(void)
|
||
{
|
||
g_stEngineStructure.szNextLevelName[0]=0;
|
||
}
|
||
/*************************************************************************/
|
||
unsigned char fn_bIsNextLevelNameValid(void)
|
||
{
|
||
if (g_stEngineStructure.szNextLevelName[0]==0)
|
||
return(FALSE);
|
||
else
|
||
return(TRUE);
|
||
}
|
||
/*************************************************************************/
|
||
/*void fn_vSetNextLevelPositionName(char * _szPersoName,char * _szCameraName)
|
||
{
|
||
strcpy(g_stEngineStructure.szNextLevelPositionPersoName,_szPersoName);
|
||
strcpy(g_stEngineStructure.szNextLevelPositionCameraName,_szCameraName);
|
||
}*/
|
||
/*************************************************************************/
|
||
/*char *fn_p_szGetNextLevelPositionPersoName(void)
|
||
{
|
||
return(g_stEngineStructure.szNextLevelPositionPersoName);
|
||
}*/
|
||
/*************************************************************************/
|
||
/*char *fn_p_szGetNextLevelPositionCameraName(void)
|
||
{
|
||
return(g_stEngineStructure.szNextLevelPositionCameraName);
|
||
}*/
|
||
/*************************************************************************/
|
||
/*void fn_vFreeNextLevelPositionName(void)
|
||
{
|
||
g_stEngineStructure.szNextLevelPositionPersoName[0]=0;
|
||
g_stEngineStructure.szNextLevelPositionCameraName[0]=0;
|
||
}*/
|
||
/*************************************************************************/
|
||
/*unsigned char fn_bIsLevelPositionNameValid(void)
|
||
{
|
||
if ( g_stEngineStructure.szNextLevelPositionPersoName[0]==0
|
||
||g_stEngineStructure.szNextLevelPositionCameraName[0]==0)
|
||
return(FALSE);
|
||
else
|
||
return(TRUE);
|
||
}*/
|
||
/*************************************************************************/
|
||
/*void GAM_fn_vSetPlayerName(char * _szName)
|
||
{
|
||
strcpy(g_stGameOptions.szPlayerName,_szName);
|
||
}*/
|
||
/*************************************************************************/
|
||
/*char *GAM_fn_p_szGetPlayerName(void)
|
||
{
|
||
return(g_stGameOptions.szPlayerName);
|
||
}*/
|
||
/*************************************************************************/
|
||
/*unsigned char GAM_fn_bIsPlayerNameValid(char *_szName)
|
||
{
|
||
unsigned char ucReturn = TRUE;
|
||
|
||
if ( strlen(_szName)==0
|
||
||_szName[0]==' ')
|
||
ucReturn = FALSE;
|
||
|
||
return(ucReturn);
|
||
}*/
|
||
|
||
|
||
/*************************************************************************/
|
||
unsigned char GAM_fn_bIsSlotValid(short _wSlotdId)
|
||
{
|
||
unsigned char ucReturn = TRUE;
|
||
int Version = 0;
|
||
|
||
#ifdef U64
|
||
if ( strlen(g_stGameOptions.a_szSlotNames[_wSlotdId-1])==0
|
||
|| g_stGameOptions.a_szSlotNames[_wSlotdId-1][0]==' ' )
|
||
ucReturn = FALSE;
|
||
#else /* PC */
|
||
#ifdef ACTIVE_EDITOR
|
||
Version = fn_iVersionN64_PC();
|
||
if( Version == 1 /* N64 */)
|
||
{
|
||
if ( strlen(g_stGameOptions.a_szSlotNames[_wSlotdId-1])==0
|
||
|| g_stGameOptions.a_szSlotNames[_wSlotdId-1][0]==' ' )
|
||
ucReturn = FALSE;
|
||
}
|
||
else if( Version == 2 /* PC */)
|
||
{
|
||
StructRecupPosSlot *p_CurrentStructRecupPosSlot;
|
||
int iNum = 1;
|
||
|
||
p_CurrentStructRecupPosSlot = g_p_LastStructRecupPosSlot;
|
||
if( fn_lGetNbAvailableSlotsPc() < _wSlotdId) return FALSE;
|
||
while( iNum != _wSlotdId)
|
||
{
|
||
p_CurrentStructRecupPosSlot = p_CurrentStructRecupPosSlot->pt_NextStructRecupPosSlot;
|
||
iNum++;
|
||
}
|
||
|
||
if ( strlen( p_CurrentStructRecupPosSlot->a_szSlotNames ) == 0
|
||
|| *p_CurrentStructRecupPosSlot->a_szSlotNames == ' ' )
|
||
ucReturn = FALSE;
|
||
}
|
||
#else /* PC sans Editor*/
|
||
StructRecupPosSlot *p_CurrentStructRecupPosSlot;
|
||
int iNum = 1;
|
||
|
||
p_CurrentStructRecupPosSlot = g_p_LastStructRecupPosSlot;
|
||
if( fn_lGetNbAvailableSlotsPc() < _wSlotdId) return FALSE;
|
||
while( iNum != _wSlotdId)
|
||
{
|
||
p_CurrentStructRecupPosSlot = p_CurrentStructRecupPosSlot->pt_NextStructRecupPosSlot;
|
||
iNum++;
|
||
}
|
||
|
||
if ( strlen( p_CurrentStructRecupPosSlot->a_szSlotNames ) == 0
|
||
|| *p_CurrentStructRecupPosSlot->a_szSlotNames == ' ' )
|
||
ucReturn = FALSE;
|
||
#endif // EDITOR
|
||
#endif // U64
|
||
|
||
return(ucReturn);
|
||
}
|
||
/*************************************************************************/
|
||
|
||
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
|
||
unsigned char GAM_fn_bIsSlotNameValid(const char *_szName)
|
||
{
|
||
unsigned char ucReturn = TRUE;
|
||
|
||
if ( strlen(_szName)==0
|
||
||_szName[0]==' ')
|
||
ucReturn = FALSE;
|
||
|
||
return(ucReturn);
|
||
}
|
||
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
|
||
|
||
|
||
/*************************************************************************/
|
||
void fn_vRecurseSetDisplayBoudingVolumeFlag(HIE_tdxHandleToSuperObject _hSuperObject,unsigned char _bOnOff)
|
||
{
|
||
HIE_tdxHandleToSuperObject hChild;
|
||
long i;
|
||
long lType;
|
||
|
||
HIE_M_ForEachChildOf(_hSuperObject,hChild,i)
|
||
fn_vRecurseSetDisplayBoudingVolumeFlag(hChild,_bOnOff);
|
||
|
||
lType = HIE_fn_ulGetSuperObjectType(_hSuperObject);
|
||
if (lType & (HIE_C_ulActor | HIE_C_ulSector))
|
||
{
|
||
if (_bOnOff==0)
|
||
{
|
||
HIE_fn_vSetSuperObjectDrawMask(_hSuperObject,HIE_fn_lGetSuperObjectDrawMask(_hSuperObject)|GLI_C_lIsNotDrawingSuperObjectBoundingVolume|GLI_C_lIsNotDrawCollideInformationLight);
|
||
if (lType==HIE_C_ulActor)
|
||
fn_v3dDataSetDrawMask(M_GetMSHandle(_hSuperObject,3dData),fn_l3dDataGetDrawMask(M_GetMSHandle(_hSuperObject,3dData))|GLI_C_lIsNotDrawingSuperObjectBoundingVolume|GLI_C_lIsNotDrawCollideInformationLight);
|
||
}
|
||
else if (_bOnOff==1)
|
||
{
|
||
HIE_fn_vSetSuperObjectDrawMask(_hSuperObject,HIE_fn_lGetSuperObjectDrawMask(_hSuperObject)&~GLI_C_lIsNotDrawingSuperObjectBoundingVolume&~GLI_C_lIsNotDrawCollideInformationLight);
|
||
if (lType==HIE_C_ulActor)
|
||
fn_v3dDataSetDrawMask(M_GetMSHandle(_hSuperObject,3dData),fn_l3dDataGetDrawMask(M_GetMSHandle(_hSuperObject,3dData))&~GLI_C_lIsNotDrawingSuperObjectBoundingVolume&~GLI_C_lIsNotDrawCollideInformationLight);
|
||
}
|
||
}
|
||
}
|
||
/*************************************************************************/
|
||
void fn_vSetDisplayFlag(tdeEngineDisplayMode ulFlag,unsigned char ucValue)
|
||
{
|
||
fn_vSetGLIDisplayFlag(&g_stEngineStructure.ulDisplayMode,ulFlag,ucValue);
|
||
}
|
||
/*************************************************************************/
|
||
void fn_vSetGLIDisplayFlag(unsigned long *p_DisplayMode,tdeEngineDisplayMode ulFlag,unsigned char ucValue)
|
||
{
|
||
if (ulFlag==edmDisplayModeAll)
|
||
{
|
||
if (ucValue==1)
|
||
*p_DisplayMode |= GLI_C_lAllIsEnable;
|
||
else
|
||
*p_DisplayMode &= ~GLI_C_lAllIsEnable;
|
||
}
|
||
else if (ulFlag==edmDisplayModeTexture)
|
||
{
|
||
if (ucValue==1)
|
||
*p_DisplayMode |= GLI_C_lIsTextured;
|
||
else
|
||
*p_DisplayMode &= ~GLI_C_lIsTextured;
|
||
}
|
||
else if (ulFlag==edmDisplayModeGouraud)
|
||
{
|
||
if (ucValue==1)
|
||
*p_DisplayMode |= GLI_C_lIsGouraud;
|
||
else
|
||
*p_DisplayMode &= ~GLI_C_lIsGouraud;
|
||
}
|
||
else if (ulFlag==edmDisplayModeUseStaticLight)
|
||
{
|
||
if (ucValue==0)
|
||
*p_DisplayMode |= GLI_C_lIsUseStaticLights;
|
||
else
|
||
*p_DisplayMode &= ~GLI_C_lIsUseStaticLights;
|
||
}
|
||
else if (ulFlag==edmDisplayModeUseRLI)
|
||
{
|
||
if (ucValue==1)
|
||
*p_DisplayMode |= GLI_C_lIsUseRLI;
|
||
else
|
||
*p_DisplayMode &= ~GLI_C_lIsUseRLI;
|
||
}
|
||
else if (ulFlag==edmDisplayModeWired)
|
||
{
|
||
if (ucValue==0)
|
||
*p_DisplayMode |= GLI_C_lIsNotWired;
|
||
else
|
||
*p_DisplayMode &= ~GLI_C_lIsNotWired;
|
||
}
|
||
else if (ulFlag==edmDisplayModeChromed)
|
||
{
|
||
if (ucValue==0)
|
||
*p_DisplayMode |= GLI_C_lIsNotChromed;
|
||
else
|
||
*p_DisplayMode &= ~GLI_C_lIsNotChromed;
|
||
}
|
||
}
|
||
|
||
/*************************************************************************/
|
||
void fn_vChangeViewPortPercent
|
||
(
|
||
unsigned long _ulMode,
|
||
unsigned long _ulWhat,
|
||
unsigned long _ulWidth,
|
||
unsigned long _ulHeight,
|
||
unsigned long _ulClipTop,
|
||
unsigned long _ulClipLeft,
|
||
unsigned long _ulClipBottom,
|
||
unsigned long _ulClipRight,
|
||
int _iPosX,
|
||
int _iPosY
|
||
)
|
||
{
|
||
GLD_tdstViewportAttributes stViewAttrib;
|
||
struct GLI_tdstCamera_ *p_stCam;
|
||
|
||
/* FBF {*/
|
||
/* if
|
||
(
|
||
g_stEngineStructure.eEngineMode != EM_ModeMenu
|
||
)
|
||
*/ {
|
||
#if defined(WIN32)
|
||
WaitForSingleObject(g_stEngineStructure.hDrawSem, INFINITE);
|
||
#endif /*WIN32*/
|
||
|
||
if(_ulMode == 1)
|
||
/* XB 23/06/99 */
|
||
#ifndef U64
|
||
GLI_xGetViewportCamera(g_stEngineStructure.hGLDDevice,g_stEngineStructure.hGLDViewport,&p_stCam);
|
||
#else /* U64 */
|
||
GLI_xGetViewportCamera(NULL,NULL,&p_stCam);
|
||
#endif /* U64 */
|
||
/* End XB 23/06/99 */
|
||
else
|
||
/* XB 23/06/99 */
|
||
#ifndef U64
|
||
GLI_xGetViewportCamera(g_stEngineStructure.hGLDDevice,g_stEngineStructure.hGLDFixViewport,&p_stCam);
|
||
#else /* U64 */
|
||
GLI_xGetViewportCamera(NULL,g_stEngineStructure.hGLDFixViewport,&p_stCam);
|
||
#endif /* U64 */
|
||
/* End XB 23/06/99 */
|
||
|
||
if(p_stCam!=NULL)
|
||
{
|
||
/* XB 23/06/99 */
|
||
#ifndef U64
|
||
GLD_bGetViewportAttributes(g_stEngineStructure.hGLDDevice,g_stEngineStructure.hGLDViewport,&stViewAttrib);
|
||
#else /* U64 */
|
||
GLD_bGetViewportAttributes(NULL,NULL,&stViewAttrib);
|
||
#endif /* U64 */
|
||
/* End XB 23/06/99 */
|
||
|
||
if(_ulWhat == 1)
|
||
{
|
||
stViewAttrib.dwWidthInPercent = _ulWidth;
|
||
stViewAttrib.dwHeightInPercent = _ulHeight;
|
||
}
|
||
else if(_ulWhat == 2)
|
||
{
|
||
stViewAttrib.dwClipTopInPercent = _ulClipTop;
|
||
stViewAttrib.dwClipLeftInPercent = _ulClipLeft;
|
||
stViewAttrib.dwClipBottomInPercent = _ulClipBottom;
|
||
stViewAttrib.dwClipRightInPercent = _ulClipRight;
|
||
}
|
||
else if(_ulWhat == 3)
|
||
{
|
||
stViewAttrib.iOffsetPosX = _iPosX;
|
||
stViewAttrib.iOffsetPosY = _iPosY;
|
||
}
|
||
else if ( _ulWhat == 4 )
|
||
{
|
||
stViewAttrib.iOffsetPosX = (_iPosX * (int) stViewAttrib.dwWidth) / 1000;
|
||
stViewAttrib.iOffsetPosY = (_iPosY * (int) stViewAttrib.dwHeight) / 1000;
|
||
}
|
||
|
||
if(_ulMode == 1)
|
||
{
|
||
/* XB 23/06/99 */
|
||
#ifndef U64
|
||
GLD_bSetViewportPosition(g_stEngineStructure.hGLDDevice,g_stEngineStructure.hGLDViewport,&stViewAttrib);
|
||
GLI_xAdjustCameraToViewport(g_stEngineStructure.hGLDDevice,g_stEngineStructure.hGLDViewport,p_stCam);
|
||
#else /* U64 */
|
||
GLD_bSetViewportPosition(NULL,NULL,&stViewAttrib);
|
||
GLI_xAdjustCameraToViewport(NULL,NULL,p_stCam);
|
||
#endif /* U64 */
|
||
/* End XB 23/06/99 */
|
||
}
|
||
else
|
||
{
|
||
/* XB 23/06/99 */
|
||
#ifndef U64
|
||
GLD_bSetViewportPosition(g_stEngineStructure.hGLDDevice,g_stEngineStructure.hGLDFixViewport,&stViewAttrib);
|
||
GLI_xAdjustCameraToViewport(g_stEngineStructure.hGLDDevice,g_stEngineStructure.hGLDFixViewport,p_stCam);
|
||
#else /* U64 */
|
||
GLD_bSetViewportPosition(NULL,g_stEngineStructure.hGLDFixViewport,&stViewAttrib);
|
||
GLI_xAdjustCameraToViewport(NULL,g_stEngineStructure.hGLDFixViewport,p_stCam);
|
||
#endif /* U64 */
|
||
/* End XB 23/06/99 */
|
||
}
|
||
}
|
||
#if defined(WIN32)
|
||
ReleaseSemaphore(g_stEngineStructure.hDrawSem,1,NULL);
|
||
#endif /*WIN32*/
|
||
}
|
||
}
|
||
|
||
void fn_vChangeViewportRatio ( unsigned long ulMode, MTH_tdxReal xRatio ) {
|
||
struct GLI_tdstCamera_ *p_stCam;
|
||
|
||
#if defined(WIN32)
|
||
WaitForSingleObject(g_stEngineStructure.hDrawSem, INFINITE);
|
||
#endif /*WIN32*/
|
||
|
||
if ( ulMode == 1 ) {
|
||
/* XB 23/06/99 */
|
||
#ifndef U64
|
||
GLI_xGetViewportCamera( g_stEngineStructure.hGLDDevice, g_stEngineStructure.hGLDViewport, &p_stCam );
|
||
#else /* U64 */
|
||
GLI_xGetViewportCamera( NULL, NULL, &p_stCam );
|
||
#endif /* U64 */
|
||
/* End XB 23/06/99 */
|
||
if ( p_stCam != NULL ) {
|
||
GLI_xSetCameraRatio ( p_stCam, xRatio ) ;
|
||
/* XB 23/06/99 */
|
||
#ifndef U64
|
||
GLI_xAdjustCameraToViewport(g_stEngineStructure.hGLDDevice,g_stEngineStructure.hGLDViewport,p_stCam);
|
||
#else /* U64 */
|
||
GLI_xAdjustCameraToViewport(NULL,NULL,p_stCam);
|
||
#endif /* U64 */
|
||
/* End XB 23/06/99 */
|
||
}
|
||
}
|
||
else {
|
||
/* XB 23/06/99 */
|
||
#ifndef U64
|
||
GLI_xGetViewportCamera( g_stEngineStructure.hGLDDevice, g_stEngineStructure. hGLDFixViewport, &p_stCam );
|
||
#else /* U64 */
|
||
GLI_xGetViewportCamera( NULL, g_stEngineStructure. hGLDFixViewport, &p_stCam );
|
||
#endif /* U64 */
|
||
/* End XB 23/06/99 */
|
||
if ( p_stCam != NULL ) {
|
||
GLI_xSetCameraRatio ( p_stCam, xRatio ) ;
|
||
/* XB 23/06/99 */
|
||
#ifndef U64
|
||
GLI_xAdjustCameraToViewport(g_stEngineStructure.hGLDDevice,g_stEngineStructure.hGLDFixViewport,p_stCam);
|
||
#else /* U64 */
|
||
GLI_xAdjustCameraToViewport(NULL,g_stEngineStructure.hGLDFixViewport,p_stCam);
|
||
#endif /* U64 */
|
||
/* End XB 23/06/99 */
|
||
}
|
||
|
||
}
|
||
|
||
#if defined(WIN32)
|
||
ReleaseSemaphore(g_stEngineStructure.hDrawSem,1,NULL);
|
||
#endif /*WIN32*/
|
||
}
|
||
|
||
/**************************************************************************/
|
||
void GAM_fn_vActualizeAllGameViewportSize(void)
|
||
{
|
||
struct GLI_tdstCamera_ *p_stCam;
|
||
|
||
/* XB 23/06/99 */
|
||
#ifndef U64
|
||
|
||
GLI_xGetViewportCamera (g_stEngineStructure.hGLDDevice,g_stEngineStructure.hGLDViewport,&p_stCam);
|
||
if (p_stCam)
|
||
GLI_xAdjustCameraToViewport(g_stEngineStructure.hGLDDevice,g_stEngineStructure.hGLDViewport,p_stCam);
|
||
|
||
GLI_xGetViewportCamera (g_stEngineStructure.hGLDDevice,g_stEngineStructure.hGLDFixViewport,&p_stCam);
|
||
if (p_stCam)
|
||
GLI_xAdjustCameraToViewport(g_stEngineStructure.hGLDDevice,g_stEngineStructure.hGLDFixViewport,p_stCam);
|
||
|
||
#else /* U64 */
|
||
|
||
GLI_xGetViewportCamera (NULL,NULL,&p_stCam);
|
||
if (p_stCam)
|
||
GLI_xAdjustCameraToViewport(NULL,NULL,p_stCam);
|
||
|
||
GLI_xGetViewportCamera (NULL,g_stEngineStructure.hGLDFixViewport,&p_stCam);
|
||
if (p_stCam)
|
||
GLI_xAdjustCameraToViewport(NULL,g_stEngineStructure.hGLDFixViewport,p_stCam);
|
||
|
||
#endif /* U64 */
|
||
/* End XB 23/06/99 */
|
||
}
|
||
/**************************************************************************/
|
||
void GAM_fn_vCreateGameDeviceAndViewPorts(void)
|
||
{
|
||
/*XB*/
|
||
g_stEngineStructure.p_stFixCamera=NULL;
|
||
/*End XB*/
|
||
/* XB 23/06/99 */
|
||
#ifndef U64
|
||
fn_vCreateFixViewPort(g_stEngineStructure.hGLDDevice);
|
||
#else /* U64 */
|
||
fn_vCreateFixViewPort(NULL);
|
||
#endif /* U64 */
|
||
/* End XB 23/06/99 */
|
||
fn_vCreateGameViewPortCamera();
|
||
}
|
||
/**************************************************************************/
|
||
|
||
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC 04/06/99 */
|
||
void GAM_fn_vDestroyGameDeviceAndViewPorts(void)
|
||
{
|
||
fn_vDestroyFixViewPort(g_stEngineStructure.hGLDDevice);
|
||
}
|
||
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC 04/06/99 */
|
||
|
||
/**************************************************************************/
|
||
void fn_vCreateFixViewPort(GLD_tdhDevice _hDevice)
|
||
{
|
||
/*ANNECY CB*/
|
||
g_stEngineStructure.stFixViewportAttr.dwWidthInPercent = 100;
|
||
g_stEngineStructure.stFixViewportAttr.dwHeightInPercent = 100;
|
||
g_stEngineStructure.stFixViewportAttr.dwClipTopInPercent = 0;
|
||
g_stEngineStructure.stFixViewportAttr.dwClipBottomInPercent = 100;
|
||
g_stEngineStructure.stFixViewportAttr.dwClipLeftInPercent = 0;
|
||
g_stEngineStructure.stFixViewportAttr.dwClipRightInPercent = 100;
|
||
g_stEngineStructure.stFixViewportAttr.iOffsetPosX = 0;
|
||
g_stEngineStructure.stFixViewportAttr.iOffsetPosY = 0;
|
||
/*END ANNECY*/
|
||
|
||
if (!GLD_bCreateViewport(_hDevice,&g_stEngineStructure.stFixViewportAttr,&g_stEngineStructure.hGLDFixViewport))
|
||
M_GameFatalError(E_uwGameCantCreateFixViewPort);
|
||
if (!GLD_bGiveSpecificAttributesToViewport(_hDevice,g_stEngineStructure.hGLDFixViewport,&g_stEngineStructure.stFixAttributes3D))
|
||
M_GameFatalError(E_uwGameCantCreateFixViewPort);
|
||
|
||
GLD_bGetViewportAttributes(_hDevice,g_stEngineStructure.hGLDFixViewport,&g_stEngineStructure.stFixViewportAttr);
|
||
/*XB*/
|
||
if(g_stEngineStructure.p_stFixCamera==NULL)
|
||
{
|
||
fn_vCreateFixCamera();
|
||
}
|
||
/*End XB*/
|
||
GLI_xAdjustCameraToViewport(_hDevice,g_stEngineStructure.hGLDFixViewport,g_stEngineStructure.p_stFixCamera);
|
||
GLI_xSetViewportCamera(_hDevice,g_stEngineStructure.hGLDFixViewport,g_stEngineStructure.p_stFixCamera);
|
||
}
|
||
/**************************************************************************/
|
||
|
||
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC 07/06/99 */
|
||
void fn_vDestroyFixViewPort(GLD_tdhDevice _hDevice)
|
||
{
|
||
GLD_bDeleteViewport(_hDevice,g_stEngineStructure.hGLDFixViewport);
|
||
}
|
||
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC 07/06/99 */
|
||
|
||
/*************************************************************************/
|
||
void fn_vCreateFixCamera(void)
|
||
{
|
||
POS_tdstCompletePosition stCameraMatrix;
|
||
POS_tdstCompletePosition stTransformMatrix;
|
||
MTH3D_tdstVector stTranslationVector;
|
||
|
||
GLI_xCreateCamera ( &g_stEngineStructure.p_stFixCamera, GLI_C_lPersCamWithoutDistorsion );
|
||
|
||
GLI_xSetCameraAspectAndRatio ( g_stEngineStructure.p_stFixCamera, 1.5, 0.75 );
|
||
GLI_xSetCameraNearFar ( g_stEngineStructure.p_stFixCamera, 0.1f, 1000.0f );
|
||
|
||
GLI_xGetCameraMatrix ( g_stEngineStructure.p_stFixCamera, &stCameraMatrix );
|
||
|
||
MTH3D_M_vSetVectorElements(&stTranslationVector,MTH_C_ZERO,MTH_C_ZERO,MTH_M_xFloatToReal(5.0f));
|
||
|
||
POS_fn_vSetTranslationVector(&stCameraMatrix,&stTranslationVector);
|
||
|
||
POS_fn_vRotateX(&stCameraMatrix,MTH_C_PiBy2);
|
||
|
||
/* POS_fn_vSetIdentityMatrix(&stTransformMatrix);*/
|
||
MTH3D_M_vNullVector(&(stTransformMatrix.stTranslationVector));
|
||
MTH3D_M_vSetIdentityMatrix(&(stTransformMatrix.stRotationMatrix));
|
||
MTH3D_M_vSetIdentityMatrix(&(stTransformMatrix.stTransformMatrix));
|
||
stTransformMatrix.ulType = POS_C_ulIdentityMatrixFlag;
|
||
|
||
POS_fn_vRotateZ(&stTransformMatrix,MTH_C_Pi);
|
||
|
||
POS_fn_vMulMatrixMatrix ( &stCameraMatrix, &stTransformMatrix, &stCameraMatrix );
|
||
|
||
POS_fn_vNormalizeMatrix ( &stCameraMatrix );
|
||
|
||
GLI_xSetCameraMatrix ( g_stEngineStructure.p_stFixCamera, &stCameraMatrix );
|
||
}
|
||
/*************************************************************************/
|
||
void fn_vReputGameViewportCamera(void)
|
||
{
|
||
/* XB 23/06/99 */
|
||
#ifndef U64
|
||
GLI_xSetViewportCamera( g_stEngineStructure.hGLDDevice,g_stEngineStructure.hGLDViewport,g_stEngineStructure.p_stGameViewportCamera);
|
||
#else /* U64 */
|
||
GLI_xSetViewportCamera( NULL,NULL,g_stEngineStructure.p_stGameViewportCamera);
|
||
#endif /* U64 */
|
||
/* End XB 23/06/99 */
|
||
}
|
||
/*************************************************************************/
|
||
void fn_vCreateGameViewPortCamera(void)
|
||
{
|
||
GLI_xCreateCamera (&g_stEngineStructure.p_stGameViewportCamera,GLI_C_lPersCamWithoutDistorsion);
|
||
GLI_xSetCameraAspectAndRatio (g_stEngineStructure.p_stGameViewportCamera,1.5, 0.75);
|
||
/* XB 23/06/99 */
|
||
#ifndef U64
|
||
GLI_xSetViewportCamera( g_stEngineStructure.hGLDDevice,g_stEngineStructure.hGLDViewport,g_stEngineStructure.p_stGameViewportCamera);
|
||
#else /* U64 */
|
||
GLI_xSetViewportCamera( NULL,NULL,g_stEngineStructure.p_stGameViewportCamera);
|
||
#endif /* U64 */
|
||
/* End XB 23/06/99 */
|
||
}
|
||
/**************************************************************************/
|
||
/* ANNECY MT - 09/09/98 {*/
|
||
extern void CAM_fn_vForceBestPosition(HIE_tdxHandleToSuperObject _hCamera);
|
||
|
||
#ifdef U64
|
||
unsigned char g_bChangeMapRequested=0;
|
||
#endif
|
||
|
||
void GAM_fn_vAskToChangeLevel(char *szNewLevelName, ACP_tdxBool _bAskForAutosave )
|
||
{
|
||
#ifdef U64 /* {*/
|
||
|
||
/* FQ LAST FRAME BUG FIX */
|
||
g_bChangeMapRequested=1;
|
||
|
||
/* FB160299 necessary when loading a game from the mapmonde (we need to reload the mapmonde with the new pastilles ...)
|
||
if (stricmp(szNewLevelName,fn_p_szGetLevelName()))
|
||
{*/
|
||
|
||
|
||
GAM_g_ucSaveGameBeforeChangeLevel = _bAskForAutosave ;
|
||
fn_vSetNextLevelName(szNewLevelName);
|
||
fn_vChangeEngineMode(EM_ModeChangeLevel);
|
||
#if defined(FINAL_VERSION_FOR_TESTERS) && defined(U64)
|
||
GAM_PrintAllUsedStaticMemory();
|
||
#endif /* defined(FINAL_VERSION_FOR_TESTERS) && defined(U64) */
|
||
/*}*/
|
||
#else /* } {*/
|
||
char szLevelName[80];
|
||
char *p_cDelimiter;
|
||
|
||
#if (defined(USE_PROFILER) && !defined(U64))
|
||
MMG_fn_vClearMemoryRaster ();
|
||
#endif
|
||
|
||
strcpy(szLevelName,szNewLevelName);
|
||
p_cDelimiter = strchr(szLevelName,'$');
|
||
if(p_cDelimiter == 0)
|
||
{
|
||
/* new Map*/
|
||
/* */
|
||
/* Change map even if it's the same (to redo the inits and load savegame)
|
||
if (stricmp(szNewLevelName,fn_p_szGetLevelName()))
|
||
*/
|
||
{
|
||
GAM_g_ucSaveGameBeforeChangeLevel = _bAskForAutosave ;
|
||
fn_vSetNextLevelName(szNewLevelName);
|
||
fn_vChangeEngineMode(EM_ModeChangeLevel);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
*p_cDelimiter++ = 0;
|
||
if (stricmp(szLevelName,fn_p_szGetLevelName()))
|
||
{
|
||
/* SubMap of new Map*/
|
||
GAM_g_ucSaveGameBeforeChangeLevel = _bAskForAutosave ;
|
||
fn_vSetNextLevelName(szNewLevelName);
|
||
fn_vChangeEngineMode(EM_ModeChangeLevel);
|
||
}
|
||
else
|
||
{
|
||
long lSubMapNumber = fn_lAToI(p_cDelimiter);
|
||
if(lSubMapNumber != (long) GAM_M_GetSubMap(fn_lGetSubMapNumber()))
|
||
{
|
||
/* teleport main character*/
|
||
HIE_tdxHandleToSuperObject hMaincharacter = MC_fn_hGetCharacterInMainCharacterNode( MC_fn_hGetFirstMainCharNode() );
|
||
POS_tdxHandleToPosition hNewPosition;
|
||
long lEntryNumber;
|
||
|
||
p_cDelimiter = strchr(++p_cDelimiter,'$');
|
||
if(p_cDelimiter == 0)
|
||
{
|
||
lEntryNumber = 0;
|
||
}
|
||
else
|
||
{
|
||
lEntryNumber = fn_lAToI(++p_cDelimiter);
|
||
}
|
||
hNewPosition = GAM_fn_hGetSubMapPosition(lSubMapNumber,lEntryNumber);
|
||
if(hNewPosition)
|
||
{
|
||
MTH3D_tdstVector stVector , stCameraPos , stZAxis;
|
||
POS_tdxHandleToPosition hGlobalMatrix;
|
||
HIE_tdxHandleToSuperObject hSectorBeforeTeleport, hSectorAfterTeleport;
|
||
|
||
/* Get sector of actor BEFORE teleport */
|
||
hSectorBeforeTeleport = M_GetMSHandle(hMaincharacter,SectInfo)->hCurrentSector;
|
||
|
||
POS_fn_vGetTranslationVector( hNewPosition , &stVector );
|
||
|
||
hGlobalMatrix = HIE_fn_hGetSuperObjectGlobalMatrix (hMaincharacter);
|
||
POS_fn_vSetTranslationVector( hGlobalMatrix, &stVector );
|
||
|
||
/**/
|
||
if (HIE_fn_hGetSuperObjectFather(hMaincharacter)!=gp_stDynamicWorld)
|
||
{
|
||
if( fn_ucStandardGameGetPlatFormType(M_GetMSHandle(hMaincharacter,StandardGame))!=0 )
|
||
{
|
||
HIE_fn_vSuperObjectAddHead(gp_stDynamicWorld,hMaincharacter);
|
||
}
|
||
else
|
||
{
|
||
HIE_fn_vSuperObjectAddTail(gp_stDynamicWorld,hMaincharacter);
|
||
}
|
||
}
|
||
/* Player will restart at the begining of the submap*/
|
||
POS_fn_vCopyMatrix(fn_p_st3dDataGetMatrixInit(M_GetMSHandle(hMaincharacter,3dData)),hGlobalMatrix);
|
||
/* Test for sector change and actor reinit (before initobject !) */
|
||
// GAM_fn_vSectInfoTestChangeSectorForCharacter(hMaincharacter);
|
||
/**/
|
||
fn_vInitOneObject((tdstEngineObject *)HIE_fn_hGetSuperObjectObject(hMaincharacter),OTI_LoadSavedGame);
|
||
/**/
|
||
|
||
HIE_fn_vComputeNewRelativeMatrix (hMaincharacter);
|
||
|
||
/* update dynamics*/
|
||
MEC_fn_vImposeActorMatrix (hMaincharacter);
|
||
|
||
/* update Target position*/
|
||
CAM_fn_vUpdateTargetPosition(M_GetMSHandle(g_stEngineStructure.h_StdCamCaracter,Cineinfo));
|
||
fn_vInitAveragePositionDatasIfNecessary(M_GetMSHandle(g_stEngineStructure.h_StdCamCaracter,Cineinfo));
|
||
|
||
/* compute camera position*/
|
||
MTH3D_M_vSetVectorElements(&stCameraPos, MTH_C_ZERO, MTH_C_2, MTH_C_2);
|
||
POS_fn_vMulMatrixVertex(&stCameraPos , hGlobalMatrix , &stCameraPos);
|
||
/* set camera position*/
|
||
CAM_fn_vForceCameraPos(g_stEngineStructure.h_StdCamCaracter,&stCameraPos);
|
||
|
||
/* set camera target*/
|
||
MTH3D_M_vSetVectorElements(&stZAxis, MTH_C_ZERO, MTH_C_ZERO, MTH_C_ONE);
|
||
CAM_fn_vForceCameraTgt(g_stEngineStructure.h_StdCamCaracter,&stVector,&stZAxis);
|
||
|
||
CAM_fn_vForceBestPosition(g_stEngineStructure.h_StdCamCaracter);
|
||
|
||
/* Get sector of actor AFTER teleport (updated by initobject) */
|
||
hSectorAfterTeleport = M_GetMSHandle(hMaincharacter,SectInfo)->hCurrentSector;
|
||
|
||
/* If sector has changed, do inits for sector change */
|
||
if( hSectorAfterTeleport != hSectorBeforeTeleport )
|
||
fn_vInitObjectsWhenPlayerChangeSector( hMaincharacter, hSectorAfterTeleport, hSectorBeforeTeleport );
|
||
|
||
/* update current SubMap Number*/
|
||
fn_vSetLevelName(szNewLevelName);
|
||
|
||
}
|
||
#if !defined(RETAIL) /* {*/
|
||
else
|
||
{
|
||
/* we have first load a submap, we try to load another one now*/
|
||
GAM_g_ucSaveGameBeforeChangeLevel = _bAskForAutosave ;
|
||
fn_vSetNextLevelName(szNewLevelName);
|
||
fn_vChangeEngineMode(EM_ModeChangeLevel);
|
||
}
|
||
#endif /* RETAIL }*/
|
||
}
|
||
}
|
||
}
|
||
#endif /* !U64 }*/
|
||
}
|
||
/* END ANNECY MT }*/
|
||
|
||
/**************************************************************************/
|
||
/*void GAM_fn_vAskToChangeLevelWithPosition(char *szNewLevelName,char *szNewPositionPersoName,char *szNewPositionCameraName)
|
||
{
|
||
if (stricmp(szNewLevelName,fn_p_szGetLevelName()))
|
||
{
|
||
fn_vSetNextLevelName(szNewLevelName);
|
||
fn_vSetNextLevelPositionName(szNewPositionPersoName,szNewPositionCameraName);
|
||
fn_vChangeEngineMode(EM_ModeChangeLevel);
|
||
}
|
||
}*/
|
||
/**************************************************************************/
|
||
|
||
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
|
||
unsigned char fn_bIsLevelExist(char *p_szLevelName)
|
||
{
|
||
unsigned char ucReturn = FALSE;
|
||
unsigned long i;
|
||
FIL_tdxHandleToFileNameListElement hFileNameListElement;
|
||
|
||
LST2_M_DynamicForEachElementOf(&g_stEngineStructure.hLevelNameList->hFileNameListAnchor,hFileNameListElement,i)
|
||
{
|
||
if (!stricmp(p_szLevelName,hFileNameListElement->szFileName))
|
||
ucReturn = TRUE;
|
||
}
|
||
|
||
return(ucReturn);
|
||
}
|
||
|
||
/**************************************************************************/
|
||
unsigned char GAM_fn_bIsEngineInFixMode(void)
|
||
{
|
||
unsigned char ucReturn = FALSE;
|
||
|
||
if (GAM_g_ucHLMMemoryBlock==(unsigned char)E_ucGameFixMemory)
|
||
ucReturn = TRUE;
|
||
return(ucReturn);
|
||
}
|
||
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
|
||
|
||
/**************************************************************************/
|
||
unsigned char GAM_fn_bIsEngineInLevelMode(void)
|
||
{
|
||
unsigned char ucReturn = FALSE;
|
||
|
||
if (GAM_g_ucHLMMemoryBlock==(unsigned char)E_ucGameLevelMemory)
|
||
ucReturn = TRUE;
|
||
return(ucReturn);
|
||
}
|
||
/**************************************************************************/
|
||
void GAM_fn_vSetEngineInFixMode(void)
|
||
{
|
||
#ifdef GAM_USE_SCRIPT
|
||
/* GLI_vSetPathOfTexture(fn_szGetFixTexturesDataPath());*/
|
||
#endif /* GAM_USE_SCRIPT*/
|
||
GEO_xSelectMemoryChannel(ACP_FixMemoryChannel);
|
||
GAM_fn_vSetGameMemoryInFix();
|
||
AI_fn_vAIUseFixMemory();
|
||
SAI_fn_vSAIUseFixMemory();
|
||
SCR_fn_v_Mem_SetCurrentLevel(GAM_C_FixScriptPriority);
|
||
SCR_fn_v_Mem_SetCurrentLinkLevel(GAM_C_FixScriptPriority);
|
||
#if !defined(U64)
|
||
/* BIN_fn_vSetMemoryInFixMode();*/
|
||
#endif /* U64 */
|
||
}
|
||
/**************************************************************************/
|
||
void GAM_fn_vSetEngineInLevelMode(void)
|
||
{
|
||
#ifdef GAM_USE_SCRIPT
|
||
GLI_vSetPathOfTexture(fn_szGetTexturesDataPath());
|
||
#endif /* GAM_USE_SCRIPT*/
|
||
GEO_xSelectMemoryChannel(ACP_LevelMemoryChannel);
|
||
GAM_fn_vSetGameMemoryInLevel();
|
||
AI_fn_vAIUseLevelMemory();
|
||
SAI_fn_vSAIUseLevelMemory();
|
||
SCR_fn_v_Mem_SetCurrentLevel(GAM_C_LevelScriptPriority);
|
||
SCR_fn_v_Mem_SetCurrentLinkLevel(GAM_C_LevelScriptPriority);
|
||
#if !defined(U64)
|
||
/* BIN_fn_vSetMemoryInLevelMode();*/
|
||
#endif /* U64 */
|
||
}
|
||
/**************************************************************************/
|
||
|
||
|
||
void GAM_fn_vTreatExeParameters(void)
|
||
{
|
||
#if defined(GAM_COMMAND_LINE)
|
||
/**** A3B ****/
|
||
#ifdef A3B_GENERATOR
|
||
/*
|
||
if(strstr(fn_szGetExeCommandLine(),"-a3b"))
|
||
{
|
||
char *p_szSubString;
|
||
|
||
p_szSubString=strstr(fn_szGetExeCommandLine(),"-a3b");
|
||
p_szSubString+=4; // end of a3b
|
||
if(*p_szSubString!='"') // no log file : binarize all
|
||
{
|
||
GEO_xInitGEOError();
|
||
POS_fn_vInitPos();
|
||
fn_vFirstInitAIMemory();
|
||
SAI_fn_vFirstInit();
|
||
TMP_fn_vFirstInit();
|
||
fn_vFirstInitGameMemory();
|
||
fn_vInitAndRegisterAllScriptSections();
|
||
fn_vRegisterAllAnimationsScriptSections();
|
||
CHL_fn_vRegisterAllScriptSections();
|
||
fn_vInitAllLinkTables();
|
||
GAM_fn_vSetGameMemoryInFix();
|
||
SCR_fnp_st_RdL0_AnalyseSection("Game.mem", SCR_CDF_uw_Anl_Normal);
|
||
SCR_fnp_st_RdL0_AnalyseSection("A3b.dsc", SCR_CDF_uw_Anl_Normal); // for the directories
|
||
fn_vReadAllCHL("*");
|
||
GAM_fn_vSetGameMemoryInLevel();
|
||
SCR_fnp_st_RdL0_AnalyseSection("A3b.mem", SCR_CDF_uw_Anl_Normal);
|
||
SCR_fn_v_RdL0_RegisterCallback("SndEventIdList",SND_fn_eLoadEventIdListForFamilyBinarisation,SCR_CRC_c_RdL0_ForSection);
|
||
// SCR_fnp_st_RdL0_AnalyseSection("GameData\\World\\Sound\\Ed_main.lcb^SndEventIdList", SCR_CDF_uw_Anl_Normal); // Use a constant later
|
||
SCR_fn_v_Link_InitTable(&BIN_gs_BinEventConversionTable);
|
||
fn_vBinarizeAllAnimations("*");
|
||
fn_vBinarizeAllAnimations("*");
|
||
exit(0);
|
||
}
|
||
else
|
||
{
|
||
char szLogFile[256];
|
||
int i=0;
|
||
|
||
while((*(++p_szSubString)!='"')&&(i<256))
|
||
{
|
||
szLogFile[i++]=*p_szSubString;
|
||
}
|
||
szLogFile[i]=0;
|
||
|
||
GEO_xInitGEOError();
|
||
POS_fn_vInitPos();
|
||
fn_vFirstInitAIMemory();
|
||
SAI_fn_vFirstInit();
|
||
TMP_fn_vFirstInit();
|
||
fn_vFirstInitGameMemory();
|
||
fn_vInitAndRegisterAllScriptSections();
|
||
fn_vRegisterAllAnimationsScriptSections();
|
||
CHL_fn_vRegisterAllScriptSections();
|
||
fn_vInitAllLinkTables();
|
||
GAM_fn_vSetGameMemoryInFix();
|
||
SCR_fnp_st_RdL0_AnalyseSection("Game.mem", SCR_CDF_uw_Anl_Normal);
|
||
SCR_fnp_st_RdL0_AnalyseSection("A3b.dsc", SCR_CDF_uw_Anl_Normal); // for the directories
|
||
fn_vReadAllCHL("*");
|
||
GAM_fn_vSetGameMemoryInLevel();
|
||
SCR_fnp_st_RdL0_AnalyseSection("A3b.mem", SCR_CDF_uw_Anl_Normal);
|
||
SCR_fn_v_RdL0_RegisterCallback("SndEventM",SND_fn_eLoadEventM_ForFamilyBinarisation,SCR_CRC_c_RdL0_ForSection);
|
||
SCR_fn_v_RdL0_RegisterCallback("SndEventIdList",SND_fn_eLoadEventIdListForFamilyBinarisation,SCR_CRC_c_RdL0_ForSection);
|
||
SCR_fn_v_Link_InitTable(&BIN_gs_BinEventConversionTable);
|
||
|
||
// Finally binarize the animations
|
||
SCR_fn_v_RdL0_RegisterCallback("BeginLog",GAM_fn_eAnimationBinarise,SCR_CRC_c_RdL0_ForSection);
|
||
SCR_fn_v_Link_InitTable(&GAM_g_stAnimationBinarisationLinkTable);
|
||
SCR_fnp_st_RdL0_AnalyseSection(szLogFile, SCR_CDF_uw_Anl_Normal);
|
||
exit(0);
|
||
}
|
||
}
|
||
*/
|
||
#endif
|
||
|
||
|
||
/**** Video ****/
|
||
if(strstr(fn_szGetExeCommandLine(),"-cdrom:"))
|
||
{
|
||
char szVideoPath[_MAX_PATH]=" ";
|
||
|
||
strncpy(szVideoPath,strstr(fn_szGetExeCommandLine(),"-cdrom:")+7, 1 );
|
||
strncpy(&g_cCDROM,szVideoPath,1); /* save the letter of the CDROM*/
|
||
strcat(szVideoPath,":\\Videos");
|
||
#ifdef GAM_VIDEO
|
||
VDO_fn_xSetDirectoryAVI(szVideoPath);
|
||
#endif
|
||
}
|
||
|
||
if (!g_cCDROM)
|
||
{
|
||
strcpy(&g_cCDROM,"c");
|
||
if (!g_iComplete)
|
||
{
|
||
Erm_fn_iMessageBox("Insert the Rayman CD-ROM"
|
||
,"CD-Driver Problem"
|
||
,MB_OK |MB_TOPMOST);
|
||
exit(-1);
|
||
}
|
||
}
|
||
|
||
|
||
g_cIsLevelOk = 0;
|
||
g_cMemMode = 0;
|
||
if(strstr(fn_szGetExeCommandLine(),"-level:"))
|
||
{
|
||
char szLevel[40]=" ";
|
||
|
||
sscanf(strstr(fn_szGetExeCommandLine(),"-level:")+7,"%s",szLevel);
|
||
fn_vSetFirstLevelName(szLevel);
|
||
g_cIsLevelOk = 1;
|
||
}
|
||
|
||
if(strstr(fn_szGetExeCommandLine(),"-bin:"))
|
||
{
|
||
char a_cMode[] = " ";
|
||
sscanf(strstr(fn_szGetExeCommandLine(),"-bin:")+5,"%c",a_cMode);
|
||
SNA_fn_vSetLoadType( (unsigned char)atoi(a_cMode) );
|
||
}
|
||
|
||
if(strstr(fn_szGetExeCommandLine(),"-mem:"))
|
||
{
|
||
char a_cMemMode[] = " ";
|
||
sscanf(strstr(fn_szGetExeCommandLine(),"-mem:")+5,"%c",a_cMemMode);
|
||
g_cMemMode =(char) atoi(a_cMemMode);
|
||
}
|
||
|
||
#ifndef U64
|
||
if(strstr(fn_szGetExeCommandLine(),"-DumpMem"))
|
||
{
|
||
g_bDumpMemory = TRUE;
|
||
}
|
||
#endif /* U64 */
|
||
/*
|
||
* GuS 98/08/06 :
|
||
* Command line for some script binarization (game.mem, game.dsc, level.mem...)
|
||
* systanx is : -dsc:2 => making of binary files
|
||
* -dsc:1 => use those binary files
|
||
*/
|
||
if(strstr(fn_szGetExeCommandLine(),"-dsc:"))
|
||
{
|
||
char szDscMode[2];
|
||
sscanf(strstr(fn_szGetExeCommandLine(),"-dsc:")+5,"%c",szDscMode);
|
||
szDscMode[1] = 0;
|
||
|
||
SNA_fn_vSetLoadDscType( (char) atoi(szDscMode) );
|
||
}
|
||
else
|
||
{
|
||
SNA_fn_vSetLoadDscType( SNA_C_LoadScriptDsc );
|
||
}
|
||
|
||
if ( !GLI_fnl_InitDll() )
|
||
{
|
||
Erm_fn_iMessageBox("Graphics Dll not found, run install","Setup problem", MB_ICONERROR | MB_OK | MB_TOPMOST);
|
||
exit( -1 );
|
||
}
|
||
|
||
GLI_fn_vLoadDisplayMode();
|
||
|
||
if ( !GLI_fn_lChooseDisplayMode() )
|
||
{
|
||
Erm_fn_iMessageBox("Graphics mode not found, run install","Setup problem", MB_ICONERROR | MB_OK | MB_TOPMOST);
|
||
exit( -1 );
|
||
}
|
||
|
||
MAIN_fn_vSetDeviceWidth( GLI_fn_lDisplayModeWidth(), GLI_fn_lDisplayModeHeight() );
|
||
MAIN_fn_vSetDeviceMode( GLI_fn_lIsFullScreenMode() );
|
||
|
||
/*
|
||
* Read StartPrg.INI
|
||
*/
|
||
GAM_fn_vGetDataDirectoryInStartPrgIni();
|
||
|
||
/*
|
||
* Read Test.INI
|
||
*/
|
||
#if !defined(U64) && !defined(RETAIL)
|
||
GAM_fn_vReadFileTestIni();
|
||
#endif
|
||
|
||
|
||
|
||
fn_vSetGameDataPath(g_a64_cGameDataDirectory);
|
||
SCR_fn_v_RdL0_RegisterPath(g_a64_cGameDataDirectory);
|
||
#endif /* GAM_COMMAND_LINE */
|
||
}
|
||
/**************************************************************************/
|
||
|
||
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
|
||
|
||
void GAM_fn_vReadStringInUbiIniFile( char *_szKey, char *_szID, long _lBufferLength, char *_szBuffer )
|
||
{
|
||
char szWinDir[_MAX_PATH];
|
||
GetWindowsDirectory(szWinDir,_MAX_PATH);
|
||
strcat(szWinDir,"/UbiSoft/Ubi.ini");
|
||
|
||
GetPrivateProfileString( _szKey, _szID, _szBuffer, _szBuffer, _lBufferLength, szWinDir);
|
||
}
|
||
|
||
void GAM_fn_vWriteStringInUbiIniFile( char *_szKey, char *_szID, char *_szBuffer )
|
||
{
|
||
char szWinDir[_MAX_PATH];
|
||
GetWindowsDirectory(szWinDir,_MAX_PATH);
|
||
strcat(szWinDir,"/UbiSoft/Ubi.ini");
|
||
|
||
WritePrivateProfileString( _szKey, _szID, _szBuffer, szWinDir);
|
||
}
|
||
|
||
|
||
void GAM_fn_vReadUbiIniFileForGame(void)
|
||
{
|
||
#if defined(GAM_READ_INI_FILE)
|
||
char szTemp[255];
|
||
char szWinDir[_MAX_PATH];
|
||
HDC hDC;
|
||
long lBPP;
|
||
static int _s_ForceMode=1;
|
||
|
||
GetWindowsDirectory(szWinDir,_MAX_PATH);
|
||
strcat(szWinDir,"/UbiSoft/Ubi.ini");
|
||
|
||
#ifdef ACTIVE_EDITOR
|
||
|
||
|
||
|
||
GetPrivateProfileString("Rayman2", "Driver", "", szTemp, 255, szWinDir);
|
||
|
||
// if( (_s_ForceMode==0 && strcmp(szTemp,"DirectX")==0) || (_s_ForceMode==1) )
|
||
#ifdef USE_DIRECTX
|
||
{
|
||
GLI_fnv_SetDllFileName("GliDX6");
|
||
GLI_fnv_SetDllName("DirectX6");
|
||
GLI_fnv_SetDriverName( "display" );
|
||
GLI_fnv_SetDeviceName( "Direct3D HAL" );
|
||
}
|
||
#else
|
||
//else
|
||
{
|
||
GLI_fnv_SetDllFileName( "GliVD1" );
|
||
GLI_fnv_SetDllName( "Glide2" );
|
||
GLI_fnv_SetDriverName( "" );
|
||
GLI_fnv_SetDeviceName( "" );
|
||
}
|
||
#endif
|
||
|
||
|
||
|
||
hDC = GetDC(NULL);
|
||
lBPP = GetDeviceCaps(hDC, PLANES) * GetDeviceCaps(hDC, BITSPIXEL);
|
||
ReleaseDC(NULL, hDC);
|
||
|
||
GLI_fnv_SetMode( 0, 640, 480, lBPP );
|
||
|
||
#else /* ACTIVE_EDITOR */
|
||
|
||
GetPrivateProfileString("Rayman2", "GLI_DllFile", "", szTemp, 255, szWinDir);
|
||
GLI_fnv_SetDllFileName( szTemp );
|
||
GetPrivateProfileString("Rayman2", "GLI_Dll", "", szTemp, 255, szWinDir);
|
||
GLI_fnv_SetDllName( szTemp );
|
||
GetPrivateProfileString("Rayman2", "GLI_Driver", "", szTemp, 255, szWinDir);
|
||
GLI_fnv_SetDriverName( szTemp );
|
||
GetPrivateProfileString("Rayman2", "GLI_Device", "", szTemp, 255, szWinDir);
|
||
GLI_fnv_SetDeviceName( szTemp );
|
||
GetPrivateProfileString("Rayman2", "GLI_Mode", "", szTemp, 255, szWinDir);
|
||
GLI_fnv_SetModeByString( szTemp );
|
||
|
||
#endif /* ACTIVE_EDITOR */
|
||
|
||
/**** Get the texture mode ****/
|
||
GetPrivateProfileString("Rayman2","TexturesMem","Agp",szTemp,255,szWinDir);
|
||
GLI_vSetTextureMode(szTemp);
|
||
|
||
/**** Get the level of particules ****/
|
||
GetPrivateProfileString("RAYMAN2","ParticuleRate","Medium",szTemp,_MAX_PATH,szWinDir);
|
||
if (!stricmp(szTemp,"Null"))
|
||
fn_vSetFactorForParticlesGeneration(0);
|
||
if (!stricmp(szTemp,"Low"))
|
||
fn_vSetFactorForParticlesGeneration(1);
|
||
else if (!stricmp(szTemp,"Medium"))
|
||
fn_vSetFactorForParticlesGeneration(2);
|
||
else if (!stricmp(szTemp,"High"))
|
||
fn_vSetFactorForParticlesGeneration(3);
|
||
|
||
/**** Get the language ****/
|
||
/* useless, because this is done before the language definition is loaded -> we do it elsewhere
|
||
GetPrivateProfileString("RAYMAN2","Language","English",g_sLanguage,_MAX_PATH,szWinDir);
|
||
j=0;
|
||
g_stEngineStructure.ucCurrentLanguage = 0;
|
||
while (j< g_stEngineStructure.ucNbLanguages)
|
||
{
|
||
if (strcmp(g_sLanguage, g_stEngineStructure.p_stLanguageTable[j].szLanguageCode) ==0)
|
||
{
|
||
g_stEngineStructure.ucCurrentLanguage = (unsigned char) j;
|
||
break;
|
||
}
|
||
j++;
|
||
}
|
||
*/
|
||
/**** Get the SoundOnHD flag ****/
|
||
GetPrivateProfileString("RAYMAN2","SoundOnHD","0",szTemp,_MAX_PATH,szWinDir);
|
||
sscanf(szTemp,"%d",&g_iSoundOnHD);
|
||
|
||
/**** Get the Complete Install flag ****/
|
||
GetPrivateProfileString("RAYMAN2","Complete","1",szTemp,_MAX_PATH,szWinDir);
|
||
sscanf(szTemp,"%d",&g_iComplete);
|
||
|
||
#endif /* GAM_READ_INI_FILE */
|
||
}
|
||
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
|
||
|
||
/**************************************************************************/
|
||
#if defined(GAM_VIDEO)
|
||
char *fn_szGetIntroductionVideoName(void)
|
||
{
|
||
return("Edprol.avi");
|
||
}
|
||
/**************************************************************************/
|
||
void fn_vRunTheGameVideo(void)
|
||
{
|
||
VDO_fn_xSetGraphicEnvironment(g_stEngineStructure.hGLDDevice,g_stEngineStructure.hGLDFixViewport);
|
||
VDO_fn_xPlayVideoAVI(fn_szGetIntroductionVideoName(),AVI_SYNCH_OBJECT);
|
||
IPT_fn_vReadInput();
|
||
/* ANNECY AV {*/
|
||
while(!fn_bTestIfEndOfAppliAsked() && VDO_fn_bIsRunningAVI() /* &&IPT_fn_bIsJustValidated(g_st_3DOS_EntryActions.hStopTheVideo)!=IPT_C_TRUE */)
|
||
/* END ANNECY AV }*/
|
||
{
|
||
IPT_fn_vReadInput();
|
||
Sleep(0);
|
||
}
|
||
VDO_fn_xStopVideoAVI();
|
||
}
|
||
#endif /* GAM_VIDEO */
|
||
/**************************************************************************/
|
||
/* save the value of the timer used in HIE*/
|
||
long g_lCurrentFrameSave = 0;
|
||
|
||
|
||
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
|
||
void fn_vSetEngineInPaused(void)
|
||
{
|
||
g_stEngineStructure.bEngineIsInPaused=TRUE;
|
||
g_lCurrentFrameSave= HIE_gs_lCurrentFrame;
|
||
|
||
fn_vSaveEngineClock();
|
||
}
|
||
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
|
||
|
||
/**************************************************************************/
|
||
/* Modif 03/09/98 : Load Clock when unpause the game - Carlos Torres*/
|
||
void fn_vResetEngineFromPaused(void)
|
||
{
|
||
g_stEngineStructure.bEngineIsInPaused=FALSE;
|
||
|
||
HIE_gs_lCurrentFrame = g_lCurrentFrameSave;
|
||
fn_vLoadEngineClock();
|
||
}
|
||
/**************************************************************************/
|
||
unsigned char fn_bIsEngineInPause(void)
|
||
{
|
||
return(g_stEngineStructure.bEngineIsInPaused);
|
||
}
|
||
/**************************************************************************/
|
||
|
||
#ifndef _FIRE_DEADCODE_U64_ /* Added by RUC */
|
||
void fn_vSetDisplayFixFlag(enum tdeDisplayFixMode_ _eValue)
|
||
{
|
||
g_stEngineStructure.eDisplayFixMode = (unsigned char)_eValue;
|
||
}
|
||
#endif /* _FIRE_DEADCODE_U64_ */ /* Added by RUC */
|
||
|
||
/*FB261198*/
|
||
/* ALL the end of this file from this point MUST DISAPPEAR*/
|
||
|
||
|
||
|