Browse Source

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

gravgun
mittorn 8 years ago
parent
commit
dd1fd1c5da
  1. 6
      dlls/game.cpp
  2. 3
      dlls/game.h
  3. 5
      dlls/sound.cpp
  4. 12
      pm_shared/pm_shared.c

6
dlls/game.cpp

@ -60,6 +60,9 @@ cvar_t mp_unduck = { "mp_unduck", "0", FCVAR_SERVER }; @@ -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 ) @@ -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 );

3
dlls/game.h

@ -58,6 +58,9 @@ extern cvar_t mp_coop_reconnect_hack; @@ -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;

5
dlls/sound.cpp

@ -23,6 +23,7 @@ @@ -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() @@ -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() @@ -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;

12
pm_shared/pm_shared.c

@ -122,6 +122,14 @@ static char grgchTextureType[CTEXTURESMAX]; @@ -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() @@ -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;

Loading…
Cancel
Save