示例#1
0
/*
* Cmd_ChaseCam_f
*/
void Cmd_ChaseCam_f( edict_t *ent )
{
	bool team_only;
	const char *arg1;

	if( ent->s.team != TEAM_SPECTATOR && !ent->r.client->teamstate.is_coach )
	{
		// racesow - changed from G_Teams_JoinTeam( ent, TEAM_SPECTATOR ) as this makes
		// a second G_ChasePlayer call with followmode 0, thereby overriding the chasecam mode set here
		ent->r.client->team = TEAM_SPECTATOR;
		G_ClientRespawn( ent, true );
		// !racesow
		if( !CheckFlood( ent, false )) { // prevent 'joined spectators' spam
			G_PrintMsg( NULL, "%s%s joined the %s%s team.\n", ent->r.client->netname,
				S_COLOR_WHITE, GS_TeamName( ent->s.team ), S_COLOR_WHITE );
		}
	}

	// & 1 = scorelead
	// & 2 = powerups
	// & 4 = objectives
	// & 8 = fragger

	if( ent->r.client->teamstate.is_coach && GS_TeamBasedGametype() )
		team_only = true;
	else 
		team_only = false;

	arg1 = trap_Cmd_Argv( 1 );

	if( trap_Cmd_Argc() < 2 )
	{
		G_ChasePlayer( ent, NULL, team_only, 0 );
	}
	else if( !Q_stricmp( arg1, "auto" ) )
	{
		G_PrintMsg( ent, "Chasecam mode is 'auto'. It will follow the score leader when no powerup nor flag is carried.\n" );
		G_ChasePlayer( ent, NULL, team_only, 7 );
	}
	else if( !Q_stricmp( arg1, "carriers" ) )
	{
		G_PrintMsg( ent, "Chasecam mode is 'carriers'. It will switch to flag or powerup carriers when any of these items is picked up.\n" );
		G_ChasePlayer( ent, NULL, team_only, 6 );
	}
	else if( !Q_stricmp( arg1, "powerups" ) )
	{
		G_PrintMsg( ent, "Chasecam mode is 'powerups'. It will switch to powerup carriers when any of these items is picked up.\n" );
		G_ChasePlayer( ent, NULL, team_only, 2 );
	}
	else if( !Q_stricmp( arg1, "objectives" ) )
	{
		G_PrintMsg( ent, "Chasecam mode is 'objectives'. It will switch to objectives carriers when any of these items is picked up.\n" );
		G_ChasePlayer( ent, NULL, team_only, 4 );
	}
	else if( !Q_stricmp( arg1, "score" ) )
	{
		G_PrintMsg( ent, "Chasecam mode is 'score'. It will always follow the player with the best score.\n" );
		G_ChasePlayer( ent, NULL, team_only, 1 );
	}
	else if( !Q_stricmp( arg1, "fragger" ) )
	{
		G_PrintMsg( ent, "Chasecam mode is 'fragger'. The last fragging player will be followed.\n" );
		G_ChasePlayer( ent, NULL, team_only, 8 );
	}
	else if( !Q_stricmp( arg1, "help" ) )
	{
		G_PrintMsg( ent, "Chasecam modes:\n" );
		G_PrintMsg( ent, "- 'auto': Chase the score leader unless there's an objective carrier or a powerup carrier.\n" );
		G_PrintMsg( ent, "- 'carriers': User has pov control unless there's an objective carrier or a powerup carrier.\n" );
		G_PrintMsg( ent, "- 'objectives': User has pov control unless there's an objective carrier.\n" );
		G_PrintMsg( ent, "- 'powerups': User has pov control unless there's a flag carrier.\n" );
		G_PrintMsg( ent, "- 'score': Always follow the score leader. User has no pov control.\n" );
		G_PrintMsg( ent, "- 'none': Disable chasecam.\n" );
		return;
	}
	else
	{
		G_ChasePlayer( ent, arg1, team_only, 0 );
	}

	G_Teams_LeaveChallengersQueue( ent );
}
示例#2
0
文件: g_cmds.c 项目: j0ki/racesow
/*
* Cmd_Position_f
*/
static void Cmd_Position_f( edict_t *ent )
{
	char *action;

	if( !sv_cheats->integer && GS_MatchState() > MATCH_STATE_WARMUP &&
		ent->r.client->ps.pmove.pm_type != PM_SPECTATOR )
	{
		G_PrintMsg( ent, "Position command is only available in warmup and in spectator mode.\n" );
		return;
	}

	// flood protect
	if( ent->r.client->teamstate.position_lastcmd + 500 > game.realtime )
		return;
	ent->r.client->teamstate.position_lastcmd = game.realtime;

	action = trap_Cmd_Argv( 1 );

	if( !Q_stricmp( action, "save" ) )
	{
		ent->r.client->teamstate.position_saved = qtrue;
		VectorCopy( ent->s.origin, ent->r.client->teamstate.position_origin );
		VectorCopy( ent->s.angles, ent->r.client->teamstate.position_angles );
		G_PrintMsg( ent, "Position saved.\n" );
	}
	else if( !Q_stricmp( action, "load" ) )
	{
		if( !ent->r.client->teamstate.position_saved )
		{
			G_PrintMsg( ent, "No position saved.\n" );
		}
		else
		{
			if( ent->r.client->resp.chase.active )
				G_SpectatorMode( ent );

			if( G_Teleport( ent, ent->r.client->teamstate.position_origin, ent->r.client->teamstate.position_angles ) )
				G_PrintMsg( ent, "Position loaded.\n" );
			else
				G_PrintMsg( ent, "Position not available.\n" );
		}
	}
	else if( !Q_stricmp( action, "set" ) && trap_Cmd_Argc() == 7 )
	{
		vec3_t origin, angles;
		int i, argnumber = 2;

		for( i = 0; i < 3; i++ )
			origin[i] = atof( trap_Cmd_Argv( argnumber++ ) );
		for( i = 0; i < 2; i++ )
			angles[i] = atof( trap_Cmd_Argv( argnumber++ ) );
		angles[2] = 0;

		if( ent->r.client->resp.chase.active )
			G_SpectatorMode( ent );

		if( G_Teleport( ent, origin, angles ) )
			G_PrintMsg( ent, "Position not available.\n" );
		else
			G_PrintMsg( ent, "Position set.\n" );
	}
	else
	{
		char msg[MAX_STRING_CHARS];

		msg[0] = 0;
		Q_strncatz( msg, "Usage:\nposition save - Save current position\n", sizeof( msg ) );
		Q_strncatz( msg, "position load - Teleport to saved position\n", sizeof( msg ) );
		Q_strncatz( msg, "position set <x> <y> <z> <pitch> <yaw> - Teleport to specified position\n", sizeof( msg ) );
		Q_strncatz( msg, va( "Current position: %.4f %.4f %.4f %.4f %.4f\n", ent->s.origin[0], ent->s.origin[1],
			ent->s.origin[2], ent->s.angles[0], ent->s.angles[1] ), sizeof( msg ) );
		G_PrintMsg( ent, msg );
	}
}
示例#3
0
/*
* CG_EditCam_Cmd_f
*/
static void CG_EditCam_Cmd_f( void ) {
	CG_DemoCam_UpdateDemoTime();

	currentcam = CG_Democam_FindCurrent( demo_time );
	if( !currentcam ) {
		CG_Printf( "Editcam: no current cam\n" );
		return;
	}

	if( trap_Cmd_Argc() >= 2 && Q_stricmp( trap_Cmd_Argv( 1 ), "help" ) ) {
		if( !Q_stricmp( trap_Cmd_Argv( 1 ), "type" ) ) {
			int type, i;
			if( trap_Cmd_Argc() < 3 ) { // not enough parameters, print help
				CG_Printf( "Usage: EditCam type <type name>\n" );
				return;
			}

			// type
			type = -1;
			for( i = 0; cam_TypeNames[i] != NULL; i++ ) {
				if( !Q_stricmp( cam_TypeNames[i], trap_Cmd_Argv( 2 ) ) ) {
					type = i;
					break;
				}
			}

			if( type != -1 ) {
				// valid. Register and return
				currentcam->type = type;
				CG_Printf( "cam edited\n" );
				CG_Democam_ExecutePathAnalysis();
				return;
			} else {
				CG_Printf( "invalid type name\n" );
			}
		}
		if( !Q_stricmp( trap_Cmd_Argv( 1 ), "track" ) ) {
			if( trap_Cmd_Argc() < 3 ) {
				// not enough parameters, print help
				CG_Printf( "Usage: EditCam track <entity number> ( 0 for no tracking )\n" );
				return;
			}
			currentcam->trackEnt = atoi( trap_Cmd_Argv( 2 ) );
			CG_Printf( "cam edited\n" );
			CG_Democam_ExecutePathAnalysis();
			return;
		} else if( !Q_stricmp( trap_Cmd_Argv( 1 ), "fov" ) ) {
			if( trap_Cmd_Argc() < 3 ) {
				// not enough parameters, print help
				CG_Printf( "Usage: EditCam fov <value>\n" );
				return;
			}
			currentcam->fov = atoi( trap_Cmd_Argv( 2 ) );
			CG_Printf( "cam edited\n" );
			CG_Democam_ExecutePathAnalysis();
			return;
		} else if( !Q_stricmp( trap_Cmd_Argv( 1 ), "timeOffset" ) ) {
			int64_t newtimestamp;
			if( trap_Cmd_Argc() < 3 ) {
				// not enough parameters, print help
				CG_Printf( "Usage: EditCam timeOffset <value>\n" );
				return;
			}
			newtimestamp = currentcam->timeStamp += atoi( trap_Cmd_Argv( 2 ) );
			if( newtimestamp + cg.time <= demo_initial_timestamp ) {
				newtimestamp = 1;
			}
			currentcam->timeStamp = newtimestamp;
			currentcam = CG_Democam_FindCurrent( demo_time );
			nextcam = CG_Democam_FindNext( demo_time );
			CG_Printf( "cam edited\n" );
			CG_Democam_ExecutePathAnalysis();
			return;
		} else if( !Q_stricmp( trap_Cmd_Argv( 1 ), "origin" ) ) {
			VectorCopy( cg.view.origin, currentcam->origin );
			cam_orbital_radius = 0;
			CG_Printf( "cam edited\n" );
			CG_Democam_ExecutePathAnalysis();
			return;
		} else if( !Q_stricmp( trap_Cmd_Argv( 1 ), "angles" ) ) {
			VectorCopy( cg.view.angles, currentcam->angles );
			CG_Printf( "cam edited\n" );
			CG_Democam_ExecutePathAnalysis();
			return;
		} else if( !Q_stricmp( trap_Cmd_Argv( 1 ), "pitch" ) ) {
			if( trap_Cmd_Argc() < 3 ) {
				// not enough parameters, print help
				CG_Printf( "Usage: EditCam pitch <value>\n" );
				return;
			}
			currentcam->angles[PITCH] = atof( trap_Cmd_Argv( 2 ) );
			CG_Printf( "cam edited\n" );
			CG_Democam_ExecutePathAnalysis();
			return;
		} else if( !Q_stricmp( trap_Cmd_Argv( 1 ), "yaw" ) ) {
			if( trap_Cmd_Argc() < 3 ) {
				// not enough parameters, print help
				CG_Printf( "Usage: EditCam yaw <value>\n" );
				return;
			}
			currentcam->angles[YAW] = atof( trap_Cmd_Argv( 2 ) );
			CG_Printf( "cam edited\n" );
			CG_Democam_ExecutePathAnalysis();
			return;
		} else if( !Q_stricmp( trap_Cmd_Argv( 1 ), "roll" ) ) {
			if( trap_Cmd_Argc() < 3 ) {
				// not enough parameters, print help
				CG_Printf( "Usage: EditCam roll <value>\n" );
				return;
			}
			currentcam->angles[ROLL] = atof( trap_Cmd_Argv( 2 ) );
			CG_Printf( "cam edited\n" );
			CG_Democam_ExecutePathAnalysis();
			return;
		}
	}

	// print help
	CG_Printf( " : Usage: EditCam <command>\n" );
	CG_Printf( " : Available commands:\n" );
	CG_Printf( " : type <type name>\n" );
	CG_Printf( " : track <entity number> ( 0 for no track )\n" );
	CG_Printf( " : fov <value> ( only for not player views )\n" );
	CG_Printf( " : timeOffset <value> ( + or - milliseconds to be added to camera timestamp )\n" );
	CG_Printf( " : origin ( changes cam to current origin )\n" );
	CG_Printf( " : angles ( changes cam to current angles )\n" );
	CG_Printf( " : pitch <value> ( assigns pitch angle to current cam )\n" );
	CG_Printf( " : yaw <value> ( assigns yaw angle to current cam )\n" );
	CG_Printf( " : roll <value> ( assigns roll angle to current cam )\n" );
}
示例#4
0
static void M_Msgbox_Init( void )
{
	int i, j, s;
	int lineend, len;
	int n = 0;
	const char *p;
	menucommon_t *menuitem = NULL;
	char menuitem_name[40];
	char scnd_btn_name[120] = { '\0' }, scnd_btn_action[120] = { '\0' };
	int width = 0, yoffset = 40;

	s_msgbox_menu.nitems = 0;

	mbtext[0] = 0;

	for( i = 1; i < trap_Cmd_Argc(); i++ )
	{
		Q_strncpyz( mbtext, trap_Cmd_Argv(i), sizeof( mbtext ) );
		len = strlen( mbtext );

		// a secret second button
		if( !strncmp( mbtext, "\\btn\\", 5 ) )
		{
			p = strstr( mbtext + 6, "\\" );
			if( p ) {
				mbtext[p - mbtext] = '\0';

				Q_strncpyz( scnd_btn_name, mbtext + 5, sizeof( scnd_btn_name ) );
				Q_strncpyz( scnd_btn_action, p + 1, sizeof( scnd_btn_action ) );
			}

			continue;
		}

		// split the text into lines
		for( s = 0; s <= len; s += j + 1 )
		{
			lineend = min( len - s, M_MSGBOX_LINELEN );

			for( j = lineend; j && mbtext[s+j] && mbtext[s+j] != ' '; j-- );
			if( !j ) j = lineend;

			mbtext[s+j] = '\0';

			Q_snprintfz( menuitem_name, sizeof( menuitem_name ), "m_msgbox_textline_%i", n );
			menuitem = UI_InitMenuItem( menuitem_name, mbtext + s, 0, yoffset, MTYPE_SEPARATOR, ALIGN_CENTER_TOP, uis.fontSystemSmall, NULL );
			Menu_AddItem( &s_msgbox_menu, menuitem );
			yoffset += trap_SCR_strHeight( menuitem->font );

			n++;
		}
	}

	//if we printed something, add one line separation
	if( menuitem )
		yoffset += trap_SCR_strHeight( menuitem->font );

	if( scnd_btn_name[0] && scnd_btn_action[0] )
		width = UI_StringWidth( "close", uis.fontSystemBig );
	else
		width = 0;

	menuitem = UI_InitMenuItem( "m_msgbox_close", "close", -width, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, M_genericBackFunc );
	Menu_AddItem( &s_msgbox_menu, menuitem );

	if( scnd_btn_name[0] && scnd_btn_action[0] )
	{
		UI_SetupButton( menuitem, qtrue );

		menuitem = UI_InitMenuItem( "m_msgbox_connect", scnd_btn_name, width, yoffset, MTYPE_ACTION, ALIGN_CENTER_TOP, uis.fontSystemBig, M_Msgbox_SecondButton );
		menuitem->itemlocal = UI_CopyString( scnd_btn_action );
		Menu_AddItem( &s_msgbox_menu, menuitem );
	}

	yoffset += UI_SetupButton( menuitem, qtrue ) + UI_BUTTONBOX_VERTICAL_SPACE;

	Menu_Center( &s_msgbox_menu );
	Menu_Init( &s_msgbox_menu, qfalse );
	Menu_SetStatusBar( &s_msgbox_menu, NULL );
}
示例#5
0
文件: g_chase.c 项目: Racenet/racesow
/*
* Cmd_ChaseCam_f
*/
void Cmd_ChaseCam_f( edict_t *ent )
{
	qboolean team_only;

	if( ent->s.team != TEAM_SPECTATOR && !ent->r.client->teamstate.is_coach )
	{
		G_Teams_JoinTeam( ent, TEAM_SPECTATOR );
		G_PrintMsg( NULL, "%s%s joined the %s%s team.\n", ent->r.client->netname,
			S_COLOR_WHITE, GS_TeamName( ent->s.team ), S_COLOR_WHITE );
	}

	// & 1 = scorelead
	// & 2 = powerups
	// & 4 = flags

	if( ent->r.client->teamstate.is_coach && GS_TeamBasedGametype() )
		team_only = qtrue;
	else 
		team_only = qfalse;

	if( trap_Cmd_Argc() < 2 )
	{
		G_ChasePlayer( ent, NULL, team_only, 0 );
	}
	else if( !Q_stricmp( trap_Cmd_Argv( 1 ), "auto" ) )
	{
		G_PrintMsg( ent, "Chasecam mode is 'auto'. It will follow the score leader when no powerup nor flag is carried.\n" );
		G_ChasePlayer( ent, NULL, team_only, 7 );
	}
	else if( !Q_stricmp( trap_Cmd_Argv( 1 ), "carriers" ) )
	{
		G_PrintMsg( ent, "Chasecam mode is 'carriers'. It will switch to flag or powerup carriers when any of these items is picked up.\n" );
		G_ChasePlayer( ent, NULL, team_only, 6 );
	}
	else if( !Q_stricmp( trap_Cmd_Argv( 1 ), "powerups" ) )
	{
		G_PrintMsg( ent, "Chasecam mode is 'powerups'. It will switch to powerup carriers when any of these items is picked up.\n" );
		G_ChasePlayer( ent, NULL, team_only, 2 );
	}
	else if( !Q_stricmp( trap_Cmd_Argv( 1 ), "objectives" ) )
	{
		G_PrintMsg( ent, "Chasecam mode is 'objectives'. It will switch to objectives carriers when any of these items is picked up.\n" );
		G_ChasePlayer( ent, NULL, team_only, 4 );
	}
	else if( !Q_stricmp( trap_Cmd_Argv( 1 ), "score" ) )
	{
		G_PrintMsg( ent, "Chasecam mode is 'score'. It will always follow the highest fragger.\n" );
		G_ChasePlayer( ent, NULL, team_only, 1 );
	}
	else if( !Q_stricmp( trap_Cmd_Argv( 1 ), "help" ) )
	{
		G_PrintMsg( ent, "Chasecam modes:\n" );
		G_PrintMsg( ent, "- 'auto': Chase the score leader unless there's an objective carrier or a powerup carrier.\n" );
		G_PrintMsg( ent, "- 'carriers': User has pov control unless there's an objective carrier or a powerup carrier.\n" );
		G_PrintMsg( ent, "- 'objectives': User has pov control unless there's an objective carrier.\n" );
		G_PrintMsg( ent, "- 'powerups': User has pov control unless there's a flag carrier.\n" );
		G_PrintMsg( ent, "- 'score': Always follow the score leader. User has no pov control.\n" );
		G_PrintMsg( ent, "- 'none': Disable chasecam.\n" );
		return;
	}
	else
	{
		G_ChasePlayer( ent, trap_Cmd_Argv( 1 ), team_only, 0 );
	}

	G_Teams_LeaveChallengersQueue( ent );
}
示例#6
0
文件: g_cmds.cpp 项目: DenMSC/qfusion
/*
* Cmd_PlayersExt_f
*/
static void Cmd_PlayersExt_f( edict_t *ent, bool onlyspecs )
{
	int i;
	int count = 0;
	int start = 0;
	char line[64];
	char msg[1024];

	if( trap_Cmd_Argc() > 1 )
		start = atoi( trap_Cmd_Argv( 1 ) );
	clamp( start, 0, gs.maxclients - 1 );

	// print information
	msg[0] = 0;

	for( i = start; i < gs.maxclients; i++ )
	{
		if( trap_GetClientState( i ) >= CS_SPAWNED )
		{
			edict_t *clientEnt = &game.edicts[i+1];
			gclient_t *cl;
			const char *login;

			if( onlyspecs && clientEnt->s.team != TEAM_SPECTATOR )
				continue;

			cl = clientEnt->r.client;

			login = NULL;
			if( cl->mm_session > 0 ) {
				login = Info_ValueForKey( cl->userinfo, "cl_mm_login" );
			}
			if( !login ) {
				login = "";
			}

			Q_snprintfz( line, sizeof( line ), "%3i %s" S_COLOR_WHITE "%s%s%s%s\n", i, cl->netname,
				login[0] ? "(" S_COLOR_YELLOW : "", login, login[0] ? S_COLOR_WHITE ")" : "",
				cl->isoperator ? " op" : "" );

			if( strlen( line ) + strlen( msg ) > sizeof( msg ) - 100 )
			{
				// can't print all of them in one packet
				Q_strncatz( msg, "...\n", sizeof( msg ) );
				break;
			}

			if( count == 0 )
			{
				Q_strncatz( msg, "num name\n", sizeof( msg ) );
				Q_strncatz( msg, "--- ------------------------------\n", sizeof( msg ) );
			}

			Q_strncatz( msg, line, sizeof( msg ) );
			count++;
		}
	}

	if( count )
		Q_strncatz( msg, "--- ------------------------------\n", sizeof( msg ) );
	Q_strncatz( msg, va( "%3i %s\n", count, trap_Cmd_Argv( 0 ) ), sizeof( msg ) );
	G_PrintMsg( ent, "%s", msg );

	if( i < gs.maxclients )
		G_PrintMsg( ent, "Type '%s %i' for more %s\n", trap_Cmd_Argv( 0 ), i, trap_Cmd_Argv( 0 ) );
}
示例#7
0
文件: cg_cmds.c 项目: hettoo/racesow
/*
* CG_SC_CenterPrint
*/
static void CG_SC_CenterPrint( void )
{
	CG_CenterPrint( trap_Cmd_Argv( 1 ) );
}
示例#8
0
文件: cg_cmds.c 项目: hettoo/racesow
/*
* CG_SC_Scoreboard
*/
static void CG_SC_Scoreboard( void )
{
	SCR_UpdateScoreboardMessage( trap_Cmd_Argv( 1 ) );
}
示例#9
0
文件: cg_cmds.c 项目: hettoo/racesow
/*
* CG_SC_AddAward
*/
static void CG_SC_AddAward( void )
{
	CG_AddAward( trap_Cmd_Argv( 1 ) );
}
示例#10
0
文件: cg_cmds.c 项目: hettoo/racesow
/*
* CG_SC_CheckpointsAdd
*
* 1: checkpoint number
* 2: checkpoint time in msec
*
*/
static void CG_SC_CheckpointsAdd( void )
{
	CG_CheckpointsAdd( atoi( trap_Cmd_Argv( 1 ) ), atoi( trap_Cmd_Argv( 2 ) ) );
}
示例#11
0
文件: cg_cmds.c 项目: hettoo/racesow
/*
* CG_SC_AutoRecordAction
*/
void CG_SC_AutoRecordAction( const char *action )
{
	static qboolean autorecording = qfalse;
	const char *name;
	qboolean spectator;

	if( !action[0] )
		return;

	// filter out autorecord commands when playing a demo
	if( cgs.demoPlaying )
		return;

	// let configstrings and other stuff arrive before taking any action
	if( !cgs.precacheDone )
		return;

	if( cg.frame.playerState.pmove.pm_type == PM_SPECTATOR || cg.frame.playerState.pmove.pm_type == PM_CHASECAM )
		spectator = qtrue;
	else
		spectator = qfalse;

	name = CG_SC_AutoRecordName();

	if( !Q_stricmp( action, "start" ) )
	{
		if( cg_autoaction_demo->integer && ( !spectator || cg_autoaction_spectator->integer ) )
		{
			trap_Cmd_ExecuteText( EXEC_NOW, "stop silent" );
			trap_Cmd_ExecuteText( EXEC_NOW, va( "record autorecord/%s/%s silent",
				gs.gametypeName, name ) );
			autorecording = qtrue;
		}
	}
	else if( !Q_stricmp( action, "altstart" ) )
	{
		if( cg_autoaction_demo->integer && ( !spectator || cg_autoaction_spectator->integer ) )
		{
			trap_Cmd_ExecuteText( EXEC_NOW, va( "record autorecord/%s/%s silent",
				gs.gametypeName, name ) );
			autorecording = qtrue;
		}
	}
	else if( !Q_stricmp( action, "stop" ) )
	{
		if( autorecording )
		{
			trap_Cmd_ExecuteText( EXEC_NOW, "stop silent" );
			autorecording = qfalse;
		}

		if( cg_autoaction_screenshot->integer && ( !spectator || cg_autoaction_spectator->integer ) )
		{
			trap_Cmd_ExecuteText( EXEC_NOW, va( "screenshot autorecord/%s/%s silent",
				gs.gametypeName, name ) );
		}
	}
	else if( !Q_stricmp( action, "cancel" ) )
	{
		if( autorecording )
		{
			trap_Cmd_ExecuteText( EXEC_NOW, "stop cancel silent" );
			autorecording = qfalse;
		}
	}
	else if( !Q_stricmp( action, "stats" ) )
	{
		if( cg_autoaction_stats->integer && ( !spectator || cg_autoaction_spectator->integer ) )
		{
			const char *filename = va( "stats/%s/%s.txt", gs.gametypeName, name );
			CG_SC_DumpPlayerStats( filename, trap_Cmd_Argv( 2 ) );
		}
	}
	else if( developer->integer )
	{
		CG_Printf( "CG_SC_AutoRecordAction: Unknown action: %s\n", action );
	}
}
示例#12
0
文件: cg_cmds.c 项目: hettoo/racesow
static void CG_SC_RaceDemoStop( void )
{
	CG_SC_RaceDemo( RS_RACEDEMO_STOP, atoi( trap_Cmd_Argv( 1 ) ) );
}
示例#13
0
文件: cg_cmds.c 项目: hettoo/racesow
/*
* CG_SC_Print
*/
static void CG_SC_Print( void )
{
	CG_LocalPrint( qfalse, "%s", trap_Cmd_Argv( 1 ) );
}
示例#14
0
文件: g_cmds.c 项目: j0ki/racesow
/*
* Cmd_Give_f
* 
* Give items to a client
*/
static void Cmd_Give_f( edict_t *ent )
{
	char *name;
	gsitem_t	*it;
	int i;
	qboolean give_all;

	if( !sv_cheats->integer )
	{
		G_PrintMsg( ent, "Cheats are not enabled on this server.\n" );
		return;
	}

	name = trap_Cmd_Args();

	if( !Q_stricmp( name, "all" ) )
		give_all = qtrue;
	else
		give_all = qfalse;

	if( give_all || !Q_stricmp( trap_Cmd_Argv( 1 ), "health" ) )
	{
		if( trap_Cmd_Argc() == 3 )
			ent->health = atoi( trap_Cmd_Argv( 2 ) );
		else
			ent->health = ent->max_health;
		if( !give_all )
			return;
	}

	if( give_all || !Q_stricmp( name, "weapons" ) )
	{
		for( i = 0; i < GS_MAX_ITEM_TAGS; i++ )
		{
			it = GS_FindItemByTag( i );
			if( !it )
				continue;

			if( !( it->flags & ITFLAG_PICKABLE ) )
				continue;

			if( !( it->type & IT_WEAPON ) )
				continue;

			ent->r.client->ps.inventory[i] += 1;
		}
		if( !give_all )
			return;
	}

	if( give_all || !Q_stricmp( name, "ammo" ) )
	{
		for( i = 0; i < GS_MAX_ITEM_TAGS; i++ )
		{
			it = GS_FindItemByTag( i );
			if( !it )
				continue;

			if( !( it->flags & ITFLAG_PICKABLE ) )
				continue;

			if( !( it->type & IT_AMMO ) )
				continue;

			Add_Ammo( ent->r.client, it, 1000, qtrue );
		}
		if( !give_all )
			return;
	}

	if( give_all || !Q_stricmp( name, "armor" ) )
	{
		ent->r.client->resp.armor = GS_Armor_MaxCountForTag( ARMOR_RA );
		if( !give_all )
			return;
	}

	if( give_all )
	{
		for( i = 0; i < GS_MAX_ITEM_TAGS; i++ )
		{
			it = GS_FindItemByTag( i );
			if( !it )
				continue;

			if( !( it->flags & ITFLAG_PICKABLE ) )
				continue;

			if( it->type & ( IT_ARMOR|IT_WEAPON|IT_AMMO ) )
				continue;

			ent->r.client->ps.inventory[i] = 1;
		}
		return;
	}

	it = GS_FindItemByName( name );
	if( !it )
	{
		name = trap_Cmd_Argv( 1 );
		it = GS_FindItemByName( name );
		if( !it )
		{
			G_PrintMsg( ent, "unknown item\n" );
			return;
		}
	}

	if( !( it->flags & ITFLAG_PICKABLE ) )
	{
		G_PrintMsg( ent, "non-pickup (givable) item\n" );
		return;
	}

	if( it->type & IT_AMMO )
	{
		if( trap_Cmd_Argc() == 3 )
			ent->r.client->ps.inventory[it->tag] = atoi( trap_Cmd_Argv( 2 ) );
		else
			ent->r.client->ps.inventory[it->tag] += it->quantity;
	}
	else
	{
		if( it->tag && ( it->tag > 0 ) && ( it->tag < GS_MAX_ITEM_TAGS ) )
		{
			if( GS_FindItemByTag( it->tag ) != NULL )
				ent->r.client->ps.inventory[it->tag]++;
		}
		else
			G_PrintMsg( ent, "non-pickup (givable) item\n" );
	}
}
示例#15
0
文件: ui_tv.c 项目: Racenet/racesow
void M_Menu_TV_ChannelAdd_f( void )
{
	int num, id;
	char *name, *realname, *address, *gametype, *mapname, *matchname;
	int numplayers, numspecs;
	tv_channel_t *prev, *next, *new_chan;

	if( trap_Cmd_Argc() < 5 )
		return;

	id = atoi( trap_Cmd_Argv( 1 ) );
	name = trap_Cmd_Argv( 2 );
	realname = trap_Cmd_Argv( 3 );
	address = trap_Cmd_Argv( 4 );
	numplayers = atoi( trap_Cmd_Argv( 5 ) );
	numspecs = atoi( trap_Cmd_Argv( 6 ) );
	gametype = trap_Cmd_Argv( 7 );
	mapname = trap_Cmd_Argv( 8 );
	matchname = trap_Cmd_Argv( 9 );
	if( id <= 0 || !name[0] )
		return;

	num = 0;
	prev = NULL;
	next = channels;
	while( next && next->id < id )
	{
		prev = next;
		next = next->next;
		num++;
	}
	if( next && next->id == id )
	{
		new_chan = next;
		next = new_chan->next;
	}
	else
	{
		new_chan = (tv_channel_t *)UI_Malloc( sizeof( tv_channel_t ) );
		if( num < scrollbar_curvalue )
			scrollbar_curvalue++;
	}
	if( prev )
	{
		prev->next = new_chan;
	}
	else
	{
		channels = new_chan;
	}
	new_chan->next = next;
	new_chan->id = id;
	Q_strncpyz( new_chan->name, name, sizeof( new_chan->name ) );
	Q_strncpyz( new_chan->realname, realname, sizeof( new_chan->realname ) );
	Q_strncpyz( new_chan->address, address, sizeof( new_chan->address ) );
	Q_strncpyz( new_chan->gametype, gametype, sizeof( new_chan->gametype ) );
	Q_strncpyz( new_chan->mapname, mapname, sizeof( new_chan->mapname ) );
	Q_strncpyz( new_chan->matchname, matchname, sizeof( new_chan->matchname ) );

	Q_strlwr( new_chan->gametype );
	Q_strlwr( new_chan->mapname );

	new_chan->numplayers = numplayers;
	new_chan->numspecs = numspecs;

	M_RefreshScrollWindowList();
}
示例#16
0
文件: g_cmds.c 项目: j0ki/racesow
/*
* G_vsay_f
*/
static void G_vsay_f( edict_t *ent, qboolean team )
{
	edict_t	*event = NULL;
	g_vsays_t *vsay;
	char *text = NULL;
	char *msg = trap_Cmd_Argv( 1 );

	if( ent->r.client && ent->r.client->muted & 2 )
		return;

	if( ( !GS_TeamBasedGametype() || GS_InvidualGameType() ) && ent->s.team != TEAM_SPECTATOR )
		team = qfalse;

	if( !( ent->r.svflags & SVF_FAKECLIENT ) )
	{                                      // ignore flood checks on bots
		if( ent->r.client->level.last_vsay > game.realtime - 500 )
			return; // ignore silently vsays in that come in rapid succession
		ent->r.client->level.last_vsay = game.realtime;

		if( CheckFlood( ent, qfalse ) )
			return;
	}

	for( vsay = g_vsays; vsay->name; vsay++ )
	{
		if( !Q_stricmp( msg, vsay->name ) )
		{
			event = G_SpawnEvent( EV_VSAY, vsay->id, NULL );
			text = vsay->message;
			break;
		}
	}

	if( event && text )
	{
		char saystring[256];

		event->r.svflags |= SVF_BROADCAST; // force sending even when not in PVS
		event->s.ownerNum = ent->s.number;
		if( team )
		{
			event->s.team = ent->s.team;
			event->r.svflags |= SVF_ONLYTEAM; // send only to clients with the same ->s.team value
		}

		if( trap_Cmd_Argc() > 2 )
		{
			int i;

			saystring[0] = 0;
			for( i = 2; i < trap_Cmd_Argc(); i++ )
			{
				Q_strncatz( saystring, trap_Cmd_Argv( i ), sizeof( saystring ) );
				Q_strncatz( saystring, " ", sizeof( saystring ) );
			}
			text = saystring;
		}

		if( team )
			G_Say_Team( ent, va( "(v) %s", text ), qfalse );
		else
			G_ChatMsg( NULL, ent, qfalse, "(v) %s", text );
		return;
	}

	// unknown token, print help
	{
		char string[MAX_STRING_CHARS];

		// print information
		string[0] = 0;
		if( msg && strlen( msg ) > 0 )
			Q_strncatz( string, va( "%sUnknown vsay token%s \"%s\"\n", S_COLOR_YELLOW, S_COLOR_WHITE, msg ), sizeof( string ) );
		Q_strncatz( string, va( "%svsays:%s\n", S_COLOR_YELLOW, S_COLOR_WHITE ), sizeof( string ) );
		for( vsay = g_vsays; vsay->name; vsay++ )
		{
			if( strlen( vsay->name ) + strlen( string ) < sizeof( string ) - 6 )
			{
				Q_strncatz( string, va( "%s ", vsay->name ), sizeof( string ) );
			}
		}
		Q_strncatz( string, "\n", sizeof( string ) );
		G_PrintMsg( ent, string );
	}
}
示例#17
0
/*
* TVM_Cmd_ChaseCam
*/
void TVM_Cmd_ChaseCam( edict_t *ent )
{
	const char *arg1;

	assert( ent && ent->local && ent->r.client );

	// & 1 = scorelead
	// & 2 = powerups
	// & 4 = objectives
	// & 8 = fragger

	arg1 = trap_Cmd_Argv( 1 );
	if( trap_Cmd_Argc() < 2 )
	{
		TVM_ChasePlayer( ent, NULL, 0 );
	}
	else if( !Q_stricmp( arg1, "auto" ) )
	{
		TVM_PrintMsg( ent->relay, ent, "Chasecam mode is 'auto'. It will follow the score leader when no powerup nor flag is carried.\n" );
		TVM_ChasePlayer( ent, NULL, 7 );
	}
	else if( !Q_stricmp( arg1, "carriers" ) )
	{
		TVM_PrintMsg( ent->relay, ent, "Chasecam mode is 'carriers'. It will switch to flag or powerup carriers when any of these items is picked up.\n" );
		TVM_ChasePlayer( ent, NULL, 6 );
	}
	else if( !Q_stricmp( arg1, "powerups" ) )
	{
		TVM_PrintMsg( ent->relay, ent, "Chasecam mode is 'powerups'. It will switch to powerup carriers when any of these items is picked up.\n" );
		TVM_ChasePlayer( ent, NULL, 2 );
	}
	else if( !Q_stricmp( arg1, "objectives" ) )
	{
		TVM_PrintMsg( ent->relay, ent, "Chasecam mode is 'objectives'. It will switch to flag carriers when any of these items is picked up.\n" );
		TVM_ChasePlayer( ent, NULL, 4 );
	}
	else if( !Q_stricmp( arg1, "score" ) )
	{
		TVM_PrintMsg( ent->relay, ent, "Chasecam mode is 'score'. It will always follow the highest fragger.\n" );
		TVM_ChasePlayer( ent, NULL, 1 );
	}
	else if( !Q_stricmp( arg1, "fragger" ) )
	{
		TVM_PrintMsg( ent->relay, ent, "Chasecam mode is 'fragger'. The last fragging player will be followed.\n" );
		TVM_ChasePlayer( ent, NULL, 8 );
	}
	else if( !Q_stricmp( arg1, "help" ) )
	{
		TVM_PrintMsg( ent->relay, ent, "Chasecam modes:\n" );
		TVM_PrintMsg( ent->relay, ent, "- 'auto': Chase the score leader unless there's an objective carrier or a powerup carrier.\n" );
		TVM_PrintMsg( ent->relay, ent, "- 'carriers': User has pov control unless there's an objective carrier or a powerup carrier.\n" );
		TVM_PrintMsg( ent->relay, ent, "- 'objectives': User has pov control unless there's a objective carrier.\n" );
		TVM_PrintMsg( ent->relay, ent, "- 'powerups': User has pov control unless there's a powerup carrier.\n" );
		TVM_PrintMsg( ent->relay, ent, "- 'score': Always follow the score leader. User has no pov control.\n" );
		TVM_PrintMsg( ent->relay, ent, "- 'none': Disable chasecam.\n" );
	}
	else
	{
		TVM_ChasePlayer( ent, trap_Cmd_Argv( 1 ), 0 );
	}
}