Add ability to change materials.txt and sentences.txt paths

This commit is contained in:
mittorn 2017-01-15 15:03:19 +02:00
parent c8084e8428
commit dd1fd1c5da
4 changed files with 22 additions and 4 deletions

View File

@ -60,6 +60,9 @@ cvar_t mp_unduck = { "mp_unduck", "0", FCVAR_SERVER };
cvar_t mp_semclip = { "mp_semclip", "0", FCVAR_SERVER };
cvar_t mp_spectator = { "mp_spectator", "0", FCVAR_SERVER };
cvar_t materials_txt = { "materials_txt", "sound/materials.txt", FCVAR_SERVER };
cvar_t sentences_txt = { "sentences_txt", "sound/sentences.txt", FCVAR_SERVER };
// Engine Cvars
cvar_t *g_psv_gravity = NULL;
cvar_t *g_psv_aim = NULL;
@ -511,6 +514,9 @@ void GameDLLInit( void )
CVAR_REGISTER( &mp_coop_noangry );
CVAR_REGISTER( &mp_spectator );
CVAR_REGISTER( &sentences_txt );
CVAR_REGISTER( &materials_txt );
CVAR_REGISTER( &mp_chattime );

View File

@ -58,6 +58,9 @@ extern cvar_t mp_coop_reconnect_hack;
extern cvar_t mp_coop_noangry;
extern cvar_t mp_spectator;
extern cvar_t sentences_txt;
extern cvar_t materials_txt;
extern bool g_fSavedDuck;
extern bool g_fPause;

View File

@ -23,6 +23,7 @@
#include "player.h"
#include "talkmonster.h"
#include "gamerules.h"
#include "game.h"
static char *memfgets( byte *pMemFile, int fileSize, int &filePos, char *pBuffer, int bufferSize );
@ -1264,7 +1265,7 @@ void SENTENCEG_Init()
isentencegs = -1;
int filePos = 0, fileSize;
byte *pMemFile = g_engfuncs.pfnLoadFileForMe( "sound/sentences.txt", &fileSize );
byte *pMemFile = g_engfuncs.pfnLoadFileForMe( sentences_txt.string, &fileSize );
if( !pMemFile )
return;
@ -1528,7 +1529,7 @@ void TEXTURETYPE_Init()
gcTextures = 0;
pMemFile = g_engfuncs.pfnLoadFileForMe( "sound/materials.txt", &fileSize );
pMemFile = g_engfuncs.pfnLoadFileForMe( materials_txt.string, &fileSize );
if( !pMemFile )
return;

View File

@ -122,6 +122,14 @@ static char grgchTextureType[CTEXTURESMAX];
int g_onladder = 0;
#ifdef CLIENT_DLL
#define materials_path "sound/materials.txt"
#else
#include "cvardef.h"
extern cvar_t materials_txt;
#define materials_path materials_txt.string
#endif
void PM_SwapTextures( int i, int j )
{
char chTemp;
@ -173,8 +181,8 @@ void PM_InitTextureTypes()
gcTextures = 0;
fileSize = pmove->COM_FileSize( "sound/materials.txt" );
pMemFile = pmove->COM_LoadFile( "sound/materials.txt", 5, NULL );
fileSize = pmove->COM_FileSize( materials_path );
pMemFile = pmove->COM_LoadFile( materials_path, 5, NULL );
if( !pMemFile )
return;