engine: allow to change hardcoded path to custom.hpk

This commit is contained in:
Alibek Omarov
2024-06-15 17:22:26 +03:00
parent 1b36785177
commit 95b48da37d
12 changed files with 25 additions and 25 deletions
-3
View File
@@ -39,9 +39,6 @@ GNU General Public License for more details.
// end game final default message
#define DEFAULT_ENDGAME_MESSAGE "The End"
// path to the hash-pak that contain custom player decals
#define CUSTOM_RES_PATH "custom.hpk"
// path to default playermodel in GoldSrc
#define DEFAULT_PLAYER_PATH_HALFLIFE "models/player.mdl"
+1
View File
@@ -164,6 +164,7 @@ extern convar_t host_maxfps;
extern convar_t sys_timescale;
extern convar_t cl_filterstuffcmd;
extern convar_t rcon_password;
extern convar_t hpk_custom_file;
#define Mod_AllowMaterials() ( host_allow_materials.value != 0.0f && !FBitSet( host.features, ENGINE_DISABLE_HDTEXTURES ))
+1 -1
View File
@@ -94,7 +94,7 @@ qboolean COM_CreateCustomization( customization_t *pListHead, resource_t *pResou
if( FBitSet( flags, FCUST_FROMHPAK ))
{
if( !HPAK_GetDataPointer( CUSTOM_RES_PATH, pResource, (byte **)&pCust->pBuffer, NULL ))
if( !HPAK_GetDataPointer( hpk_custom_file.string, pResource, (byte **)&pCust->pBuffer, NULL ))
bError = true;
}
else
+3 -3
View File
@@ -1197,9 +1197,6 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa
}
else Cmd_AddRestrictedCommand( "minimize", Host_Minimize_f, "minimize main window to tray" );
HPAK_CheckIntegrity( CUSTOM_RES_PATH );
host.errorframe = 0;
if( progname[0] == '#' )
@@ -1264,6 +1261,9 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa
Cbuf_Execute();
}
// check after all configs were executed
HPAK_CheckIntegrity( hpk_custom_file.string );
// main window message loop
while( !host.crashed )
{
+2
View File
@@ -28,6 +28,7 @@ typedef struct hash_pack_queue_s
} hash_pack_queue_t;
static CVAR_DEFINE( hpk_maxsize, "hpk_max_size", "64", FCVAR_ARCHIVE|FCVAR_PRIVILEGED, "set limit by size for all HPK-files in megabytes ( 0 - unlimited )" );
CVAR_DEFINE_AUTO( hpk_custom_file, "custom.hpk", FCVAR_ARCHIVE|FCVAR_PRIVILEGED, "set custom path for players customizations cache file" );
static hash_pack_queue_t *gp_hpak_queue = NULL;
static hpak_header_t hash_pack_header;
static hpak_info_t hash_pack_info;
@@ -1106,6 +1107,7 @@ void HPAK_Init( void )
Cmd_AddRestrictedCommand( "hpkextract", HPAK_Extract_f, "extract all lumps from specified HPK-file" );
Cmd_AddRestrictedCommand( "hpk_maxsize", HPAK_MaxSize_f, "deprecation notice for hpk_maxsize" );
Cvar_RegisterVariable( &hpk_maxsize );
Cvar_RegisterVariable( &hpk_custom_file );
gp_hpak_queue = NULL;
}