summaryrefslogtreecommitdiff
path: root/src/cgame
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2010-12-09 22:50:08 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:17:48 +0000
commit4b05a8fcb7f873e41e777d6f77f80656ac1f44cc (patch)
treeb44e88ab18350035d4eb98e376f94d80ccb04013 /src/cgame
parent00fde68d4e97fdebd62e9ce60c6c856e4e375111 (diff)
* Turns out CG_GetBindings is actually quite expensive
Diffstat (limited to 'src/cgame')
-rw-r--r--src/cgame/cg_tutorial.c10
1 files changed, 8 insertions, 2 deletions
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;