Пример #1
0
/*
======================
CG_LoadingString

======================
*/
void CG_LoadingString( const char *s ) {
	Q_strncpyz( cg.infoScreenText, s, sizeof( cg.infoScreenText ) );

	if ( s && s[0] != 0 ) {
		CG_Printf( va( "LOADING... %s\n",s ) );   //----(SA)	added so you can see from the console what's going on

	}
	trap_UpdateScreen();
}
Пример #2
0
/*
======================
CG_LoadingString

======================
*/
void CG_LoadingString( const char *s ) {
#ifdef _XBOX
	if (ClientManager::ActiveClientNum() == 1)
		return;
#endif

	Q_strncpyz( cg->infoScreenText, s, sizeof( cg->infoScreenText ) );

	trap_UpdateScreen();
}
Пример #3
0
/*
======================
CG_LoadingString

======================
*/
void CG_LoadingString( const char *s ) {
	const char *psLoading = CG_GetStringEdString("MENUS", "LOADING_MAPNAME");

	Q_strncpyz( cg.infoScreenText, s, sizeof( cg.infoScreenText ) );

	if(s && *s) {
		CG_Printf(va((char *)psLoading, (char *)s));
		CG_Printf("\n");
	}

	trap_UpdateScreen();
}
/*
===============
CG_InitBuildables

Initialises the animation db
===============
*/
void CG_InitBuildables( void )
{
  char          filename[ MAX_QPATH ];
  char          soundfile[ MAX_QPATH ];
  char          *buildableName;
  char          *modelFile;
  int           i;
  int           j;
  fileHandle_t  f;

  memset( cg_buildables, 0, sizeof( cg_buildables ) );

  //default sounds
  for( j = BANIM_NONE + 1; j < MAX_BUILDABLE_ANIMATIONS; j++ )
  {
    strcpy( soundfile, cg_buildableSoundNames[ j - 1 ] );

    Com_sprintf( filename, sizeof( filename ), "sound/buildables/alien/%s", soundfile );
    defaultAlienSounds[ j ] = trap_S_RegisterSound( filename, qfalse );

    Com_sprintf( filename, sizeof( filename ), "sound/buildables/human/%s", soundfile );
    defaultHumanSounds[ j ] = trap_S_RegisterSound( filename, qfalse );
  }

  cg.buildablesFraction = 0.0f;

  for( i = BA_NONE + 1; i < BA_NUM_BUILDABLES; i++ )
  {
    buildableName = BG_FindNameForBuildable( i );

    //animation.cfg
    Com_sprintf( filename, sizeof( filename ), "models/buildables/%s/animation.cfg", buildableName );
    if ( !CG_ParseBuildableAnimationFile( filename, i ) )
      Com_Printf( S_COLOR_YELLOW "WARNING: failed to load animation file %s\n", filename );

    //sound.cfg
    Com_sprintf( filename, sizeof( filename ), "sound/buildables/%s/sound.cfg", buildableName );
    if ( !CG_ParseBuildableSoundFile( filename, i ) )
      Com_Printf( S_COLOR_YELLOW "WARNING: failed to load sound file %s\n", filename );

    //models
    for( j = 0; j <= 3; j++ )
    {
      if( ( modelFile = BG_FindModelsForBuildable( i, j ) ) )
        cg_buildables[ i ].models[ j ] = trap_R_RegisterModel( modelFile );
    }

    //sounds
    for( j = BANIM_NONE + 1; j < MAX_BUILDABLE_ANIMATIONS; j++ )
    {
      strcpy( soundfile, cg_buildableSoundNames[ j - 1 ] );
      Com_sprintf( filename, sizeof( filename ), "sound/buildables/%s/%s", buildableName, soundfile );

      if( cg_buildables[ i ].sounds[ j ].enabled )
      {
        if( trap_FS_FOpenFile( filename, &f, FS_READ ) > 0 )
        {
          //file exists so close it
          trap_FS_FCloseFile( f );

          cg_buildables[ i ].sounds[ j ].sound = trap_S_RegisterSound( filename, qfalse );
        }
        else
        {
          //file doesn't exist - use default
          if( BG_FindTeamForBuildable( i ) == BIT_ALIENS )
            cg_buildables[ i ].sounds[ j ].sound = defaultAlienSounds[ j ];
          else
            cg_buildables[ i ].sounds[ j ].sound = defaultHumanSounds[ j ];
        }
      }
    }

    cg.buildablesFraction = (float)i / (float)( BA_NUM_BUILDABLES - 1 );
    trap_UpdateScreen( );
  }

  cgs.media.teslaZapTS = CG_RegisterTrailSystem( "models/buildables/tesla/zap" );
}
Пример #5
0
/*
======================
CG_LoadingString

======================
*/
void CG_LoadingString(const char *s)
{
    Q_strncpyz(cg.infoScreenText, s, sizeof(cg.infoScreenText));

    trap_UpdateScreen();
}
Пример #6
0
void UI_UpdateScreen( void ) {
    trap_UpdateScreen();
}
Пример #7
0
/*
====================
CG_DrawInformation

Draw all the status / pacifier stuff during level loading
====================
*/
void CG_DrawInformation( void ) {
	const char  *s;
	const char  *info;
	const char  *sysInfo;
	int y;
	int value;
	qhandle_t levelshot = 0; // TTimo: init
//	qhandle_t	detail;
	char buf[1024];
	static int lastDraw = 0;  // Ridah, so we don't draw the screen more often than we need to
	int ms;
	static int callCount = 0;
	float percentDone;

	int expectedHunk;
	char hunkBuf[MAX_QPATH];

	vec4_t color;

	if ( cg.snap && ( strlen( cg_missionStats.string ) <= 1 ) ) {
		return;     // we are in the world, no need to draw information
	}

	if ( callCount ) {    // reject recursive calls
		return;
	}

	ms = trap_Milliseconds();
	if ( ( lastDraw <= ms ) && ( lastDraw > ms - 100 ) ) {
		return;
	}
	lastDraw = ms;

	callCount++;

	info = CG_ConfigString( CS_SERVERINFO );
	sysInfo = CG_ConfigString( CS_SYSTEMINFO );

	trap_Cvar_VariableStringBuffer( "com_expectedhunkusage", hunkBuf, MAX_QPATH );
	expectedHunk = atoi( hunkBuf );


	s = Info_ValueForKey( info, "mapname" );
	if ( s && s[0] != 0 ) {  // there is often no 's'
		if ( strlen( cg_missionStats.string ) > 1 && cg_missionStats.string[0] == 's' ) {
			levelshot = trap_R_RegisterShaderNoMip( va( "levelshots/pre_%s_stats.tga", s ) );
		} else {    // show briefing screen
			if ( s && s[0] != 0 ) {  // there is often no 's'
				levelshot = trap_R_RegisterShaderNoMip( va( "levelshots/%s.tga", s ) );
			}
		}
	}
	if ( !levelshot ) {
		levelshot = trap_R_RegisterShaderNoMip( "menu/art/unknownmap" );
	}
	trap_R_SetColor( NULL );
	CG_DrawPic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, levelshot );

	// blend a detail texture over it
	//detail = trap_R_RegisterShader( "levelShotDetail" );
	//trap_R_DrawStretchPic( 0, 0, cgs.glconfig.vidWidth, cgs.glconfig.vidHeight, 0, 0, 2.5, 2, detail );


