Exemple #1
0
/*
===============
UI_LogAwardData
===============
*/
void UI_LogAwardData( int award, int data ) {
    char	key[16];
    char	awardData[MAX_INFO_VALUE];
    int		oldValue;

    if( data == 0 ) {
        return;
    }

    if( award > AWARD_PERFECT ) {
        trap_Print( va( S_COLOR_RED "Bad award %i in UI_LogAwardData\n", award ) );
        return;
    }

    trap_Cvar_VariableStringBuffer( "g_spAwards", awardData, sizeof(awardData) );

    Com_sprintf( key, sizeof(key), "a%i", award );
    oldValue = atoi( Info_ValueForKey( awardData, key ) );

    Info_SetValueForKey( awardData, key, va( "%i", oldValue + data ) );
    trap_Cvar_Set( "g_spAwards", awardData );
}
/*
=======================================================================================================================================
SpecifyLeague_GetList
=======================================================================================================================================
*/
static void SpecifyLeague_GetList() {
	int count = 0;
	int i;

	// The Player Name has changed. We need to perform another search
	Q_strncpyz(playername, s_specifyleague.rankname.field.buffer, sizeof(playername));

	count = trap_CL_UI_RankGetLeauges(playername);

	for (i = 0; i < count; i++) {
		char s[MAX_LEAGUENAME];
		const char *var;

		var = va("leaguename%i", i + 1);

		trap_Cvar_VariableStringBuffer(var, s, sizeof(s));
		Q_strncpyz(league_table[i].leaguename, s, sizeof(league_table[i].leaguename));
		Q_strncpyz(league_table[i].buff, league_table[i].leaguename, sizeof(league_table[i].buff));
	}

	s_specifyleague.list.numitems = count;
}
Exemple #3
0
static void CG_StartOrbit_f(void)
{
	char            var[MAX_TOKEN_CHARS];

	trap_Cvar_VariableStringBuffer("developer", var, sizeof(var));
	if(!atoi(var))
	{
		return;
	}
	if(cg_cameraOrbit.value != 0)
	{
		trap_Cvar_Set("cg_cameraOrbit", "0");
		trap_Cvar_Set("cg_thirdPerson", "0");
	}
	else
	{
		trap_Cvar_Set("cg_cameraOrbit", "5");
		trap_Cvar_Set("cg_thirdPerson", "1");
		trap_Cvar_Set("cg_thirdPersonAngle", "0");
		trap_Cvar_Set("cg_thirdPersonRange", "100");
	}
}
/*
=============
G_Script_ScriptLoad

  Loads the script for the current level into the buffer
=============
*/
void G_Script_ScriptLoad( void ) {
	char filename[MAX_QPATH];
	vmCvar_t mapname;
	fileHandle_t f;
	int len;

	trap_Cvar_Register( &g_scriptDebug, "g_scriptDebug", "0", 0 );

	level.scriptEntity = NULL;

	trap_Cvar_VariableStringBuffer( "g_scriptName", filename, sizeof( filename ) );
	if ( strlen( filename ) > 0 ) {
		trap_Cvar_Register( &mapname, "g_scriptName", "", CVAR_ROM );
	} else {
		trap_Cvar_Register( &mapname, "mapname", "", CVAR_SERVERINFO | CVAR_ROM );
	}
	Q_strncpyz( filename, "maps/", sizeof( filename ) );
	Q_strcat( filename, sizeof( filename ), mapname.string );
	// DHM - Nerve :: Support capture mode by loading appropriate script
	if ( ( g_gametype.integer == GT_WOLF_CP ) || ( g_gametype.integer == GT_WOLF_CPH ) ) { // JPW NERVE added capture & hold
		Q_strcat( filename, sizeof( filename ), "_cp" );
	}
	// dhm - Nerve
	Q_strcat( filename, sizeof( filename ), ".script" );

	len = trap_FS_FOpenFile( filename, &f, FS_READ );

	// make sure we clear out the temporary scriptname
	trap_Cvar_Set( "g_scriptName", "" );

	if ( len < 0 ) {
		return;
	}

	level.scriptEntity = G_Alloc( len );
	trap_FS_Read( level.scriptEntity, len, f );

	trap_FS_FCloseFile( f );
}
/*
=================
PlayerSettings_SetMenuItems
=================
*/
static void PlayerSettings_SetMenuItems( void ) {
	vec3_t	viewangles;
	int		c1, c2, c3;
	int		h;
	char	temp[6];

	// name
	Q_strncpyz( s_playersettings.name.field.buffer, UI_Cvar_VariableString("name"), sizeof(s_playersettings.name.field.buffer) );

	// effects color
	trap_Cvar_VariableStringBuffer( "color1", temp, sizeof(temp) );

	c1 = atoi( va( "%c", temp[0] ) ) - 1;
	c2 = atoi( va( "%c", temp[2] ) ) - 1;
	c3 = atoi( va( "%c", temp[4] ) ) - 1;

	if ( c1 > 6 || c1 < 0 ) c1 = 6;
	if ( c2 > 6 || c2 < 0 ) c2 = 6;
	if ( c3 > 6 || c3 < 0 ) c3 = 6;

	s_playersettings.effects.curvalue = gamecodetoui[c1];
	s_playersettings.effects2.curvalue = gamecodetoui[c2];
	s_playersettings.effects3.curvalue = gamecodetoui[c3];


	// model/skin
	memset( &s_playersettings.playerinfo, 0, sizeof(playerInfo_t) );

	viewangles[YAW]   = 180 - 30;
	viewangles[PITCH] = 0;
	viewangles[ROLL]  = 0;

	UI_PlayerInfo_SetModel( &s_playersettings.playerinfo, UI_Cvar_VariableString( "model" ) );
	UI_PlayerInfo_SetInfo( &s_playersettings.playerinfo, LEGS_IDLE, TORSO_STAND, viewangles, vec3_origin, WP_RAILGUN, qfalse );

	// handicap
	h = Com_Clamp( 5, 100, trap_Cvar_VariableValue("handicap") );
	s_playersettings.handicap.curvalue = 20 - h / 5;
}
Exemple #6
0
void G_ResetMarkers( gentity_t* ent ) {
	int i, time;
	char buffer[ MAX_CVAR_VALUE_STRING ];
	float period;

	trap_Cvar_VariableStringBuffer( "sv_fps", buffer, sizeof( buffer ) - 1 );

	period = atoi( buffer );
	if ( !period ) {
		period = 50;
	} else {
		period = 1000.f / period;
	}

	ent->client->topMarker = MAX_CLIENT_MARKERS - 1;
	for ( i = MAX_CLIENT_MARKERS - 1, time = level.time; i >= 0; i--, time -= period ) {
		VectorCopy( ent->r.mins, ent->client->clientMarkers[i].mins );
		VectorCopy( ent->r.maxs, ent->client->clientMarkers[i].maxs );
		VectorCopy( ent->r.currentOrigin, ent->client->clientMarkers[i].origin );
		ent->client->clientMarkers[i].time = time;
	}
}
Exemple #7
0
/*
===============
UI_GetBestScore

Returns the player's best finish on a given level, 0 if the have not played the level
===============
*/
void UI_GetBestScore(int level, int* score, int* skill) {
    int     n;
    int     skillScore;
    int     bestScore;
    int     bestScoreSkill;
    char    arenaKey[16];
    char    scores[MAX_INFO_VALUE];

    if (!score || !skill) {
        return;
    }

    if (level < 0 || level > ui_numArenas) {
        return;
    }

    bestScore = 0;
    bestScoreSkill = 0;

    for (n = 1; n <= 5; n++) {
        trap_Cvar_VariableStringBuffer(va("g_spScores%i", n), scores, MAX_INFO_VALUE);

        Com_sprintf(arenaKey, sizeof(arenaKey), "l%i", level);
        skillScore = atoi(Info_ValueForKey(scores, arenaKey));

        if (skillScore < 1 || skillScore > 8) {
            continue;
        }

        if (!bestScore || skillScore <= bestScore) {
            bestScore = skillScore;
            bestScoreSkill = n;
        }
    }

    *score = bestScore;
    *skill = bestScoreSkill;
}
Exemple #8
0
int G_NextCampaign_v( gentity_t *ent, unsigned int dwVoteIndex,
		char *arg, char *arg2, qboolean fRefereeCmd )
{
	// Vote request (vote is being initiated)
	if(arg) {
		if(!vote_allow_nextcampaign.integer)
			return G_INVALID;
		if(g_gametype.integer != GT_WOLF_CAMPAIGN)
			return G_INVALID;
	}
	// Vote action (vote has passed)
	else {
		char s[MAX_STRING_CHARS];
		int i;

		if(!level.intermissiontime){
			if(g_XPSave.integer &  XPSF_STORE_AT_RESTART){
				for( i = 0; i < level.numConnectedClients; i++ ) {
					G_xpsave_add(&g_entities[level.sortedClients[i]],qfalse);
				}
				if(g_spreeOptions.integer & SPREE_SAVE_RECORD_RESTART){
					G_AddSpreeRecord();
				}
				G_xpsave_writeconfig();
			}else if(g_spreeOptions.integer & SPREE_SAVE_RECORD_RESTART){
				G_xpsave_readconfig();
				G_AddSpreeRecord();
				G_xpsave_writeconfig();
			}	
		}
		G_reset_disconnects();
		
		trap_Cvar_VariableStringBuffer("nextcampaign", s, sizeof(s));
		if(*s)
			trap_SendConsoleCommand(EXEC_APPEND, "vstr nextcampaign\n");
	}
	return(G_OK);
}
Exemple #9
0
int allowedVote(char *commandStr) {
    char tempStr[MAX_VOTENAME_LENGTH];
    int length;
    char voteNames[MAX_CVAR_VALUE_STRING];
    trap_Cvar_VariableStringBuffer( "g_voteNames", voteNames, sizeof( voteNames ) );
    if(!Q_stricmp(voteNames, "*" ))
        return qtrue; //if star, everything is allowed
    length = strlen(commandStr);
    if(length>MAX_VOTENAME_LENGTH-3)
    {
        //Error: too long
        return qfalse;
    }
    //Now constructing a string that starts and ends with '/' like: "/clientkick/"
    tempStr[0] = '/';
    strncpy(&tempStr[1],commandStr,length);
    tempStr[length+1] = '/';
    tempStr[length+2] = '\0';
    if(Q_stristr(voteNames,tempStr) != NULL)
        return qtrue;
    else
        return qfalse;
}
Exemple #10
0
int allowedGametype(char *gametypeStr) {
    char tempStr[MAX_GAMETYPENAME_LENGTH];
    int length;
    char voteGametypes[MAX_CVAR_VALUE_STRING];
    trap_Cvar_VariableStringBuffer( "g_voteGametypes", voteGametypes, sizeof( voteGametypes ) );
    if(!Q_stricmp(voteGametypes, "*" ))
        return qtrue; //if star, everything is allowed
    length = strlen(gametypeStr);
    if(length>MAX_GAMETYPENAME_LENGTH-3)
    {
        //Error: too long
        return qfalse;
    }
    tempStr[0] = '/';
    strncpy(&tempStr[1],gametypeStr,length);
    tempStr[length+1] = '/';
    tempStr[length+2] = '\0';
    if(Q_stristr(voteGametypes,tempStr) != NULL)
        return qtrue;
    else {
        return qfalse;
    }
}
Exemple #11
0
/*
================
G_ReadSessionData

Called on a reconnect
================
*/
void G_ReadSessionData( gclient_t *client )
{
	char       s[ MAX_STRING_CHARS ];
	const char *var;
	int        spectatorState;
	int        restartTeam;
	char       ignorelist[ 17 ];

	var = va( "session%li", ( long )( client - level.clients ) );
	trap_Cvar_VariableStringBuffer( var, s, sizeof( s ) );

	sscanf( s, "%i %i %i %i %16s",
	        &client->sess.spectatorTime,
	        &spectatorState,
	        &client->sess.spectatorClient,
	        &restartTeam,
	        ignorelist
	      );

	client->sess.spectatorState = ( spectatorState_t ) spectatorState;
	client->sess.restartTeam = ( team_t ) restartTeam;
	Com_ClientListParse( &client->sess.ignoreList, ignorelist );
}
/*
================
G_ReadSessionData

Called on a reconnect
================
*/
void G_ReadSessionData( gclient_t *client )
{
  char  s[ MAX_STRING_CHARS ];
  const char  *var;

  // bk001205 - format
  int teamLeader;
  int spectatorState;
  int sessionTeam;
  int restartTeam;
  int invisible;

  var = va( "session%i", (int)(client - level.clients) );
  trap_Cvar_VariableStringBuffer( var, s, sizeof(s) );

  // FIXME: should be using BG_ClientListParse() for ignoreList, but
  //        bg_lib.c's sscanf() currently lacks %s
  sscanf( s, "%i %i %i %i %i %i %i %i %i %x%x",
    &sessionTeam,
    &restartTeam,
    &client->sess.spectatorTime,
    &spectatorState,
    &client->sess.spectatorClient,
    &client->sess.wins,
    &client->sess.losses,
    &teamLeader,
    &invisible,
    &client->sess.ignoreList.hi,
    &client->sess.ignoreList.lo
    );
  // bk001205 - format issues
  client->sess.sessionTeam = (team_t)sessionTeam;
  client->sess.restartTeam = (pTeam_t)restartTeam;
  client->sess.spectatorState = (spectatorState_t)spectatorState;
  client->sess.teamLeader = (qboolean)teamLeader;
  client->sess.invisible = (qboolean)invisible;
}
/*
================
G_ReadSessionData

Called on a reconnect
================
*/
void G_ReadSessionData( gclient_t *client ) {
	char	s[MAX_STRING_CHARS];
	const char	*var;
	int teamLeader;
	int spectatorState;
	int sessionTeam;

	var = va( "session%i", (int)(client - level.clients) );
	trap_Cvar_VariableStringBuffer( var, s, sizeof(s) );

	sscanf( s, "%i %i %i %i %i %i %i",
		&sessionTeam,
		&client->sess.spectatorTime,
		&spectatorState,
		&client->sess.spectatorClient,
		&client->sess.wins,
		&client->sess.losses,
		&teamLeader
		);

	client->sess.sessionTeam = (team_t)sessionTeam;
	client->sess.spectatorState = (spectatorState_t)spectatorState;
	client->sess.teamLeader = (qboolean)teamLeader;
}
void		trap_GetCurrentSnapshotNumber( int *snapshotNumber, int *serverTime ) {
	syscall( CG_GETCURRENTSNAPSHOTNUMBER, snapshotNumber, serverTime );

#ifdef FAKELAG
	{
		char s[MAX_STRING_CHARS];
		int fakeLag;

		trap_Cvar_VariableStringBuffer( "g_fakelag", s, sizeof(s) );
		fakeLag = atoi(s);
		if( fakeLag < 0 )
			fakeLag = 0;

		if( fakeLag ) {
			if( curSnapshotNumber < cg.latestSnapshotNum ) {
				*snapshotNumber = cg.latestSnapshotNum + 1;
				curSnapshotNumber = cg.latestSnapshotNum + 2;	// skip one ahead and we're good to go on the next frame
				skiponeget = qtrue;
			} else
				*snapshotNumber = curSnapshotNumber;
		}
	}
#endif // FAKELAG
}
Exemple #15
0
qboolean G_CurrentMapIsRotation( void )
{
  char mapname[ 64 ];
  int map, rotation;
  int i;

  // Check for an active map rotation,
  // only return false if rotation is running and current map is not from it
  if ( !G_MapRotationActive() || g_currentMapRotation.integer == NOT_ROTATING )
    return qtrue;

  rotation = g_currentMapRotation.integer;
  if( !( rotation >= 0 && rotation < mapRotations.numRotations ) )
    return qtrue;

  map = G_GetCurrentMap( rotation );
  if( !(map >= 0 && map < mapRotations.rotations[ rotation ].numMaps ) )
    return qtrue;

  trap_Cvar_VariableStringBuffer( "mapname", mapname, sizeof( mapname ) );

  if( !Q_stricmp( mapRotations.rotations[ rotation ].maps[ map ].name, mapname ) )
    return qtrue;

  if( !Q_stricmp( mapRotations.rotations[ rotation ].maps[ map ].name, "*VOTE*" ) )
  {
    for( i = 0; i < mapRotations.rotations[ rotation ].maps[ map ].numConditions; i++ )
    {
      if( mapRotations.rotations[ rotation ].maps[ map ].conditions[ i ].lhs == MCV_VOTE &&
          !Q_stricmp( mapRotations.rotations[ rotation ].maps[ map ].conditions[ i ].dest, mapname ) )
        return qtrue;
    }
  }

  return qfalse;
}
Exemple #16
0
// Save to disk file
//
// Since my compression routines are one thing I did not want to
// release, I took out the compressed format option. Most levels will
// save out to a node file around 50-200k, so compression is not really
// a big deal.
void ACEND_SaveNodes()
{
	fileHandle_t    file;
	char            filename[MAX_QPATH];
	int             i, j;
	int             version = 1;
	char            mapname[MAX_QPATH];

	ACEND_ResolveAllPaths();

	trap_Cvar_VariableStringBuffer("mapname", mapname, sizeof(mapname));
	Com_sprintf(filename, sizeof(filename), "nav/%s.nod", mapname);

	trap_FS_FOpenFile(filename, &file, FS_WRITE);
	if(!file)
	{
		G_Printf("WARNING: Couldn't write node table: %s\n", filename);
		return;
	}
	else
		G_Printf("ACE: Saving node table '%s'...", filename);

	trap_FS_Write(&version, sizeof(int), file);
	trap_FS_Write(&numNodes, sizeof(int), file);
	trap_FS_Write(nodes, sizeof(node_t) * numNodes, file);

	for(i = 0; i < numNodes; i++)
		for(j = 0; j < numNodes; j++)
			trap_FS_Write(&path_table[i][j], sizeof(short int), file);	// write count

	trap_FS_FCloseFile(file);

	G_Printf("done.\n");

	G_Printf("%i nodes saved\n", numNodes);
}
/*
====================
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;
	qhandle_t	detail;
	char		buf[1024];

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

	s = Info_ValueForKey( info, "mapname" );
	levelshot = trap_R_RegisterShaderNoMip( va( "levelshots/%s", s ) );
	if ( !levelshot ) {
		levelshot = trap_R_RegisterShaderNoMip( "menu/art/unknownmap" );
	}
	trap_R_SetColor( NULL );
	trap_R_DrawStretchPic( 0, 0, cgs.glconfig.vidWidth, cgs.glconfig.vidHeight, 0, 0, 1, 1, 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 );

	// draw the icons of things 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-32, va("Loading... %s", cg.infoScreenText),
			UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite );
	} else {
		UI_DrawProportionalString( 320, 128-32, "Awaiting snapshot...",
			UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, colorWhite );
	}

	// draw info string information

	y = 180-32;

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

		// pure server
		s = Info_ValueForKey( sysInfo, "sv_pure" );
		if ( s[0] == '1' ) {
			UI_DrawProportionalString( 320, y, "Pure Server",
				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
	UI_DrawProportionalString( 320, y, cgs.gametypeName,
		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 ) {
		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 );
		}
	}
}
Exemple #18
0
static void UI_SPLevelMenu_MenuDraw( void ) {
	int				n, i;
	int				x, y;
	vec4_t			color;
	int				level;
//	int				fraglimit;
	int				pad;
	char			buf[MAX_INFO_VALUE];
	char			string[64];

	if(	levelMenuInfo.reinit ) {
		UI_PopMenu();
		UI_SPLevelMenu();
		return;
	}

	// draw player name
	trap_Cvar_VariableStringBuffer( "name", string, 32 );
	Q_CleanStr( string );
	UI_DrawProportionalString( 320, PLAYER_Y, string, UI_CENTER|UI_SMALLFONT, color_orange );

	// check for model changes
	trap_Cvar_VariableStringBuffer( "model", buf, sizeof(buf) );
	if( Q_stricmp( buf, levelMenuInfo.playerModel ) != 0 ) {
		Q_strncpyz( levelMenuInfo.playerModel, buf, sizeof(levelMenuInfo.playerModel) );
		PlayerIcon( levelMenuInfo.playerModel, levelMenuInfo.playerPicName, sizeof(levelMenuInfo.playerPicName) );
		levelMenuInfo.item_player.shader = 0;
	}

	// standard menu drawing
	Menu_Draw( &levelMenuInfo.menu );

	// draw player award levels
	y = AWARDS_Y;
	i = 0;
	for( n = 0; n < 6; n++ ) {
		level = levelMenuInfo.awardLevels[n];
		if( level > 0 ) {
			if( i & 1 ) {
				x = 224 - (i - 1 ) / 2 * (48 + 16);
			}
			else {
				x = 368 + i / 2 * (48 + 16);
			}
			i++;

			if( level == 1 ) {
				continue;
			}

			if( level >= 1000000 ) {
				Com_sprintf( string, sizeof(string), "%im", level / 1000000 );
			}
			else if( level >= 1000 ) {
				Com_sprintf( string, sizeof(string), "%ik", level / 1000 );
			}
			else {
				Com_sprintf( string, sizeof(string), "%i", level );
			}

			UI_DrawString( x + 24, y + 48, string, UI_CENTER, color_yellow );
		}
	}

	UI_DrawProportionalString( 18, 38, va( "Tier %i", selectedArenaSet + 1 ), UI_LEFT|UI_SMALLFONT, color_orange );

	for ( n = 0; n < levelMenuInfo.numMaps; n++ ) {
		x = levelMenuInfo.item_maps[n].generic.x;
		y = levelMenuInfo.item_maps[n].generic.y;
		UI_FillRect( x, y + 96, 128, 18, color_black );
	}

	if ( selectedArenaSet > currentSet ) {
		UI_DrawProportionalString( 320, 216, "ACCESS DENIED", UI_CENTER|UI_BIGFONT, color_red );
		return;
	}

	// show levelshots for levels of current tier
	Vector4Copy( color_white, color );
	color[3] = 0.5+0.5*sin(uis.realtime/PULSE_DIVISOR);
	for ( n = 0; n < levelMenuInfo.numMaps; n++ ) {
		x = levelMenuInfo.item_maps[n].generic.x;
		y = levelMenuInfo.item_maps[n].generic.y;

		UI_DrawString( x + 64, y + 96, levelMenuInfo.levelNames[n], UI_CENTER|UI_SMALLFONT, color_orange );

		if( levelMenuInfo.levelScores[n] == 1 ) {
			UI_DrawHandlePic( x, y, 128, 96, levelMenuInfo.levelCompletePic[levelMenuInfo.levelScoresSkill[n] - 1] ); 
		}

		if ( n == selectedArena ) {
			if( Menu_ItemAtCursor( &levelMenuInfo.menu ) == &levelMenuInfo.item_maps[n] ) {
				trap_R_SetColor( color );
			}
			UI_DrawHandlePic( x-1, y-1, 130, 130 - 14, levelMenuInfo.levelSelectedPic ); 
			trap_R_SetColor( NULL );
		}
		else if( Menu_ItemAtCursor( &levelMenuInfo.menu ) == &levelMenuInfo.item_maps[n] ) {
			trap_R_SetColor( color );
			UI_DrawHandlePic( x-31, y-30, 256, 256-27, levelMenuInfo.levelFocusPic); 
			trap_R_SetColor( NULL );
		}
	}

	// show map name and long name of selected level
	y = 192;
	Q_strncpyz( buf, Info_ValueForKey( levelMenuInfo.selectedArenaInfo, "map" ), 20 );
	Q_strupr( buf );
	Com_sprintf( string, sizeof(string), "%s: %s", buf, Info_ValueForKey( levelMenuInfo.selectedArenaInfo, "longname" ) );
	UI_DrawProportionalString( 320, y, string, UI_CENTER|UI_SMALLFONT, color_orange );

//	fraglimit = atoi( Info_ValueForKey( levelMenuInfo.selectedArenaInfo, "fraglimit" ) );
//	UI_DrawString( 18, 212, va("Frags %i", fraglimit) , UI_LEFT|UI_SMALLFONT, color_orange );

	// draw bot opponents
	y += 24;
	pad = (7 - levelMenuInfo.numBots) * (64 + 26) / 2;
	for( n = 0; n < levelMenuInfo.numBots; n++ ) {
		x = 18 + pad + (64 + 26) * n;
		if( levelMenuInfo.botPics[n] ) {
			UI_DrawHandlePic( x, y, 64, 64, levelMenuInfo.botPics[n]);
		}
		else {
			UI_FillRect( x, y, 64, 64, color_black );
			UI_DrawProportionalString( x+22, y+18, "?", UI_BIGFONT, color_orange );
		}
		UI_DrawString( x, y + 64, levelMenuInfo.botNames[n], UI_SMALLFONT|UI_LEFT, color_orange );
	}
}
Exemple #19
0
/*
=================
UI_SPLevelMenu_Init
=================
*/
static void UI_SPLevelMenu_Init( void ) {
	int		skill;
	int		n;
	int		x, y;
	int		count;
	char	buf[MAX_QPATH];

	skill = (int)trap_Cvar_VariableValue( "g_spSkill" );
	if( skill < 1 || skill > 5 ) {
		trap_Cvar_Set( "g_spSkill", "2" );
		skill = 2;
	}

	memset( &levelMenuInfo, 0, sizeof(levelMenuInfo) );
	levelMenuInfo.menu.fullscreen = qtrue;
	levelMenuInfo.menu.wrapAround = qtrue;
	levelMenuInfo.menu.draw = UI_SPLevelMenu_MenuDraw;

	UI_SPLevelMenu_Cache();

	levelMenuInfo.item_banner.generic.type			= MTYPE_BTEXT;
	levelMenuInfo.item_banner.generic.x				= 320;
	levelMenuInfo.item_banner.generic.y				= 16;
	levelMenuInfo.item_banner.string				= "CHOOSE LEVEL";
	levelMenuInfo.item_banner.color					= color_red;
	levelMenuInfo.item_banner.style					= UI_CENTER;

	levelMenuInfo.item_leftarrow.generic.type		= MTYPE_BITMAP;
	levelMenuInfo.item_leftarrow.generic.name		= ART_ARROW;
	levelMenuInfo.item_leftarrow.generic.flags		= QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
	levelMenuInfo.item_leftarrow.generic.x			= 18;
	levelMenuInfo.item_leftarrow.generic.y			= 64;
	levelMenuInfo.item_leftarrow.generic.callback	= UI_SPLevelMenu_LeftArrowEvent;
	levelMenuInfo.item_leftarrow.generic.id			= ID_LEFTARROW;
	levelMenuInfo.item_leftarrow.width				= 16;
	levelMenuInfo.item_leftarrow.height				= 114;
	levelMenuInfo.item_leftarrow.focuspic			= ART_ARROW_FOCUS;

	levelMenuInfo.item_maps[0].generic.type			= MTYPE_BITMAP;
	levelMenuInfo.item_maps[0].generic.name			= levelMenuInfo.levelPicNames[0];
	levelMenuInfo.item_maps[0].generic.flags		= QMF_LEFT_JUSTIFY;
	levelMenuInfo.item_maps[0].generic.x			= 46;
	levelMenuInfo.item_maps[0].generic.y			= 64;
	levelMenuInfo.item_maps[0].generic.id			= ID_PICTURE0;
	levelMenuInfo.item_maps[0].generic.callback		= UI_SPLevelMenu_LevelEvent;
	levelMenuInfo.item_maps[0].width				= 128;
	levelMenuInfo.item_maps[0].height				= 96;

	levelMenuInfo.item_maps[1].generic.type			= MTYPE_BITMAP;
	levelMenuInfo.item_maps[1].generic.name			= levelMenuInfo.levelPicNames[1];
	levelMenuInfo.item_maps[1].generic.flags		= QMF_LEFT_JUSTIFY;
	levelMenuInfo.item_maps[1].generic.x			= 186;
	levelMenuInfo.item_maps[1].generic.y			= 64;
	levelMenuInfo.item_maps[1].generic.id			= ID_PICTURE1;
	levelMenuInfo.item_maps[1].generic.callback		= UI_SPLevelMenu_LevelEvent;
	levelMenuInfo.item_maps[1].width				= 128;
	levelMenuInfo.item_maps[1].height				= 96;

	levelMenuInfo.item_maps[2].generic.type			= MTYPE_BITMAP;
	levelMenuInfo.item_maps[2].generic.name			= levelMenuInfo.levelPicNames[2];
	levelMenuInfo.item_maps[2].generic.flags		= QMF_LEFT_JUSTIFY;
	levelMenuInfo.item_maps[2].generic.x			= 326;
	levelMenuInfo.item_maps[2].generic.y			= 64;
	levelMenuInfo.item_maps[2].generic.id			= ID_PICTURE2;
	levelMenuInfo.item_maps[2].generic.callback		= UI_SPLevelMenu_LevelEvent;
	levelMenuInfo.item_maps[2].width				= 128;
	levelMenuInfo.item_maps[2].height				= 96;

	levelMenuInfo.item_maps[3].generic.type			= MTYPE_BITMAP;
	levelMenuInfo.item_maps[3].generic.name			= levelMenuInfo.levelPicNames[3];
	levelMenuInfo.item_maps[3].generic.flags		= QMF_LEFT_JUSTIFY;
	levelMenuInfo.item_maps[3].generic.x			= 466;
	levelMenuInfo.item_maps[3].generic.y			= 64;
	levelMenuInfo.item_maps[3].generic.id			= ID_PICTURE3;
	levelMenuInfo.item_maps[3].generic.callback		= UI_SPLevelMenu_LevelEvent;
	levelMenuInfo.item_maps[3].width				= 128;
	levelMenuInfo.item_maps[3].height				= 96;

	levelMenuInfo.item_rightarrow.generic.type		= MTYPE_BITMAP;
	levelMenuInfo.item_rightarrow.generic.name		= ART_ARROW;
	levelMenuInfo.item_rightarrow.generic.flags		= QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
	levelMenuInfo.item_rightarrow.generic.x			= 606;
	levelMenuInfo.item_rightarrow.generic.y			= 64;
	levelMenuInfo.item_rightarrow.generic.callback	= UI_SPLevelMenu_RightArrowEvent;
	levelMenuInfo.item_rightarrow.generic.id		= ID_RIGHTARROW;
	levelMenuInfo.item_rightarrow.width				= -16;
	levelMenuInfo.item_rightarrow.height			= 114;
	levelMenuInfo.item_rightarrow.focuspic			= ART_ARROW_FOCUS;

	trap_Cvar_VariableStringBuffer( "model", levelMenuInfo.playerModel, sizeof(levelMenuInfo.playerModel) );
	PlayerIcon( levelMenuInfo.playerModel, levelMenuInfo.playerPicName, sizeof(levelMenuInfo.playerPicName) );
	levelMenuInfo.item_player.generic.type			= MTYPE_BITMAP;
	levelMenuInfo.item_player.generic.name			= levelMenuInfo.playerPicName;
	levelMenuInfo.item_player.generic.flags			= QMF_LEFT_JUSTIFY|QMF_MOUSEONLY;
	levelMenuInfo.item_player.generic.x				= 288;
	levelMenuInfo.item_player.generic.y				= AWARDS_Y;
	levelMenuInfo.item_player.generic.id			= ID_PLAYERPIC;
	levelMenuInfo.item_player.generic.callback		= UI_SPLevelMenu_PlayerEvent;
	levelMenuInfo.item_player.width					= 64;
	levelMenuInfo.item_player.height				= 64;

	for( n = 0; n < 6; n++ ) {
		levelMenuInfo.awardLevels[n] = UI_GetAwardLevel( n );
	}
	levelMenuInfo.awardLevels[AWARD_FRAGS] = 100 * (levelMenuInfo.awardLevels[AWARD_FRAGS] / 100);

	y = AWARDS_Y;
	count = 0;
	for( n = 0; n < 6; n++ ) {
		if( levelMenuInfo.awardLevels[n] ) {
			if( count & 1 ) {
				x = 224 - (count - 1 ) / 2 * (48 + 16);
			}
			else {
				x = 368 + count / 2 * (48 + 16);
			}

			levelMenuInfo.item_awards[count].generic.type		= MTYPE_BITMAP;
			levelMenuInfo.item_awards[count].generic.name		= ui_medalPicNames[n];
			levelMenuInfo.item_awards[count].generic.flags		= QMF_LEFT_JUSTIFY|QMF_SILENT|QMF_MOUSEONLY;
			levelMenuInfo.item_awards[count].generic.x			= x;
			levelMenuInfo.item_awards[count].generic.y			= y;
			levelMenuInfo.item_awards[count].generic.id			= ID_AWARD1 + n;
			levelMenuInfo.item_awards[count].generic.callback	= UI_SPLevelMenu_AwardEvent;
			levelMenuInfo.item_awards[count].width				= 48;
			levelMenuInfo.item_awards[count].height				= 48;
			count++;
		}
	}

	levelMenuInfo.item_back.generic.type			= MTYPE_BITMAP;
	levelMenuInfo.item_back.generic.name			= ART_BACK0;
	levelMenuInfo.item_back.generic.flags			= QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
	levelMenuInfo.item_back.generic.x				= 0;
	levelMenuInfo.item_back.generic.y				= 480-64;
	levelMenuInfo.item_back.generic.callback		= UI_SPLevelMenu_BackEvent;
	levelMenuInfo.item_back.generic.id				= ID_BACK;
	levelMenuInfo.item_back.width					= 128;
	levelMenuInfo.item_back.height					= 64;
	levelMenuInfo.item_back.focuspic				= ART_BACK1;

	levelMenuInfo.item_reset.generic.type			= MTYPE_BITMAP;
	levelMenuInfo.item_reset.generic.name			= ART_RESET0;
	levelMenuInfo.item_reset.generic.flags			= QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
	levelMenuInfo.item_reset.generic.x				= 170;
	levelMenuInfo.item_reset.generic.y				= 480-64;
	levelMenuInfo.item_reset.generic.callback		= UI_SPLevelMenu_ResetEvent;
	levelMenuInfo.item_reset.generic.id				= ID_RESET;
	levelMenuInfo.item_reset.width					= 128;
	levelMenuInfo.item_reset.height					= 64;
	levelMenuInfo.item_reset.focuspic				= ART_RESET1;

	levelMenuInfo.item_custom.generic.type			= MTYPE_BITMAP;
	levelMenuInfo.item_custom.generic.name			= ART_CUSTOM0;
	levelMenuInfo.item_custom.generic.flags			= QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
	levelMenuInfo.item_custom.generic.x				= 342;
	levelMenuInfo.item_custom.generic.y				= 480-64;
	levelMenuInfo.item_custom.generic.callback		= UI_SPLevelMenu_CustomEvent;
	levelMenuInfo.item_custom.generic.id			= ID_CUSTOM;
	levelMenuInfo.item_custom.width					= 128;
	levelMenuInfo.item_custom.height				= 64;
	levelMenuInfo.item_custom.focuspic				= ART_CUSTOM1;

	levelMenuInfo.item_next.generic.type			= MTYPE_BITMAP;
	levelMenuInfo.item_next.generic.name			= ART_FIGHT0;
	levelMenuInfo.item_next.generic.flags			= QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS;
	levelMenuInfo.item_next.generic.x				= 640;
	levelMenuInfo.item_next.generic.y				= 480-64;
	levelMenuInfo.item_next.generic.callback		= UI_SPLevelMenu_NextEvent;
	levelMenuInfo.item_next.generic.id				= ID_NEXT;
	levelMenuInfo.item_next.width					= 128;
	levelMenuInfo.item_next.height					= 64;
	levelMenuInfo.item_next.focuspic				= ART_FIGHT1;

	levelMenuInfo.item_null.generic.type			= MTYPE_BITMAP;
	levelMenuInfo.item_null.generic.flags			= QMF_LEFT_JUSTIFY|QMF_MOUSEONLY|QMF_SILENT;
	levelMenuInfo.item_null.generic.x				= 0;
	levelMenuInfo.item_null.generic.y				= 0;
	levelMenuInfo.item_null.width					= 640;
	levelMenuInfo.item_null.height					= 480;

	Menu_AddItem( &levelMenuInfo.menu, &levelMenuInfo.item_banner );

	Menu_AddItem( &levelMenuInfo.menu, &levelMenuInfo.item_leftarrow );
	Menu_AddItem( &levelMenuInfo.menu, &levelMenuInfo.item_maps[0] );
	Menu_AddItem( &levelMenuInfo.menu, &levelMenuInfo.item_maps[1] );
	Menu_AddItem( &levelMenuInfo.menu, &levelMenuInfo.item_maps[2] );
	Menu_AddItem( &levelMenuInfo.menu, &levelMenuInfo.item_maps[3] );
	levelMenuInfo.item_maps[0].generic.bottom += 18;
	levelMenuInfo.item_maps[1].generic.bottom += 18;
	levelMenuInfo.item_maps[2].generic.bottom += 18;
	levelMenuInfo.item_maps[3].generic.bottom += 18;
	Menu_AddItem( &levelMenuInfo.menu, &levelMenuInfo.item_rightarrow );

	Menu_AddItem( &levelMenuInfo.menu, &levelMenuInfo.item_player );

	for( n = 0; n < count; n++ ) {
		Menu_AddItem( &levelMenuInfo.menu, &levelMenuInfo.item_awards[n] );
	}
	Menu_AddItem( &levelMenuInfo.menu, &levelMenuInfo.item_back );
	Menu_AddItem( &levelMenuInfo.menu, &levelMenuInfo.item_reset );
	Menu_AddItem( &levelMenuInfo.menu, &levelMenuInfo.item_custom );
	Menu_AddItem( &levelMenuInfo.menu, &levelMenuInfo.item_next );
	Menu_AddItem( &levelMenuInfo.menu, &levelMenuInfo.item_null );

	trap_Cvar_VariableStringBuffer( "ui_spSelection", buf, sizeof(buf) );
	if( *buf ) {
		n = atoi( buf );
		selectedArenaSet = n / ARENAS_PER_TIER;
		selectedArena = n % ARENAS_PER_TIER;
	}
	else {
		selectedArenaSet = currentSet;
		selectedArena = currentGame;
	}

	UI_SPLevelMenu_SetMenuItems();
}
Exemple #20
0
/*QUAKED worldspawn (0 0 0) ?

Every map should have exactly one worldspawn.
"music"		music wav file
"gravity"	800 is default gravity
"message"	Text to print during connection process
*/
void SP_worldspawn( void ) {
	char	*s;
	char buf[MAX_QPATH];

	G_SpawnString( "classname", "", &s );
	if ( Q_stricmp( s, "worldspawn" ) ) {
		G_Error( "SP_worldspawn: The first entity isn't 'worldspawn'" );
	}

	// make some data visible to connecting client
	//trap_SetConfigstring( CS_GAME_VERSION, GAME_VERSION );
	trap_Cvar_VariableStringBuffer("fs_game", buf, sizeof(buf));
	trap_SetConfigstring(CS_GAME_VERSION, buf);

	trap_SetConfigstring( CS_LEVEL_START_TIME, va("%i", level.startTime ) );

	G_SpawnString( "music", "", &s );
	trap_SetConfigstring( CS_MUSIC, s );

	G_SpawnString( "message", "", &s );
	trap_SetConfigstring( CS_MESSAGE, s );				// map specific message

	G_SpawnString("author", "", &s);
	if (s  &&  *s) {
		trap_SetConfigstring(CS_MAP_CREATOR, s);
	}
	G_SpawnString("author2", "", &s);
	if (s  &&  *s) {
		trap_SetConfigstring(CS_ORIGINAL_MAP_CREATOR, s);
	}

	trap_SetConfigstring( CS_MOTD, g_motd.string );		// message of the day

	G_SpawnString( "gravity", "800", &s );
	trap_Cvar_Set( "g_gravity", s );

	G_SpawnString( "enableDust", "0", &s );
	trap_Cvar_Set( "g_enableDust", s );

	G_SpawnString( "enableBreath", "0", &s );
	trap_Cvar_Set( "g_enableBreath", s );

	g_entities[ENTITYNUM_WORLD].s.number = ENTITYNUM_WORLD;
	g_entities[ENTITYNUM_WORLD].r.ownerNum = ENTITYNUM_NONE;
	g_entities[ENTITYNUM_WORLD].classname = "worldspawn";


	g_entities[ENTITYNUM_NONE].s.number = ENTITYNUM_NONE;
	g_entities[ENTITYNUM_NONE].r.ownerNum = ENTITYNUM_NONE;
	g_entities[ENTITYNUM_NONE].classname = "nothing";

	// see if we want a warmup time
	trap_SetConfigstring( CS_WARMUP, "" );
	if ( g_restarted.integer ) {
		trap_Cvar_Set( "g_restarted", "0" );
		level.warmupTime = 0;
	} else if ( g_doWarmup.integer ) { // Turn it on
		level.warmupTime = -1;
		trap_SetConfigstring( CS_WARMUP, va("\\time\\%i", level.warmupTime) );
		G_LogPrintf( "Warmup:\n" );
	}

}
Exemple #21
0
/*
=============
G_Script_ScriptLoad

  Loads the script for the current level into the buffer
=============
*/
void G_Script_ScriptLoad(void) {
	char         filename[MAX_QPATH];
	vmCvar_t     mapname;
	fileHandle_t f     = 0;
	int          len   = 0;
	qboolean     found = qfalse;

	trap_Cvar_Register(&g_scriptDebug, "g_scriptDebug", "0", 0);
	trap_Cvar_VariableStringBuffer("g_scriptName", filename, sizeof (filename));
	if (filename[0] != '\0') {
		trap_Cvar_Register(&mapname, "g_scriptName", "", CVAR_CHEAT);
	} else {
		trap_Cvar_Register(&mapname, "mapname", "", CVAR_SERVERINFO | CVAR_ROM);
	}

	// Nico, if API is used and if a mapscript was sent for this map don't load any local script
	if (g_useAPI.integer && level.useAPImapscript) {
		G_Printf("%s: using custom mapscript from API!\n", GAME_VERSION);
		return;
	}

	// Nico, API is not in use, check if this map a special mapscript in local mapscript directory
	if (!g_useAPI.integer && g_mapScriptDirectory.string[0]) {
		G_Printf("%s: checking for local custom mapscript...\n", GAME_VERSION);
		Q_strncpyz(filename, g_mapScriptDirectory.string, sizeof (filename));
		Q_strcat(filename, sizeof (filename), "/");
		Q_strcat(filename, sizeof (filename), mapname.string);
		Q_strcat(filename, sizeof (filename), ".script");
		len = trap_FS_FOpenFile(filename, &f, FS_READ);
		if (len > 0) {
			found = qtrue;
			G_Printf("%s: found local file '%s'!\n", GAME_VERSION, filename);
		} else {
			G_Printf("%s: no local file found!\n", GAME_VERSION);
		}
	}

	// Nico, should we use default map script or custom one?
	if (!found) {
		Q_strncpyz(filename, "maps/", sizeof (filename));
		Q_strcat(filename, sizeof (filename), mapname.string);
		Q_strcat(filename, sizeof (filename), ".script");
		len = trap_FS_FOpenFile(filename, &f, FS_READ);
		G_Printf("%s: using default mapscript!\n", GAME_VERSION);
	}

	// make sure we clear out the temporary scriptname
	trap_Cvar_Set("g_scriptName", "");

	if (len < 0) {
		return;
	}

	// END Mad Doc - TDF
	// Arnout: make sure we terminate the script with a '\0' to prevent parser from choking
	level.scriptEntity = NULL;
	level.scriptEntity = G_Alloc(len + 1);
	trap_FS_Read(level.scriptEntity, len, f);
	*(level.scriptEntity + len) = '\0';

	// Gordon: and make sure ppl haven't put stuff with uppercase in the string table..
	G_Script_EventStringInit();

	trap_FS_FCloseFile(f);
}
Exemple #22
0
/*
================
G_RankGameOver
================
*/
void G_RankGameOver( void )
{
	int		i;
	char	str[MAX_INFO_VALUE];
	int		num;
	
	if( level.warmupTime != 0 )
	{
		// no reports during warmup period
		return;
	}
	
	for( i = 0; i < level.maxclients; i++ )
	{
		if( trap_RankUserStatus( i ) == QGR_STATUS_ACTIVE )
		{
			G_RankClientDisconnect( i );
		}
	}
	
	// hostname
	trap_Cvar_VariableStringBuffer( "sv_hostname", str, sizeof(str) );
	trap_RankReportStr( -1, -1, QGR_KEY_HOSTNAME, str );

	// map
	trap_Cvar_VariableStringBuffer( "mapname", str, sizeof(str) );
	trap_RankReportStr( -1, -1, QGR_KEY_MAP, str );

	// mod
	trap_Cvar_VariableStringBuffer( "fs_game", str, sizeof(str) );
	trap_RankReportStr( -1, -1, QGR_KEY_MOD, str );

	// gametype
	num = trap_Cvar_VariableIntegerValue("g_gametype");
	trap_RankReportInt( -1, -1, QGR_KEY_GAMETYPE, num, 0 );
	
	// fraglimit
	num = trap_Cvar_VariableIntegerValue("fraglimit");
	trap_RankReportInt( -1, -1, QGR_KEY_FRAGLIMIT, num, 0 );
	
	// timelimit
	num = trap_Cvar_VariableIntegerValue("timelimit");
	trap_RankReportInt( -1, -1, QGR_KEY_TIMELIMIT, num, 0 );

	// maxclients
	num = trap_Cvar_VariableIntegerValue("sv_maxclients");
	trap_RankReportInt( -1, -1, QGR_KEY_MAXCLIENTS, num, 0 );

	// maxrate
	num = trap_Cvar_VariableIntegerValue("sv_maxRate");
	trap_RankReportInt( -1, -1, QGR_KEY_MAXRATE, num, 0 );

	// minping
	num = trap_Cvar_VariableIntegerValue("sv_minPing");
	trap_RankReportInt( -1, -1, QGR_KEY_MINPING, num, 0 );

	// maxping
	num = trap_Cvar_VariableIntegerValue("sv_maxPing");
	trap_RankReportInt( -1, -1, QGR_KEY_MAXPING, num, 0 );

	// dedicated
	num = trap_Cvar_VariableIntegerValue("dedicated");
	trap_RankReportInt( -1, -1, QGR_KEY_DEDICATED, num, 0 );

	// version
	trap_Cvar_VariableStringBuffer( "version", str, sizeof(str) );
	trap_RankReportStr( -1, -1, QGR_KEY_VERSION, str );
}
Exemple #23
0
/*
===============
UI_MainMenu

The main menu only comes up when not in a game,
so make sure that the attract loop server is down
and that local cinematics are killed
===============
*/
void UI_MainMenu( void ) {
	int		y;
	qboolean teamArena = qfalse;
	int		style = UI_CENTER | UI_DROPSHADOW;

	trap_Cvar_Set( "sv_killserver", "1" );
	
	memset( &s_main, 0 ,sizeof(mainmenu_t) );
	memset( &s_errorMessage, 0 ,sizeof(errorMessage_t) );

	// com_errorMessage would need that too
	MainMenu_Cache();
	
	trap_Cvar_VariableStringBuffer( "com_errorMessage", s_errorMessage.errorMessage, sizeof(s_errorMessage.errorMessage) );
	if (strlen(s_errorMessage.errorMessage))
	{	
		s_errorMessage.menu.draw = Main_MenuDraw;
		s_errorMessage.menu.key = ErrorMessage_Key;
		s_errorMessage.menu.fullscreen = qtrue;
		s_errorMessage.menu.wrapAround = qtrue;

		trap_Key_SetCatcher( KEYCATCH_UI );
		uis.menusp = 0;
		UI_PushMenu ( &s_errorMessage.menu );
		
		return;
	}

	s_main.menu.draw = Main_MenuDraw;
	s_main.menu.fullscreen = qtrue;
	s_main.menu.wrapAround = qtrue;

	y = 330;
#define PLACE_X 530

	s_main.demos.generic.type				= MTYPE_PTEXT;
	s_main.demos.generic.flags				= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.demos.generic.x					= PLACE_X;
	s_main.demos.generic.y					= y;
	s_main.demos.generic.id					= ID_DEMOS;
	s_main.demos.generic.callback			= Main_MenuEvent; 
	s_main.demos.string						= "DEMOS";
	s_main.demos.color						= color_red;
	s_main.demos.style						= style;

	y += MAIN_MENU_VERTICAL_SPACING;
	s_main.setup.generic.type				= MTYPE_PTEXT;
	s_main.setup.generic.flags				= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.setup.generic.x					= PLACE_X;
	s_main.setup.generic.y					= y;
	s_main.setup.generic.id					= ID_SETUP;
	s_main.setup.generic.callback			= Main_MenuEvent; 
	s_main.setup.string						= "SETUP";
	s_main.setup.color						= color_red;
	s_main.setup.style						= style;

	y += MAIN_MENU_VERTICAL_SPACING;
	s_main.credits.generic.type				= MTYPE_PTEXT;
	s_main.credits.generic.flags			= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.credits.generic.x				= PLACE_X;
	s_main.credits.generic.y				= y;
	s_main.credits.generic.id				= ID_CREDITS;
	s_main.credits.generic.callback			= Main_MenuEvent; 
	s_main.credits.string					= "CREDITS";
	s_main.credits.color					= color_red;
	s_main.credits.style					= style;

	y += MAIN_MENU_VERTICAL_SPACING;
	s_main.exit.generic.type				= MTYPE_PTEXT;
	s_main.exit.generic.flags				= QMF_CENTER_JUSTIFY|QMF_PULSEIFFOCUS;
	s_main.exit.generic.x					= PLACE_X;
	s_main.exit.generic.y					= y;
	s_main.exit.generic.id					= ID_EXIT;
	s_main.exit.generic.callback			= Main_MenuEvent; 
	s_main.exit.string						= "EXIT";
	s_main.exit.color						= color_red;
	s_main.exit.style						= style;

	Menu_AddItem( &s_main.menu,	&s_main.demos );
	Menu_AddItem( &s_main.menu,	&s_main.setup );
	Menu_AddItem( &s_main.menu,	&s_main.credits );
	Menu_AddItem( &s_main.menu,	&s_main.exit );             

	trap_Key_SetCatcher( KEYCATCH_UI );
	uis.menusp = 0;
	UI_PushMenu ( &s_main.menu );
		
}
/*
=================
GraphicsOptions_SetMenuItems
=================
*/
static void GraphicsOptions_SetMenuItems( void )
{
	s_graphicsoptions.mode.curvalue =
		GraphicsOptions_FindDetectedResolution( trap_Cvar_VariableValue( "r_mode" ) );

	if ( s_graphicsoptions.mode.curvalue < 0 )
	{
		if( resolutionsDetected )
		{
			int i;
			char buf[MAX_STRING_CHARS];
			trap_Cvar_VariableStringBuffer("r_customwidth", buf, sizeof(buf)-2);
			buf[strlen(buf)+1] = 0;
			buf[strlen(buf)] = 'x';
			trap_Cvar_VariableStringBuffer("r_customheight", buf+strlen(buf), sizeof(buf)-strlen(buf));

			for(i = 0; detectedResolutions[i]; ++i)
			{
				if(!strcmp(buf, detectedResolutions[i]))
				{
					s_graphicsoptions.mode.curvalue = i;
					break;
				}
			}
			if ( s_graphicsoptions.mode.curvalue < 0 )
				s_graphicsoptions.mode.curvalue = 0;
		}
		else
		{
			s_graphicsoptions.mode.curvalue = 3;
		}
	}
	s_graphicsoptions.fs.curvalue = trap_Cvar_VariableValue("r_fullscreen");
	s_graphicsoptions.allow_extensions.curvalue = trap_Cvar_VariableValue("r_allowExtensions");
	s_graphicsoptions.tq.curvalue = 3-trap_Cvar_VariableValue( "r_picmip");
	if ( s_graphicsoptions.tq.curvalue < 0 )
	{
		s_graphicsoptions.tq.curvalue = 0;
	}
	else if ( s_graphicsoptions.tq.curvalue > 3 )
	{
		s_graphicsoptions.tq.curvalue = 3;
	}

	s_graphicsoptions.lighting.curvalue = trap_Cvar_VariableValue( "r_vertexLight" ) != 0;
	switch ( ( int ) trap_Cvar_VariableValue( "r_texturebits" ) )
	{
	default:
	case 0:
		s_graphicsoptions.texturebits.curvalue = 0;
		break;
	case 16:
		s_graphicsoptions.texturebits.curvalue = 1;
		break;
	case 32:
		s_graphicsoptions.texturebits.curvalue = 2;
		break;
	}

	if ( !Q_stricmp( UI_Cvar_VariableString( "r_textureMode" ), "GL_LINEAR_MIPMAP_NEAREST" ) )
	{
		s_graphicsoptions.filter.curvalue = 0;
	}
	else
	{
		s_graphicsoptions.filter.curvalue = 1;
	}

	if ( trap_Cvar_VariableValue( "r_lodBias" ) > 0 )
	{
		if ( trap_Cvar_VariableValue( "r_subdivisions" ) >= 20 )
		{
			s_graphicsoptions.geometry.curvalue = 0;
		}
		else
		{
			s_graphicsoptions.geometry.curvalue = 1;
		}
	}
	else
	{
		s_graphicsoptions.geometry.curvalue = 2;
	}

	switch ( ( int ) trap_Cvar_VariableValue( "r_colorbits" ) )
	{
	default:
	case 0:
		s_graphicsoptions.colordepth.curvalue = 0;
		break;
	case 16:
		s_graphicsoptions.colordepth.curvalue = 1;
		break;
	case 32:
		s_graphicsoptions.colordepth.curvalue = 2;
		break;
	}

	if ( s_graphicsoptions.fs.curvalue == 0 )
	{
		s_graphicsoptions.colordepth.curvalue = 0;
	}
	if ( s_graphicsoptions.driver.curvalue == 1 )
	{
		s_graphicsoptions.colordepth.curvalue = 1;
	}
}
Exemple #25
0
float trap_Cvar_VariableValue( const char *var_name ) {
	char buf[128];

	trap_Cvar_VariableStringBuffer(var_name, buf, sizeof(buf));
	return atof(buf);
}
Exemple #26
0
void CG_DrawInformation(void)
{
    const char *s;
    const char *info;
    const char *sysInfo;
    const char *line;
    int x = 8, y, value, bar = 0;
    qhandle_t levelshot, shadow, clapper;

    //qhandle_t     detail;
    qhandle_t percentBox;
    char buf[1024];

    //qboolean      skipdetail;
    vec4_t color1 = { .75, .75, .75, 1 }, color2 = {
        1, 1, 1, 1
    };

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

    /* Makro - no longer used
       //Makro - settings read from the worldspawn entity
       s = CG_ConfigString( CS_LOADINGSCREEN );
       color1[0] = atof(Info_ValueForKey(s, "r1"));
       color1[1] = atof(Info_ValueForKey(s, "g1"));
       color1[2] = atof(Info_ValueForKey(s, "b1"));
       color2[0] = atof(Info_ValueForKey(s, "r2"));
       color2[1] = atof(Info_ValueForKey(s, "g2"));
       color2[2] = atof(Info_ValueForKey(s, "b2"));
       color1[3] = color2[3] = 1;
       skipdetail = ( atoi(Info_ValueForKey(s, "nodetail")) != 0 );
     */

    s = Info_ValueForKey(info, "mapname");
    shadow = trap_R_RegisterShaderNoMip("ui/assets/rq3-main-shadow-1.tga");
    levelshot = trap_R_RegisterShaderNoMip(va("levelshots/load_%s.tga", s));
    percentBox = trap_R_RegisterShaderNoMip("gfx/percent.tga");
    //Makro - added
    if (!levelshot) {
        levelshot = trap_R_RegisterShaderNoMip(va("levelshots/%s.tga", s));
    }
    if (!levelshot) {
        //Elder: changed
        levelshot = trap_R_RegisterShaderNoMip("levelshots/rq3-unknownmap.tga");
        //skipdetail = qtrue;
    }
    trap_R_SetColor(NULL);
    CG_DrawPic(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, levelshot);

    /* Makro - removed
       // blend a detail texture over it
       //Elder: changed to RQ3 detail overlay
       if (!skipdetail) {
       detail = trap_R_RegisterShader( "rq3-levelShotDetail" );
       trap_R_DrawStretchPic( 0, 0, cgs.glconfig.vidWidth, cgs.glconfig.vidHeight, 0, 0, 2.5, 2, detail );
       }
     */

    //Elder: "Letterbox" mask
    //Makro - changed it a bit
    CG_FillRect(0, 0, SCREEN_WIDTH, LS_TOPMARGIN, colorBlack);
    CG_FillRect(0, LS_TOPMARGIN, SCREEN_WIDTH, 2, colorMdGrey);
    CG_FillRect(0, SCREEN_HEIGHT - LS_BOTTOMMARGIN, SCREEN_WIDTH, LS_BOTTOMMARGIN, colorBlack);
    CG_FillRect(0, SCREEN_HEIGHT - LS_BOTTOMMARGIN - 2, SCREEN_WIDTH, 2, colorMdGrey);
    //Makro - shadow
    CG_DrawPic(0, LS_TOPMARGIN + 2, 640, 12, shadow);

    //Elder: mapname
    //Makro - removed
    //UI_DrawProportionalString(x, 26, s, UI_LEFT|UI_DROPSHADOW, colorDkGrey);
    //CG_DrawBigStringColor(4, 24, s, color_red);

    //Elder: removed
    // draw the icons of things as they are loaded
    //CG_DrawLoadingIcons();

    // draw info string information

    //Elder: Initial y-position
    y = LS_TOPMARGIN - 8 - LS_CHAR_HEIGHT;

    // map-specific message (long map name)
    s = CG_ConfigString(CS_MESSAGE);
    if (s[0]) {
        //Makro - allow color-coded text; also changed to use custom color instead of colorLtGrey
        //CG_DrawSmallStringColor(x, y, s, colorMdGrey);
        //CG_DrawStringExt(x, y, s, colorWhite, qtrue, qfalse, LS_CHAR_WIDTH, LS_CHAR_HEIGHT, 0);
        CG_DrawStringExt(x, y, s, color1, qtrue, qfalse, LS_CHAR_WIDTH, LS_CHAR_HEIGHT, 0);

        y -= (2 * LS_CHAR_HEIGHT);
    }
    //y += LS_CHAR_HEIGHT;
    // game type
    switch (cgs.gametype) {
    case GT_FFA:
        line = "CLASSIC ACTION DEATHMATCH";
        break;
    case GT_SINGLE_PLAYER:
        line = "SINGLE PLAYER";
        break;
    case GT_TOURNAMENT:
        line = "TOURNAMENT";
        break;
    //Makro - added tdmMode
    case GT_TEAM:
        line = (atoi(Info_ValueForKey(info, "g_RQ3_tdmMode")) != 0) ? "TEAM DEATHMATCH (CLASSIC)" : "TEAM DEATHMATCH (TP-STYLE)";
        break;
// JBravo: teamplay stuff.
    case GT_TEAMPLAY:
        //Makro - changed from RQ3 Teamplay
        line = "CLASSIC ACTION TEAMPLAY";
        break;
// JBravo: now knows as CTB
    case GT_CTF:
        line = "CAPTURE THE BRIEFCASE";
        break;
    default:
        line = "UNKNOWN GAMETYPE";
        break;
    }

// JBravo: the call to Q_strupr seems to crash Q3 when running as dll or .so. Attempting a fix
// Makro: the fix crashes Q3 with .dll's, unfixing ;P
    //strcat (line, '\0');
    //line = Q_strupr(line);

    // cheats warning
    s = Info_ValueForKey(sysInfo, "sv_cheats");
    //Makro - didn't like this
    //if ( s[0] == '1' ) {
    if (atoi(s))
        line = va("%s / CHEATS ARE ENABLED", line);

    if (cg_RQ3_matchmode.integer)
        line = va("%s / MATCHMODE", line);
    s = Info_ValueForKey(sysInfo, "sv_pure");
    if (atoi(s) == 0)
        line = va("%s / SV_PURE OFF", line);
    //Makro - custom color; changed from colorWhite
    //CG_DrawSmallStringColor(x, y, line, color2);
    CG_DrawStringExt(x, y, line, color2, qfalse, qfalse, LS_CHAR_WIDTH, LS_CHAR_HEIGHT, 0);
    y -= LS_CHAR_HEIGHT;

    line = "";
    // pure server
    s = Info_ValueForKey(sysInfo, "sv_pure");
    if (atoi(s)) {
        if (line[0])
            line = va("%s / ", line);
        line = va("%sPURE SERVER", line);
    }

    value = atoi(Info_ValueForKey(info, "timelimit"));
    if (value) {
        line = va("TIMELIMIT %i", value);
    }

    if (cgs.gametype <= GT_TEAM) {
        value = atoi(Info_ValueForKey(info, "fraglimit"));
        if (value) {
            if (line[0])
                line = va("%s / ", line);
            line = va("%sFRAGLIMIT %i", line, value);
        }
    } else if (cgs.gametype == GT_TEAMPLAY) {
        value = atoi(Info_ValueForKey(info, "g_RQ3_roundlimit"));
        if (value) {
            if (line[0])
                line = va("%s / ", line);
            line = va("%sROUNDLIMIT %i", line, value);
        }
    } else {
        value = atoi(Info_ValueForKey(info, "capturelimit"));
        if (value) {
            if (line[0])
                line = va("%s / ", line);
            line = va("%sCAPTURELIMIT %i", line, value);
        }
    }

    //Makro - don't write unless there's something to write
    if (line[0]) {
        CG_DrawStringExt(x, y, line, color2, qfalse, qfalse, LS_CHAR_WIDTH, LS_CHAR_HEIGHT, 0);
        y -= LS_CHAR_HEIGHT;
    }

    line = "";
    // don't print server lines if playing a local game
    trap_Cvar_VariableStringBuffer("sv_running", buf, sizeof(buf));
    if (!atoi(buf)) {

        // server hostname
        Q_strncpyz(buf, Info_ValueForKey(info, "sv_hostname"), 1024);
        Q_CleanStr(buf);
        if (buf[0] && Q_stricmp(buf, "noname")) {
            line = va("%s", buf);
        }
        // server-specific message of the day
        s = CG_ConfigString(CS_MOTD);
        if (s[0]) {
            if (line[0])
                line = va("%s / ", line);
            line = va("%s%s", line, s);
        }
        //Makro - don't write unless there's something to write
        if (line[0]) {
            CG_DrawStringExt(x, y, line, color2, qfalse, qfalse, LS_CHAR_WIDTH, LS_CHAR_HEIGHT, 0);
            y -= LS_CHAR_HEIGHT;
        }
    }
    // BOTTOM //

    // the first 150 rows are reserved for the client connection
    // screen to write into
    //y = SCREEN_HEIGHT - (int) (0.5 * (LS_BOTTOMMARGIN + LS_CHAR_HEIGHT));
    y = SCREEN_HEIGHT - LS_BOTTOMMARGIN + 8;
    if (cg.infoScreenText[0]) {
        CG_DrawStringExt(x, y, va("LOADING... %s", Q_strupr(cg.infoScreenText)), color2, qfalse, qfalse,
                         LS_CHAR_WIDTH, LS_CHAR_HEIGHT, 0);
        //UI_DrawProportionalString(SCREEN_WIDTH - 8, y, va("LOADING... %s", Q_strupr(cg.infoScreenText)), UI_RIGHT, colorWhite);
    } else {
        CG_DrawStringExt(x, y, "AWAITING SNAPSHOT...", color2, qfalse, qfalse, LS_CHAR_WIDTH, LS_CHAR_HEIGHT,
                         0);
        //UI_DrawProportionalString(SCREEN_WIDTH - 8, y, "AWAITING SNAPSHOT...", UI_RIGHT, colorWhite);
    }

    //y += 24;
    clapper = trap_R_RegisterShaderNoMip(va("levelshots/clapper_%s.tga", Info_ValueForKey(info, "mapname")));
    if (clapper) {
        y = LS_TOPMARGIN - 8 - LS_CHAR_HEIGHT;
        CG_DrawPic(392, 296, 240, 180, clapper);
    }

    if (percentBox) {
        trap_R_SetColor(colorWhite);
        for (bar = 0; bar < ceil(cg.loadingMapPercent * 10) && bar < 10; bar++) {
            CG_DrawPic(SCREEN_WIDTH - (11 - bar) * 10, y, 8, 8, percentBox);
        }

        trap_R_SetColor(colorDkGrey);
        for (; bar < 10; bar++) {
            CG_DrawPic(SCREEN_WIDTH - (11 - bar) * 10, y, 8, 8, percentBox);
        }
    } else {
        for (bar = 0; bar < ceil(cg.loadingMapPercent * 10) && bar < 10; bar++) {
            CG_FillRect(SCREEN_WIDTH - (11 - bar) * 10, y, 8, 8, colorWhite);
        }

        for (; bar < 10; bar++) {
            CG_FillRect(SCREEN_WIDTH - (11 - bar) * 10, y, 8, 8, colorDkGrey);
        }
    }

}
/*
==================
CG_SetInitialSnapshot

This will only happen on the very first snapshot, or
on tourney restarts.  All other times will use 
CG_TransitionSnapshot instead.

FIXME: Also called by map_restart?
==================
*/
void CG_SetInitialSnapshot( snapshot_t *snap ) {
	int				i;
	centity_t		*cent;
	entityState_t	*state;
	char			buff[16];

	cg.snap = snap;

//	trap_S_ClearSounds( qtrue );

	BG_PlayerStateToEntityState( &snap->ps, &cg_entities[ snap->ps.clientNum ].currentState, qfalse );

	// sort out solid entities
	CG_BuildSolidList();

	CG_ExecuteNewServerCommands( snap->serverCommandSequence );

	// set our local weapon selection pointer to
	// what the server has indicated the current weapon is
	CG_Respawn( qfalse );

	for ( i = 0 ; i < cg.snap->numEntities ; i++ ) {
		state = &cg.snap->entities[ i ];
		cent = &cg_entities[ state->number ];

		memcpy(&cent->currentState, state, sizeof(entityState_t));
		//cent->currentState = *state;
		cent->interpolate = qfalse;
		cent->currentValid = qtrue;

		CG_ResetEntity( cent );

		// check for events
		CG_CheckEvents( cent );
	}

	cg_fxflags = 0;


	trap_Cvar_VariableStringBuffer( "r_oldMode", buff, sizeof(buff) );
	if( atoi(buff) ) {
		// Arnout: confirmation screen
		trap_UI_Popup( UIMENU_INGAME );
	} else if(cg.demoPlayback) {
		ccInitial = qtrue;
	} else {
		static char prevmap[64] = { 0 };
		char curmap[64];

		trap_Cvar_VariableStringBuffer( "mapname", curmap, 64 );

		if ( Q_stricmp( curmap, prevmap ) ) {
			strcpy( prevmap, curmap );
			if(cgs.campaignInfoLoaded) {
				if( !cg.showGameView ) {
					CG_LimboMenu_f();
				}
/*			} else {
				ccInitial = qtrue;

				// Start the Initial Camera if specified
				CG_StartInitialCamera(); */
			}
		}
	}

	// OSP - remove motd window
	if(cg.motdWindow != NULL) {
		CG_windowFree(cg.motdWindow);
		cg.motdWindow = NULL;
	}

	// Activate alternate input handler during demo playback
	if(cg.demoPlayback) {
		CG_keyOn_f();
		if(demo_infoWindow.integer > 0) {
			CG_ShowHelp_On(&cg.demohelpWindow);
		}
	}
	// OSP

#if __MACOS__
#ifdef GAMERANGER
	// LBO 12/13/04. Add support for GameRanger team voice IDs
	GRSetMyTeamID(cg.snap->ps.persistant[PERS_TEAM]);
#endif
#endif
}
Exemple #28
0
/*
==============
BotInitLibrary
==============
*/
int BotInitLibrary( void ) {
	char buf[144];

	//set the maxclients and maxentities library variables before calling BotSetupLibrary
	trap_Cvar_VariableStringBuffer( "sv_maxclients", buf, sizeof( buf ) );
	if ( !strlen( buf ) ) {
		strcpy( buf, "8" );
	}
	trap_BotLibVarSet( "maxclients", buf );
	Com_sprintf( buf, sizeof( buf ), "%d", MAX_GENTITIES );
	trap_BotLibVarSet( "maxentities", buf );
	//bsp checksum
	trap_Cvar_VariableStringBuffer( "sv_mapChecksum", buf, sizeof( buf ) );
	if ( strlen( buf ) ) {
		trap_BotLibVarSet( "sv_mapChecksum", buf );
	}
	//maximum number of aas links
	trap_Cvar_VariableStringBuffer( "max_aaslinks", buf, sizeof( buf ) );
	if ( strlen( buf ) ) {
		trap_BotLibVarSet( "max_aaslinks", buf );
	}
	//maximum number of items in a level
	trap_Cvar_VariableStringBuffer( "max_levelitems", buf, sizeof( buf ) );
	if ( strlen( buf ) ) {
		trap_BotLibVarSet( "max_levelitems", buf );
	}
	//automatically launch WinBSPC if AAS file not available
	trap_Cvar_VariableStringBuffer( "autolaunchbspc", buf, sizeof( buf ) );
	if ( strlen( buf ) ) {
		trap_BotLibVarSet( "autolaunchbspc", "1" );
	}
	//
	trap_Cvar_VariableStringBuffer( "g_gametype", buf, sizeof( buf ) );
	if ( !strlen( buf ) ) {
		strcpy( buf, "0" );
	}
	trap_BotLibVarSet( "g_gametype", buf );
	//
	// Rafael gameskill
	trap_Cvar_VariableStringBuffer( "g_gameskill", buf, sizeof( buf ) );
	if ( !strlen( buf ) ) {
		strcpy( buf, "0" );
	}
	trap_BotLibVarSet( "g_gamekill", buf );
	// done
	//
	trap_Cvar_VariableStringBuffer( "bot_developer", buf, sizeof( buf ) );
	if ( !strlen( buf ) ) {
		strcpy( buf, "0" );
	}
	trap_BotLibVarSet( "bot_developer", buf );
	//log file
	trap_Cvar_VariableStringBuffer( "logfile", buf, sizeof( buf ) );
	if ( !strlen( buf ) ) {
		strcpy( buf, "0" );
	}
	trap_BotLibVarSet( "log", buf );
	//no chatting
	trap_Cvar_VariableStringBuffer( "bot_nochat", buf, sizeof( buf ) );
	if ( strlen( buf ) ) {
		trap_BotLibVarSet( "nochat", buf );
	}
	//forced clustering calculations
	trap_Cvar_VariableStringBuffer( "forceclustering", buf, sizeof( buf ) );
	if ( strlen( buf ) ) {
		trap_BotLibVarSet( "forceclustering", buf );
	}
	//forced reachability calculations
	trap_Cvar_VariableStringBuffer( "forcereachability", buf, sizeof( buf ) );
	if ( strlen( buf ) ) {
		trap_BotLibVarSet( "forcereachability", buf );
	}
	//force writing of AAS to file
	trap_Cvar_VariableStringBuffer( "forcewrite", buf, sizeof( buf ) );
	if ( strlen( buf ) ) {
		trap_BotLibVarSet( "forcewrite", buf );
	}
	//no AAS optimization
	trap_Cvar_VariableStringBuffer( "nooptimize", buf, sizeof( buf ) );
	if ( strlen( buf ) ) {
		trap_BotLibVarSet( "nooptimize", buf );
	}
	//number of reachabilities to calculate each frame
	trap_Cvar_VariableStringBuffer( "framereachability", buf, sizeof( buf ) );
	if ( !strlen( buf ) ) {
		strcpy( buf, "20" );
	}
	trap_BotLibVarSet( "framereachability", buf );
	//
	trap_Cvar_VariableStringBuffer( "bot_reloadcharacters", buf, sizeof( buf ) );
	if ( !strlen( buf ) ) {
		strcpy( buf, "0" );
	}
	trap_BotLibVarSet( "bot_reloadcharacters", buf );
	//base directory
	trap_Cvar_VariableStringBuffer( "fs_basepath", buf, sizeof( buf ) );
	if ( strlen( buf ) ) {
		trap_BotLibVarSet( "basedir", buf );
	}
	//game directory
	trap_Cvar_VariableStringBuffer( "fs_game", buf, sizeof( buf ) );
	if ( strlen( buf ) ) {
		trap_BotLibVarSet( "gamedir", buf );
	}
	//home directory
	trap_Cvar_VariableStringBuffer( "fs_homepath", buf, sizeof( buf ) );
	if ( strlen( buf ) ) {
		trap_BotLibVarSet( "homedir", buf );
	}
	//setup the bot library
	return trap_BotLibSetup();
}
Exemple #29
0
/*
========================
UI_DrawConnectScreen

This will also be overlaid on the cgame info screen during loading
to prevent it from blinking away too rapidly on local or lan games.
========================
*/
void UI_DrawConnectScreen( qboolean overlay ) {
	char			*s;
	uiClientState_t	cstate;
	char			info[MAX_INFO_VALUE];

	Menu_Cache();

	if ( !overlay ) {
		// draw the dialog background
		UI_SetColor( color_white );
		UI_DrawHandlePic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, uis.connecting );
	}

	// see what information we should display
	trap_GetClientState( &cstate );

	info[0] = '\0';
	if( trap_GetConfigString( CS_SERVERINFO, info, sizeof(info) ) ) {
		UI_DrawProportionalString( 320, 16, va( "Loading %s", Info_ValueForKey( info, "mapname" ) ), UI_BIGFONT|UI_CENTER|UI_DROPSHADOW, 1.0, g_color_table[60] );
	}

	UI_DrawProportionalString( 320, 64, va("Connecting to %s", cstate.servername), UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, 0.75, g_color_table[60] );
	//UI_DrawProportionalString( 320, 96, "Press Esc to abort", UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, menu_text_color );

	// display global MOTD at bottom
	UI_DrawProportionalString( SCREEN_WIDTH/2, SCREEN_HEIGHT-32, 
		Info_ValueForKey( cstate.updateInfoString, "motd" ), UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, 0.75, menu_text_color );
	
	// print any server info (server full, bad version, etc)
	if ( cstate.connState < CA_CONNECTED ) {
		UI_DrawProportionalString_AutoWrapped( 320, 192, 630, 20, cstate.messageString, UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, menu_text_color );
		//Here is what prints the ban message!
		//Com_Printf("DBG: %s\n", cstate.messageString);
	}

