Ensure all weapon models are loaded on level load to prevent stutter on first opening of weapon wheel

This commit is contained in:
Petr Bartos 2022-04-14 21:41:01 +02:00
parent ea5e53f7e4
commit 44b0d0317f

View file

@ -1024,13 +1024,11 @@ static void CG_RegisterGraphics( void ) {
cgs.media.medalAssist = trap_R_RegisterShaderNoMip( "medal_assist" );
cgs.media.medalCapture = trap_R_RegisterShaderNoMip( "medal_capture" );
memset( cg_items, 0, sizeof( cg_items ) );
memset( cg_weapons, 0, sizeof( cg_weapons ) );
// only register the items that the server says we need
Q_strncpyz(items, CG_ConfigString(CS_ITEMS), sizeof(items));
for ( i = 1 ; i < bg_numItems ; i++ ) {
if ( items[ i ] == '1' || cg_buildScript.integer ) {
CG_LoadingItem( i );
@ -1038,6 +1036,14 @@ static void CG_RegisterGraphics( void ) {
}
}
// register all weapons (as they are used on weapon wheel selector)
for (int weaponId = 1; weaponId < WP_NUM_WEAPONS; ++weaponId) {
if (weaponId == WP_GRAPPLING_HOOK) {
continue;
}
CG_RegisterWeapon(weaponId);
}
// wall marks
cgs.media.bulletMarkShader = trap_R_RegisterShader( "gfx/damage/bullet_mrk" );
cgs.media.burnMarkShader = trap_R_RegisterShader( "gfx/damage/burn_med_mrk" );