270 lines
9.0 KiB
C
270 lines
9.0 KiB
C
/*--------------------------------------------------------------------*
|
|
* SnaNoScr.h written by Guillaume Souchet (based on Michael Ryssen's code)
|
|
*
|
|
* Purpose : load binarized game desc scripts
|
|
* (game.dsc, game.mem, level.mem, level.dsc)
|
|
*--------------------------------------------------------------------*/
|
|
|
|
#ifndef __SNANOSCR_H__
|
|
#define __SNANOSCR_H__
|
|
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
|
|
/* File containing game description (in the gamedata directory)*/
|
|
#define SNA_C_GameDscFileName "Game.dsb"
|
|
|
|
/* File containing level description is named <NameOfLevel>.dsb (in the level directory)*/
|
|
|
|
|
|
/* Type of the file currently opened*/
|
|
typedef enum tdeDscFileType_
|
|
{
|
|
SNA_C_NoDscFile = 0,
|
|
SNA_C_GameDscFile = 1,
|
|
SNA_C_LevelDscFile = 2
|
|
} tdeDscFileType;
|
|
|
|
/* File currently opened*/
|
|
extern enum tdeDscFileType_ SNA_g_eFileCurrentlyOpened;
|
|
|
|
|
|
/* Constants for SNA_fn_ucGetLoadDscType*/
|
|
/* and SNA_fn_vSetLoadDscType*/
|
|
#define SNA_C_LoadScriptDsc 0
|
|
#define SNA_C_LoadBinaryDsc 1
|
|
#define SNA_C_SaveBinaryDsc 2
|
|
|
|
|
|
|
|
/* Keyword constants in the dsb files.*/
|
|
|
|
/* From Game.mem */
|
|
#define SNA_C_ul_MemoryDescTitle 0
|
|
#define SNA_C_ul_GAMFixMemory 1
|
|
#define SNA_C_ul_ACPFixMemory 2
|
|
#define SNA_C_ul_ACPTextMemory 3
|
|
#define SNA_C_ul_AIFixMemory 4
|
|
#define SNA_C_ul_TMPFixMemory 5
|
|
#define SNA_C_ul_IPTMemory 6
|
|
#define SNA_C_ul_SAIFixMemory 7
|
|
#define SNA_C_ul_FontMemory 8
|
|
#define SNA_C_ul_PositionMemory 9
|
|
|
|
/* From level.mem */
|
|
#define SNA_C_ul_GAMLevelMemory 11
|
|
#define SNA_C_ul_AILevelMemory 12
|
|
#define SNA_C_ul_ACPLevelMemory 13
|
|
#define SNA_C_ul_SAILevelMemory 14
|
|
#define SNA_C_ul_TMPLevelMemory 15
|
|
|
|
/* From both, but should not be present in final release */
|
|
#ifndef RETAIL
|
|
#define SNA_C_ul_ScriptMemory 16
|
|
#endif
|
|
|
|
|
|
/* From game.dsc : level description */
|
|
#define SNA_C_ul_LevelNameTitle 30
|
|
#define SNA_C_ul_LevelName 31
|
|
|
|
/* From game.dsc and game.rnd: random description */
|
|
#define SNA_C_ul_RandomDescTitle 32
|
|
#define SNA_C_ul_RandomComputeTable 33
|
|
#define SNA_C_ul_RandomReadTable 34
|
|
|
|
/* From game.dsc : Directories description */
|
|
#define SNA_C_ul_DirectoryDescTitle 40
|
|
#define SNA_C_ul_DirectoryOfEngineDLL 41
|
|
#define SNA_C_ul_DirectoryOfGameData 42
|
|
#define SNA_C_ul_DirectoryOfTexts 43
|
|
#define SNA_C_ul_DirectoryOfWorld 44
|
|
#define SNA_C_ul_DirectoryOfLevels 45
|
|
#define SNA_C_ul_DirectoryOfFamilies 46
|
|
#define SNA_C_ul_DirectoryOfCharacters 47
|
|
#define SNA_C_ul_DirectoryOfAnimations 48
|
|
#define SNA_C_ul_DirectoryOfGraphicsClasses 49
|
|
#define SNA_C_ul_DirectoryOfGraphicsBanks 50
|
|
#define SNA_C_ul_DirectoryOfMechanics 51
|
|
#define SNA_C_ul_DirectoryOfSound 52
|
|
#define SNA_C_ul_DirectoryOfVisuals 53
|
|
#define SNA_C_ul_DirectoryOfEnvironment 54
|
|
#define SNA_C_ul_DirectoryOfMaterials 55
|
|
#define SNA_C_ul_DirectoryOfSaveGame 56
|
|
#define SNA_C_ul_DirectoryOfExtras 57
|
|
#define SNA_C_ul_DirectoryOfTexture 58
|
|
#define SNA_C_ul_DirectoryOfVignettes 59
|
|
#define SNA_C_ul_DirectoryOfOptions 60
|
|
#define SNA_C_ul_DirectoryOfLipsSync 61
|
|
#define SNA_C_ul_DirectoryOfZdx 62
|
|
#define SNA_C_ul_DirectoryOfEffects 63
|
|
|
|
/* From game.dsc : big file description */
|
|
#define SNA_C_ul_BigFileDescTitle 64
|
|
#define SNA_C_ul_BigFileVignettes 65
|
|
#define SNA_C_ul_BigFileTextures 66
|
|
|
|
/* From game.pbg & level.pbg : Vignette description */
|
|
#define SNA_C_ul_VignetteDescTitle 70
|
|
#define SNA_C_ul_LoadVignette 71
|
|
#define SNA_C_ul_LoadLevelVignette 72
|
|
#define SNA_C_ul_InitVignette 73
|
|
#define SNA_C_ul_FreeVignette 74
|
|
#define SNA_C_ul_DisplayVignette 75
|
|
#define SNA_C_ul_InitBarOutlineColor 76
|
|
#define SNA_C_ul_InitBarInsideColor 77
|
|
#define SNA_C_ul_InitBarColor 78
|
|
#define SNA_C_ul_CreateBar 79
|
|
#define SNA_C_ul_AddBar 80
|
|
#define SNA_C_ul_MaxValueBar 81
|
|
|
|
|
|
/* From level.dsc */
|
|
#define SNA_C_ul_LevelDscTitle 90
|
|
#define SNA_C_ul_NumberOfAlways 91
|
|
#define SNA_C_ul_LevelDscLevelSoundBanks 92
|
|
#define SNA_C_ul_LevelLoadMap 93
|
|
#define SNA_C_ul_LevelLoadSoundBank 94
|
|
|
|
/* From game.dsc : game options description */
|
|
#define SNA_C_ul_GameOptionDescTitle 100
|
|
#define SNA_C_ul_DefaultFile 101
|
|
#define SNA_C_ul_CurrentFile 102
|
|
#define SNA_C_ul_FrameSynchro 103
|
|
|
|
#ifdef USE_IPT_DX5
|
|
|
|
/* from game.dsc, input description */
|
|
#define SNA_C_ul_InitInputDeviceManager 110
|
|
|
|
/* from Device.ipt, active devices description */
|
|
#define SNA_C_ul_ActivateDeviceTitle 120
|
|
#define SNA_C_ul_ActivatePadAction 121
|
|
#define SNA_C_ul_ActivateJoystickAction 122
|
|
#define SNA_C_ul_ActivateKeyboardAction 123
|
|
#define SNA_C_ul_ActivateMouseAction 124
|
|
|
|
#endif /* USE_IPT_DX5 */
|
|
|
|
/* To say: "no more entries" */
|
|
#define SNA_C_ulEndOfDescSection 0xffff
|
|
|
|
|
|
|
|
/*
|
|
* public functions and macros
|
|
*/
|
|
|
|
/** - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
* Functions an macros for getting and setting
|
|
* Type of load and save and options
|
|
* These functions use as parameters or return following values :
|
|
* SNA_C_LoadScriptDsc (=0)
|
|
* SNA_C_LoadBinaryDsc (=1)
|
|
* SNA_C_SaveBinaryDsc (=2)
|
|
*/
|
|
extern CPA_EXPORT unsigned char SNA_fn_ucGetLoadDscType();
|
|
extern CPA_EXPORT void SNA_fn_vSetLoadDscType( unsigned char ucType );
|
|
|
|
|
|
/** - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
* Macros for testing save and load options
|
|
*/
|
|
|
|
#define SNA_M_bTestSaveGameDesc() \
|
|
( (SNA_fn_ucGetLoadDscType() == SNA_C_SaveBinaryDsc) \
|
|
&& (SNA_g_eFileCurrentlyOpened == SNA_C_GameDscFile) )
|
|
|
|
#define SNA_M_bTestSaveLevelDesc() \
|
|
( (SNA_fn_ucGetLoadDscType() == SNA_C_SaveBinaryDsc) \
|
|
&& (SNA_g_eFileCurrentlyOpened == SNA_C_LevelDscFile) )
|
|
|
|
/*
|
|
#define SNA_M_bTestSaveLevelMemDesc() SNA_M_bTestSaveLevelDesc()
|
|
|
|
#define SNA_M_bTestSaveGameMemDesc() SNA_M_bTestSaveGameDesc()
|
|
*/
|
|
|
|
#define SNA_M_bTestSaveGameMemDesc() \
|
|
( (SNA_fn_ucGetLoadDscType() == SNA_C_SaveBinaryDsc) \
|
|
&& (SNA_g_eFileCurrentlyOpened != SNA_C_NoDscFile) )
|
|
|
|
#define SNA_M_bTestSaveLevelMemDesc() SNA_M_bTestSaveGameMemDesc()
|
|
|
|
|
|
/** - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
* Macros for reading binarized dsc files
|
|
*/
|
|
|
|
#define SNA_M_BeginReadFromDscFile( eDscFileType ) \
|
|
{ \
|
|
SNA_fn_vOpenDscFileForReading( eDscFileType ); \
|
|
SNA_g_eFileCurrentlyOpened = eDscFileType; \
|
|
}
|
|
|
|
#define SNA_M_ReadSingleSectionFromDscFile() \
|
|
SNA_fn_vReadSectionFromDscFile( 1 )
|
|
|
|
#define SNA_M_ReadAllRemainingSectionsFromDscFile() \
|
|
SNA_fn_vReadSectionFromDscFile( 0xffff )
|
|
|
|
#define SNA_M_EndReadFromCurrentDscFile() \
|
|
{ \
|
|
SNA_fn_vCloseDscFile(); \
|
|
SNA_g_eFileCurrentlyOpened = SNA_C_NoDscFile; \
|
|
}
|
|
|
|
|
|
/** - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
* Functions for making binarized dsc files
|
|
*/
|
|
/*#ifndef RETAIL*/
|
|
|
|
#define SNA_M_BeginWriteToDscFile( eDscFileType ) \
|
|
{ \
|
|
SNA_fn_vOpenDscFileForWriting( eDscFileType ); \
|
|
SNA_g_eFileCurrentlyOpened = eDscFileType; \
|
|
}
|
|
|
|
#define SNA_M_EndWriteToCurrentDscFile() \
|
|
{ \
|
|
SNA_fn_vCloseDscFile(); \
|
|
SNA_g_eFileCurrentlyOpened = SNA_C_NoDscFile; \
|
|
}
|
|
|
|
/* Functions for writing entries to a file*/
|
|
extern CPA_EXPORT void SNA_fn_vWriteNoParamEntryToCurrentDscFile( unsigned long ulEntryType );
|
|
extern CPA_EXPORT void SNA_fn_vWriteLongEntryToCurrentDscFile( unsigned long ulEntryType, unsigned long ulEntryParam );
|
|
extern CPA_EXPORT void SNA_fn_vWriteStringEntryToCurrentDscFile( unsigned long ulEntryType, char *szEntryParam );
|
|
extern CPA_EXPORT void SNA_fn_vWrite2LongEntryToCurrentDscFile( unsigned long ulEntryType, unsigned long, unsigned long);
|
|
extern CPA_EXPORT void SNA_fn_vWrite3StringsEntryToCurrentDscFile( unsigned long , char *, char *,char *);
|
|
|
|
extern CPA_EXPORT void SNA_fn_vWriteBlockToCurrentDscFile( char *d_cData, unsigned long ulSize );
|
|
extern CPA_EXPORT void SNA_fn_vWriteLongToCurrentDscFile( unsigned long ulLong );
|
|
extern CPA_EXPORT void SNA_fn_vWriteDoubleToCurrentDscFile( double _dfNumber );
|
|
extern CPA_EXPORT void SNA_fn_vWriteStringToCurrentDscFile( char *szString );
|
|
|
|
extern CPA_EXPORT void SNA_fn_vWriteIntArrayEntryToCurrentDscFile( unsigned long ulEntryType, int iEntryParam0, int *p_iArray );
|
|
|
|
/*#endif // RETAIL */
|
|
|
|
/*
|
|
* Misc functions
|
|
* Usually used through macros
|
|
*/
|
|
extern CPA_EXPORT void SNA_fn_vOpenDscFileForReading( enum tdeDscFileType_ _eFile );
|
|
extern CPA_EXPORT void SNA_fn_vReadSectionFromDscFile( unsigned short _usNumberOfSection );
|
|
extern CPA_EXPORT void SNA_fn_vOpenDscFileForWriting( enum tdeDscFileType_ _eFile );
|
|
extern CPA_EXPORT void SNA_fn_vOpenDscFile( enum tdeDscFileType_ _eFile, char *_szMode );
|
|
extern CPA_EXPORT void SNA_fn_vCloseDscFile();
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}/* extern "C" */
|
|
#endif
|
|
|
|
#endif /* __SNANOSCR_H__*/
|