From 44b0d0317fd6b322b6fbeb6e8e466f4fff7c8664 Mon Sep 17 00:00:00 2001 From: Petr Bartos Date: Thu, 14 Apr 2022 21:41:01 +0200 Subject: [PATCH] Ensure all weapon models are loaded on level load to prevent stutter on first opening of weapon wheel --- android/app/src/main/cpp/code/cgame/cg_main.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/android/app/src/main/cpp/code/cgame/cg_main.c b/android/app/src/main/cpp/code/cgame/cg_main.c index 846aae84..b0a82758 100644 --- a/android/app/src/main/cpp/code/cgame/cg_main.c +++ b/android/app/src/main/cpp/code/cgame/cg_main.c @@ -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" );