// (SA) commented out for Drew
//	UI_DrawProportionalString( 320, 16, va( "Loading %s", Info_ValueForKey( info, "mapname" ) ), UI_SMALLFONT|UI_CENTER|UI_DROPSHADOW, colorWhite );

	// show the loading progress
	VectorSet( color, 0.8, 0.8, 0.8 );
	color[3] = 0.8;

	if ( strlen( cg_missionStats.string ) > 1 && cg_missionStats.string[0] == 's' ) {
		vec2_t xy = { 190, 470 };
		vec2_t wh = { 260, 10 };

		// draw the mission stats while loading
		if ( !Q_strncmp( cg_missionStats.string, "s=", 2 ) ) {
			CG_DrawStats( cg_missionStats.string + 2 );
		}

		if ( cg_waitForFire.integer == 1 ) {
			// waiting for server to finish loading the map
			UI_DrawProportionalString( 320, xy[1] + wh[1] - 10, "press fire to continue",
									   UI_CENTER | UI_EXSMALLFONT | UI_DROPSHADOW, color );
		} else if ( expectedHunk > 0 ) {
			percentDone = (float)( cg_hunkUsed.integer + cg_soundAdjust.integer ) / (float)( expectedHunk );
			if ( percentDone > 0.97 ) { // never actually show 100%, since we are not in the game yet
				percentDone = 0.97;
			}
			CG_HorizontalPercentBar( xy[0] + 10, xy[1] + wh[1] - 10, wh[0] - 20, 10, percentDone );
		} else if ( expectedHunk == -2 ) {
			// we're ready, press a key to start playing
			if ( ( ms % 1000 ) < 700 ) {  // flashing to get our attention
				UI_DrawProportionalString( 320, xy[1] + wh[1] - 10, "press fire to begin",
										   UI_CENTER | UI_EXSMALLFONT | UI_DROPSHADOW, color );
			}
		} else {
			UI_DrawProportionalString( 320, xy[1] + wh[1] - 10, "please wait",
									   UI_CENTER | UI_EXSMALLFONT | UI_DROPSHADOW, color );
		}

		trap_UpdateScreen();
		callCount--;
		return;
	}

	// Ridah, in single player, cheats disabled, don't show unnecessary information
	// DHM - Nerve :: maybe temp, but we want to display the same as single player right now
	if ( cgs.gametype == GT_SINGLE_PLAYER || cgs.gametype >= GT_WOLF ) {
		vec2_t xy = { 200, 468 };
		vec2_t wh = { 240, 10 };

		// show the server motd
		CG_DrawMotd();

		// show the percent complete bar
		if ( expectedHunk > 0 ) {
			percentDone = (float)( cg_hunkUsed.integer + cg_soundAdjust.integer ) / (float)( expectedHunk );
			if ( percentDone > 0.97 ) {
				percentDone = 0.97;
			}
			CG_HorizontalPercentBar( xy[0], xy[1], wh[0], wh[1], percentDone );
		} else if ( expectedHunk == -2 ) {
			// we're ready, press a key to start playing
			if ( ( ms % 1000 ) < 700 ) {  // flashing to get our attention
				UI_DrawProportionalString( 320, xy[1] - 2, "press fire to begin",
										   UI_CENTER | UI_EXSMALLFONT | UI_DROPSHADOW, color );
			}
		}

		trap_UpdateScreen();
		callCount--;
		return;
	}
	// done.

	// draw the icons of thiings as they are loaded
	CG_DrawLoadingIcons();

	// the first 150 rows are reserved for the client connection
	// screen to write into
	if ( cg.infoScreenText[0] ) {
		UI_DrawProportionalString( 320, 128, va( "Loading... %s", cg.infoScreenText ),
								   UI_CENTER | UI_SMALLFONT | UI_DROPSHADOW, colorWhite );
	} else {
		UI_DrawProportionalString( 320, 128, "Awaiting snapshot...",
								   UI_CENTER | UI_SMALLFONT | UI_DROPSHADOW, colorWhite );
	}

	// draw info string information
	y = 180;

	// don't print server lines if playing a local game
	trap_Cvar_VariableStringBuffer( "sv_running", buf, sizeof( buf ) );
	if ( !atoi( buf ) ) {
		// server hostname
		s = Info_ValueForKey( info, "sv_hostname" );
		UI_DrawProportionalString( 320, y, s,
								   UI_CENTER | UI_SMALLFONT | UI_DROPSHADOW, colorWhite );
		y += PROP_HEIGHT;

		// server-specific message of the day
		s = CG_ConfigString( CS_MOTD );
		if ( s[0] ) {
			UI_DrawProportionalString( 320, y, s,
									   UI_CENTER | UI_SMALLFONT | UI_DROPSHADOW, colorWhite );
			y += PROP_HEIGHT;
		}

		// some extra space after hostname and motd
		y += 10;
	}

	// map-specific message (long map name)
	s = CG_ConfigString( CS_MESSAGE );
	if ( s[0] ) {
		UI_DrawProportionalString( 320, y, s,
								   UI_CENTER | UI_SMALLFONT | UI_DROPSHADOW, colorWhite );
		y += PROP_HEIGHT;
	}

	// cheats warning
	s = Info_ValueForKey( sysInfo, "sv_cheats" );
	if ( s[0] == '1' ) {
		UI_DrawProportionalString( 320, y, "CHEATS ARE ENABLED",
								   UI_CENTER | UI_SMALLFONT | UI_DROPSHADOW, colorWhite );
		y += PROP_HEIGHT;
	}

	// game type
	switch ( cgs.gametype ) {
	case GT_FFA:
		s = "Free For All";
		break;
	case GT_SINGLE_PLAYER:
		s = "Single Player";
		break;
	case GT_TOURNAMENT:
		s = "Tournament";
		break;
	case GT_TEAM:
		s = "Team Deathmatch";
		break;
	case GT_CTF:
		s = "Capture The Flag";
		break;
		// JPW NERVE
	case GT_WOLF:
		s = "Wolfenstein Multiplayer";
		break;
		// jpw
		// NERVE - SMF
	case GT_WOLF_STOPWATCH:
		s = "WolfMP Stopwatch";
		break;
	case GT_WOLF_CP:
		s = "WolfMP Checkpoint";
		break;
		// -NERVE - SMF
		// JPW NERVE
	case GT_WOLF_CPH:
		s = "WolfMP Capture & Hold";
		break;
		// jpw
	default:
		s = "Unknown Gametype";
		break;
	}
	UI_DrawProportionalString( 320, y, s,
							   UI_CENTER | UI_SMALLFONT | UI_DROPSHADOW, colorWhite );
	y += PROP_HEIGHT;

	value = atoi( Info_ValueForKey( info, "timelimit" ) );
	if ( value ) {
		UI_DrawProportionalString( 320, y, va( "timelimit %i", value ),
								   UI_CENTER | UI_SMALLFONT | UI_DROPSHADOW, colorWhite );
		y += PROP_HEIGHT;
	}

	if ( cgs.gametype != GT_CTF && cgs.gametype != GT_SINGLE_PLAYER ) {
		value = atoi( Info_ValueForKey( info, "fraglimit" ) );
		if ( value ) {
			UI_DrawProportionalString( 320, y, va( "fraglimit %i", value ),
									   UI_CENTER | UI_SMALLFONT | UI_DROPSHADOW, colorWhite );
			y += PROP_HEIGHT;
		}
	}

	if ( cgs.gametype == GT_CTF ) {
		value = atoi( Info_ValueForKey( info, "capturelimit" ) );
		if ( value ) {
			UI_DrawProportionalString( 320, y, va( "capturelimit %i", value ),
									   UI_CENTER | UI_SMALLFONT | UI_DROPSHADOW, colorWhite );
			y += PROP_HEIGHT;
		}
	}

	callCount--;
}
Пример #8
0
/*
====================
Console_Key

Handles history and console scrollback
====================
*/
void Console_Key ( int key, qboolean down ) {

	if ( !down ) {
		return;
	}

	if ( key & K_CHAR_FLAG ) {
		key &= ~K_CHAR_FLAG;
		MField_CharEvent( &g_consoleField, key );
		return;
	}

	// ctrl-L clears screen
	if ( key == 'l' && trap_Key_IsDown( K_CTRL ) ) {
		trap_Cmd_ExecuteText( EXEC_APPEND, "clear\n" );
		return;
	}

	// enter finishes the line
	if ( key == K_ENTER || key == K_KP_ENTER ) {
		uiClientState_t cls;

		trap_GetClientState( &cls );

		// if not in the game explicitly prepend a slash if needed
		if ( cls.connState != CA_ACTIVE && con_autochat.integer &&
				g_consoleField.buffer[0] &&
				g_consoleField.buffer[0] != '\\' &&
				g_consoleField.buffer[0] != '/' ) {
			char	temp[MAX_EDIT_LINE-1];

			Q_strncpyz( temp, g_consoleField.buffer, sizeof( temp ) );
			Com_sprintf( g_consoleField.buffer, sizeof( g_consoleField.buffer ), "\\%s", temp );
			g_consoleField.cursor++;
		}

		Com_Printf ( "]%s\n", g_consoleField.buffer );

		// leading slash is an explicit command
		if ( g_consoleField.buffer[0] == '\\' || g_consoleField.buffer[0] == '/' ) {
			trap_Cmd_ExecuteText( EXEC_APPEND, g_consoleField.buffer+1 );	// valid command
			trap_Cmd_ExecuteText( EXEC_APPEND, "\n" );
		} else {
			// other text will be chat messages
			if ( !g_consoleField.buffer[0] ) {
				return;	// empty lines just scroll the console without adding to history
			} else {
				if ( con_autochat.integer ) {
					trap_Cmd_ExecuteText( EXEC_APPEND, "cmd say " );
				}
				trap_Cmd_ExecuteText( EXEC_APPEND, g_consoleField.buffer );
				trap_Cmd_ExecuteText( EXEC_APPEND, "\n" );
			}
		}

		// copy line to history buffer
		historyEditLines[nextHistoryLine % COMMAND_HISTORY] = g_consoleField;
		nextHistoryLine++;
		historyLine = nextHistoryLine;

		MField_Clear( &g_consoleField );

		g_consoleField.widthInChars = g_console_field_width;

		CG_SaveConsoleHistory( );

		if ( cls.connState == CA_DISCONNECTED ) {
			trap_UpdateScreen();	// force an update, because the command
		}							// may take some time
		return;
	}

	// command completion

	if (key == K_TAB) {
		char newbuf[MAX_EDIT_LINE];

		trap_Cmd_AutoComplete( g_consoleField.buffer, newbuf, sizeof ( newbuf ) );

		if ( strcmp( newbuf, g_consoleField.buffer ) != 0 ) {
			Q_strncpyz( g_consoleField.buffer, newbuf, sizeof ( g_consoleField.buffer ) );
			g_consoleField.cursor = strlen( g_consoleField.buffer );
		}
		return;
	}

	// command history (ctrl-p ctrl-n for unix style)

	if ( ( key == K_MWHEELUP && trap_Key_IsDown( K_SHIFT ) ) || ( key == K_UPARROW ) || ( key == K_KP_UPARROW ) ||
		 ( ( tolower(key) == 'p' ) && trap_Key_IsDown( K_CTRL ) ) ) {
		if ( nextHistoryLine - historyLine < COMMAND_HISTORY 
			&& historyLine > 0 ) {
			historyLine--;
		}
		g_consoleField = historyEditLines[ historyLine % COMMAND_HISTORY ];
		return;
	}

	if ( ( key == K_MWHEELDOWN && trap_Key_IsDown( K_SHIFT ) ) || ( key == K_DOWNARROW ) || ( key == K_KP_DOWNARROW ) ||
		 ( ( tolower(key) == 'n' ) && trap_Key_IsDown( K_CTRL ) ) ) {
		historyLine++;
		if (historyLine >= nextHistoryLine) {
			historyLine = nextHistoryLine;
			MField_Clear( &g_consoleField );
			g_consoleField.widthInChars = g_console_field_width;
			return;
		}
		g_consoleField = historyEditLines[ historyLine % COMMAND_HISTORY ];
		return;
	}

	// console scrolling
	if ( key == K_PGUP || key == K_KP_PGUP ) {
		Con_PageUp();
		return;
	}

	if ( key == K_PGDN || key == K_KP_PGDN ) {
		Con_PageDown();
		return;
	}

	if ( key == K_MWHEELUP) {	//----(SA)	added some mousewheel functionality to the console
		Con_PageUp();
		if ( trap_Key_IsDown( K_CTRL ) ) {	// hold <ctrl> to accelerate scrolling
			Con_PageUp();
			Con_PageUp();
		}
		return;
	}

	if ( key == K_MWHEELDOWN) {	//----(SA)	added some mousewheel functionality to the console
		Con_PageDown();
		if ( trap_Key_IsDown( K_CTRL ) ) {	// hold <ctrl> to accelerate scrolling
			Con_PageDown();
			Con_PageDown();
		}
		return;
	}

	// ctrl-home = top of console
	if ( ( key == K_HOME || key == K_KP_HOME ) && trap_Key_IsDown( K_CTRL ) ) {
		Con_Top();
		return;
	}

	// ctrl-end = bottom of console
	if ( ( key == K_END || key == K_KP_END ) && trap_Key_IsDown( K_CTRL ) ) {
		Con_Bottom();
		return;
	}

	// pass to the normal editline routine
	MField_KeyDownEvent( &g_consoleField, key );
}
Пример #9
0
/*
======================
CG_LoadingString

======================
*/
void CG_LoadingString( const char *s ) {
	Q_strncpyz( cg.infoScreenText, s, sizeof( cg.infoScreenText ) );
	//Com_Printf("loadingstring '%s'\n", s);
	trap_UpdateScreen();
}