From 4b05a8fcb7f873e41e777d6f77f80656ac1f44cc Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Thu, 9 Dec 2010 22:50:08 +0000 Subject: * Turns out CG_GetBindings is actually quite expensive --- src/cgame/cg_tutorial.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/cgame/cg_tutorial.c b/src/cgame/cg_tutorial.c index 1bc4ac8f..c3069a1e 100644 --- a/src/cgame/cg_tutorial.c +++ b/src/cgame/cg_tutorial.c @@ -599,8 +599,10 @@ static void CG_SpectatorText( char *text, playerState_t *ps ) Q_strcat( text, MAX_TUTORIAL_TEXT, va( "Press %s to follow a player\n", CG_KeyNameForCommand( "+button2" ) ) ); - } } +} + +#define BINDING_REFRESH_INTERVAL 30 /* =============== @@ -613,8 +615,12 @@ const char *CG_TutorialText( void ) { playerState_t *ps; static char text[ MAX_TUTORIAL_TEXT ]; + static int refreshBindings = 0; + + if( refreshBindings == 0 ) + CG_GetBindings( ); - CG_GetBindings( ); + refreshBindings = ( refreshBindings + 1 ) % BINDING_REFRESH_INTERVAL; text[ 0 ] = '\0'; ps = &cg.snap->ps; -- cgit