#if 0
	// display password field
	if ( passwordNeeded ) {
		s_ingame_menu.x = SCREEN_WIDTH * 0.50 - 128;
		s_ingame_menu.nitems = 0;
		s_ingame_menu.wrapAround = qtrue;

		passwordField.generic.type = MTYPE_FIELD;
		passwordField.generic.name = "Password:"******"password"), 
			sizeof(passwordField.field.buffer) );

		Menu_AddItem( &s_ingame_menu, ( void * ) &s_customize_player_action );

		MField_Draw( &passwordField );
	}
#endif

	if ( lastConnState > cstate.connState ) {
		lastLoadingText[0] = '\0';
	}
	lastConnState = cstate.connState;

	switch ( cstate.connState ) {
	case CA_CONNECTING:
		s = va("Awaiting challenge...%i", cstate.connectPacketCount);
		break;
	case CA_CHALLENGING:
		s = va("Awaiting connection...%i", cstate.connectPacketCount);
		break;
	case CA_CONNECTED: {
		char downloadName[MAX_INFO_VALUE];

			trap_Cvar_VariableStringBuffer( "cl_downloadName", downloadName, sizeof(downloadName) );
			if (*downloadName) {
				UI_DisplayDownloadInfo( downloadName );
				return;
			}
		}
		s = "Awaiting gamestate...";
		break;
	case CA_LOADING:
		return;
	case CA_PRIMED:
		return;
	default:
		return;
	}

	UI_DrawProportionalString( 320, 128, s, UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, 0.75, g_color_table[60] );

	// password required / connection rejected information goes here
}
Exemple #30
0
/*
================
CG_DrawBinaryShadersFinalPhases
================
*/
static void CG_DrawBinaryShadersFinalPhases()
{
	float      ss;
	char       str[ 20 ];
	float      f, l, u;
	polyVert_t verts[ 4 ] =
	{
		{ { 0, 0, 0 }, { 0, 0 }, { 255, 255, 255, 255 } },
		{ { 0, 0, 0 }, { 1, 0 }, { 255, 255, 255, 255 } },
		{ { 0, 0, 0 }, { 1, 1 }, { 255, 255, 255, 255 } },
		{ { 0, 0, 0 }, { 0, 1 }, { 255, 255, 255, 255 } }
	};

	if ( !cg.numBinaryShadersUsed )
	{
		return;
	}

	ss = cg_binaryShaderScreenScale.value;

	if ( ss <= 0.0f )
	{
		cg.numBinaryShadersUsed = 0;
		return;
	}
	else if ( ss > 1.0f )
	{
		ss = 1.0f;
	}

	ss = sqrt( ss );

	trap_Cvar_VariableStringBuffer( "r_znear", str, sizeof( str ) );
	f = atof( str ) + 0.01;
	l = f * tan( DEG2RAD( cg.refdef.fov_x / 2 ) ) * ss;
	u = f * tan( DEG2RAD( cg.refdef.fov_y / 2 ) ) * ss;

	VectorMA( cg.refdef.vieworg, f, cg.refdef.viewaxis[ 0 ], verts[ 0 ].xyz );
	VectorMA( verts[ 0 ].xyz, l, cg.refdef.viewaxis[ 1 ], verts[ 0 ].xyz );
	VectorMA( verts[ 0 ].xyz, u, cg.refdef.viewaxis[ 2 ], verts[ 0 ].xyz );
	VectorMA( verts[ 0 ].xyz, -2 * l, cg.refdef.viewaxis[ 1 ], verts[ 1 ].xyz );
	VectorMA( verts[ 1 ].xyz, -2 * u, cg.refdef.viewaxis[ 2 ], verts[ 2 ].xyz );
	VectorMA( verts[ 0 ].xyz, -2 * u, cg.refdef.viewaxis[ 2 ], verts[ 3 ].xyz );

	trap_R_AddPolyToScene( cgs.media.binaryAlpha1Shader, 4, verts );

	for ( int i = 0; i < cg.numBinaryShadersUsed; ++i )
	{
		for ( int j = 0; j < 4; ++j )
		{
			auto alpha = verts[ j ].modulate[ 3 ];
			cg.binaryShaderSettings[ i ].color.ToArray( verts[ j ].modulate );
			verts[ j ].modulate[ 3 ] = alpha;
		}

		if ( cg.binaryShaderSettings[ i ].drawFrontline )
		{
			trap_R_AddPolyToScene( cgs.media.binaryShaders[ i ].f3, 4, verts );
		}

		if ( cg.binaryShaderSettings[ i ].drawIntersection )
		{
			trap_R_AddPolyToScene( cgs.media.binaryShaders[ i ].b3, 4, verts );
		}
	}

	cg.numBinaryShadersUsed = 0;
}