diff options
author | Michael Levin <risujin@fastmail.fm> | 2009-10-03 11:21:01 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:14:54 +0000 |
commit | ce4dfd02633cfb1fa82b603f3d7af1a89a0fcb97 (patch) | |
tree | 103e783cd11e6bbdb0a77b9b6d7532b9f5820362 /src/ui/ui_main.c | |
parent | 8a36ffb80b9ee398a6b21f6e1f937f2527ae9cce (diff) |
* Started updating infopanes with Badger, need to do more
* Fixed a bug where regular Basilisk would not heal faster by a booster sometimes (found thanks to new GUI indicator!)
* Un-reverted Lucifer Cannon sound heard by others, with Norf's blessing
* Added a Help menu listing mod changes and other stuff (ESC -> Help), edit ui/help.txt
* Human HUD item list will now wrap around so that it never hides items, also made it a little wider
GUI cross changes:
* Human GUI health cross glows when medkit is active
* Alien GUI health cross glows when on creep
* Double, triple healing rates show as multiple crosses
Diffstat (limited to 'src/ui/ui_main.c')
-rw-r--r-- | src/ui/ui_main.c | 79 |
1 files changed, 77 insertions, 2 deletions
diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c index 23005600..3a7e6d7e 100644 --- a/src/ui/ui_main.c +++ b/src/ui/ui_main.c @@ -1376,7 +1376,7 @@ void UI_LoadMenus( const char *menuFile, qboolean reset ) handle = trap_Parse_LoadSource( menuFile ); if( !handle ) - trap_Error( va( S_COLOR_RED "default menu file not found: ui/menus.txt, unable to continue!\n" ) ); + trap_Error( va( S_COLOR_RED "menu list '%s' not found, unable to continue!\n", menuFile ) ); if( reset ) Menu_Reset(); @@ -1401,11 +1401,70 @@ void UI_LoadMenus( const char *menuFile, qboolean reset ) } } - Com_Printf( "UI menu load time = %d milli seconds\n", trap_Milliseconds() - start ); + Com_Printf( "UI menu file '%s' loaded in %d msec\n", menuFile, trap_Milliseconds() - start ); trap_Parse_FreeSource( handle ); } +void UI_LoadHelp( const char *helpFile ) +{ + pc_token_t token; + int handle, start; + char title[ 32 ], buffer[ 1024 ]; + + start = trap_Milliseconds(); + + handle = trap_Parse_LoadSource( helpFile ); + if( !handle ) + { + Com_Printf( S_COLOR_YELLOW "WARNING: help file '%s' not found!\n", + helpFile ); + return; + } + + if( !trap_Parse_ReadToken( handle, &token ) || + token.string[0] == 0 || token.string[0] != '{' ) + { + Com_Printf( S_COLOR_YELLOW "WARNING: help file '%s' does not start with " + "'{'\n", helpFile ); + return; + } + + uiInfo.helpCount = 0; + title[ 0 ] = 0; + while( 1 ) + { + if( !trap_Parse_ReadToken( handle, &token ) || + token.string[0] == 0 || token.string[0] == '}' ) + break; + + if( token.string[0] == '{' ) + { + buffer[ 0 ] = 0; + Q_strcat( buffer, sizeof( buffer ), title ); + Q_strcat( buffer, sizeof( buffer ), "\n\n" ); + while( trap_Parse_ReadToken( handle, &token ) && + token.string[0] != 0 && token.string[0] != '}' ) + { + Q_strcat( buffer, sizeof( buffer ), token.string ); + } + + uiInfo.helpList[ uiInfo.helpCount ].text = String_Alloc( title ); + uiInfo.helpList[ uiInfo.helpCount ].v.text = String_Alloc( buffer ); + uiInfo.helpList[ uiInfo.helpCount ].type = INFOTYPE_TEXT; + uiInfo.helpCount++; + title[ 0 ] = 0; + } + else + Q_strcat( title, sizeof( title ), token.string ); + } + + trap_Parse_FreeSource( handle ); + + Com_Printf( "UI help file '%s' loaded in %d msec (%d infopanes)\n", + helpFile, trap_Milliseconds() - start, uiInfo.helpCount ); +} + void UI_Load( void ) { char lastName[1024]; @@ -1419,6 +1478,7 @@ void UI_Load( void ) UI_LoadMenus( "ui/menus.txt", qtrue ); UI_LoadMenus( "ui/ingame.txt", qfalse ); UI_LoadMenus( "ui/tremulous.txt", qfalse ); + UI_LoadHelp( "ui/help.txt" ); Menus_CloseAll( qtrue ); Menus_ActivateByName( lastName ); @@ -1850,6 +1910,11 @@ static void UI_OwnerDraw( float x, float y, float w, float h, &rect, text_x, text_y, scale, textalign, textvalign, color, textStyle ); break; + case UI_HELPINFOPANE: + UI_DrawInfoPane( &uiInfo.helpList[ uiInfo.helpIndex ], + &rect, text_x, text_y, scale, textalign, textvalign, color, textStyle ); + break; + case UI_NETMAPPREVIEW: UI_DrawServerMapPreview( &rect, scale, color ); break; @@ -3270,6 +3335,8 @@ static int UI_FeederCount( float feederID ) } else if( feederID == FEEDER_IGNORE_LIST ) return uiInfo.playerCount; + else if( feederID == FEEDER_HELP_LIST ) + return uiInfo.helpCount; else if( feederID == FEEDER_MODS ) return uiInfo.modCount; else if( feederID == FEEDER_DEMOS ) @@ -3443,6 +3510,11 @@ static const char *UI_FeederItemText( float feederID, int index, int column, qha } } } + else if( feederID == FEEDER_HELP_LIST ) + { + if( index >= 0 && index < uiInfo.helpCount ) + return uiInfo.helpList[ index ].text; + } else if( feederID == FEEDER_MODS ) { if( index >= 0 && index < uiInfo.modCount ) @@ -3598,6 +3670,8 @@ static void UI_FeederSelection( float feederID, int index ) uiInfo.teamPlayerIndex = index; else if( feederID == FEEDER_IGNORE_LIST ) uiInfo.ignoreIndex = index; + else if( feederID == FEEDER_HELP_LIST ) + uiInfo.helpIndex = index; else if( feederID == FEEDER_MODS ) uiInfo.modIndex = index; else if( feederID == FEEDER_CINEMATICS ) @@ -3775,6 +3849,7 @@ void UI_Init( qboolean inGameLoad ) UI_LoadMenus( "ui/menus.txt", qtrue ); UI_LoadMenus( "ui/ingame.txt", qfalse ); UI_LoadMenus( "ui/tremulous.txt", qfalse ); + UI_LoadHelp( "ui/help.txt" ); Menus_CloseAll( qtrue ); |