本文整理汇总了C++中ClientBegin函数的典型用法代码示例。如果您正苦于以下问题:C++ ClientBegin函数的具体用法?C++ ClientBegin怎么用?C++ ClientBegin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ClientBegin函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: G_CheckBotSpawn
/*
===============
G_CheckBotSpawn
===============
*/
void G_CheckBotSpawn(void)
{
int n;
char userinfo[MAX_INFO_VALUE];
G_CheckMinimumPlayers();
for(n = 0; n < BOT_SPAWN_QUEUE_DEPTH; n++)
{
if(!botSpawnQueue[n].spawnTime)
{
continue;
}
if(botSpawnQueue[n].spawnTime > level.time)
{
continue;
}
ClientBegin(botSpawnQueue[n].clientNum);
botSpawnQueue[n].spawnTime = 0;
if(g_gametype.integer == GT_SINGLE_PLAYER)
{
trap_GetUserinfo(botSpawnQueue[n].clientNum, userinfo, sizeof(userinfo));
PlayerIntroSound(Info_ValueForKey(userinfo, "model"));
}
}
}
开发者ID:otty,项目名称:cake3,代码行数:32,代码来源:g_bot.c
示例2: G_CheckBotSpawn
/*
===============
G_CheckBotSpawn
===============
*/
void G_CheckBotSpawn( void ) {
int n;
// MJN - added check here
if ( g_mAllowBotLimit.integer ){
M_CheckMinimumBotPlayers();
}
else{
G_CheckMinimumPlayers();
}
for( n = 0; n < BOT_SPAWN_QUEUE_DEPTH; n++ ) {
if( !botSpawnQueue[n].spawnTime ) {
continue;
}
if ( botSpawnQueue[n].spawnTime > level.time ) {
continue;
}
ClientBegin( botSpawnQueue[n].clientNum, qfalse );
botSpawnQueue[n].spawnTime = 0;
/*
if( g_gametype.integer == GT_SINGLE_PLAYER ) {
trap_GetUserinfo( botSpawnQueue[n].clientNum, userinfo, sizeof(userinfo) );
PlayerIntroSound( Info_ValueForKey (userinfo, "model") );
}
*/
}
}
开发者ID:Mattman1153,项目名称:jedi-academy,代码行数:34,代码来源:g_bot.c
示例3: AddBotToSpawnQueue
/*
===============
AddBotToSpawnQueue
===============
*/
static void AddBotToSpawnQueue( int clientNum, int delay ) {
int n;
for( n = 0; n < BOT_SPAWN_QUEUE_DEPTH; n++ ) {
if( !botSpawnQueue[n].spawnTime ) {
botSpawnQueue[n].spawnTime = level.time + delay;
botSpawnQueue[n].clientNum = clientNum;
return;
}
}
G_Printf( S_COLOR_YELLOW "Unable to delay spawn\n" );
ClientBegin( clientNum );
}
开发者ID:OpenArena,项目名称:leixperimental,代码行数:18,代码来源:g_bot.c
示例4: baseq3_qagame_vmMain
int baseq3_qagame_vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11 ) {
#else
int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11 ) {
#endif // IOS
switch ( command ) {
case GAME_INIT:
G_InitGame( arg0, arg1, arg2 );
return 0;
case GAME_SHUTDOWN:
G_ShutdownGame( arg0 );
return 0;
case GAME_CLIENT_CONNECT:
return (int)ClientConnect( arg0, arg1, arg2 );
case GAME_CLIENT_THINK:
ClientThink( arg0 );
return 0;
case GAME_CLIENT_USERINFO_CHANGED:
ClientUserinfoChanged( arg0 );
return 0;
case GAME_CLIENT_DISCONNECT:
ClientDisconnect( arg0 );
return 0;
case GAME_CLIENT_BEGIN:
ClientBegin( arg0 );
return 0;
case GAME_CLIENT_COMMAND:
ClientCommand( arg0 );
return 0;
case GAME_RUN_FRAME:
G_RunFrame( arg0 );
return 0;
case GAME_CONSOLE_COMMAND:
return ConsoleCommand();
case BOTAI_START_FRAME:
return BotAIStartFrame( arg0 );
}
return -1;
}
void QDECL G_Printf( const char *fmt, ... ) {
va_list argptr;
char text[1024];
va_start (argptr, fmt);
vsprintf (text, fmt, argptr);
va_end (argptr);
trap_Printf( text );
}
开发者ID:he110world,项目名称:quake3-ios,代码行数:51,代码来源:g_main.c
示例5: Info_SetValueForKey
//----(SA) modified this for head separation
gentity_t *AICast_AddCastToGame( gentity_t *ent, char *castname, char *model, char *head, char *sex, char *color, char *handicap )
{
int clientNum;
gentity_t *bot;
char userinfo[MAX_INFO_STRING];
usercmd_t cmd;
// create the bot's userinfo
userinfo[0] = '\0';
Info_SetValueForKey( userinfo, "name", castname );
Info_SetValueForKey( userinfo, "rate", "25000" );
Info_SetValueForKey( userinfo, "snaps", "20" );
Info_SetValueForKey( userinfo, "handicap", handicap );
Info_SetValueForKey( userinfo, "model", model );
Info_SetValueForKey( userinfo, "head", head );
Info_SetValueForKey( userinfo, "color", color );
// have the server allocate a client slot
clientNum = trap_BotAllocateClient();
if ( clientNum == -1 ) {
G_Printf( S_COLOR_RED "BotAllocateClient failed\n" );
return NULL;
}
bot = &g_entities[ clientNum ];
bot->r.svFlags |= SVF_BOT;
bot->r.svFlags |= SVF_CASTAI; // flag it for special Cast AI behaviour
// register the userinfo
trap_SetUserinfo( bot->s.number, userinfo );
// have it connect to the game as a normal client
//----(SA) ClientConnect requires a third 'isbot' parameter. setting to qfalse and noting
ClientConnect( bot->s.number, qtrue, qfalse );
//----(SA) end
// copy the origin/angles across
VectorCopy( ent->s.origin, bot->s.origin );
VectorCopy( ent->s.angles, bot->s.angles );
memset( &cmd, 0, sizeof( cmd ) );
ClientBegin( bot->s.number );
// set up the ai
AICast_SetupClient( bot->s.number );
return bot;
}
开发者ID:natelo,项目名称:rtcwPub,代码行数:49,代码来源:ai_cast.c
示例6: G_CheckBotSpawn
/*
===============
G_CheckBotSpawn
===============
*/
void G_CheckBotSpawn( void ) {
int n;
G_CheckMinimumPlayers();
for( n = 0; n < BOT_SPAWN_QUEUE_DEPTH; n++ ) {
if( !botSpawnQueue[n].spawnTime ) {
continue;
}
if ( botSpawnQueue[n].spawnTime > level.time ) {
continue;
}
ClientBegin( botSpawnQueue[n].clientNum );
botSpawnQueue[n].spawnTime = 0;
}
}
开发者ID:eserozvataf,项目名称:q3now,代码行数:21,代码来源:g_bot.c
示例7: SpectatorClientEndFrame
/*
==================
SpectatorClientEndFrame
==================
*/
void SpectatorClientEndFrame( gentity_t *ent ) {
gclient_t *cl;
// if we are doing a chase cam or a remote view, grab the latest info
if ( ent->client->sess.spectatorState == SPECTATOR_FOLLOW ) {
int clientNum, flags;
clientNum = ent->client->sess.spectatorClient;
// team follow1 and team follow2 go to whatever clients are playing
if ( clientNum == -1 ) {
clientNum = level.follow1;
} else if ( clientNum == -2 ) {
clientNum = level.follow2;
}
if ( clientNum >= 0 ) {
cl = &level.clients[ clientNum ];
if ( cl->pers.connected == CON_CONNECTED && cl->sess.sessionTeam != TEAM_SPECTATOR ) {
flags = (cl->ps.eFlags & ~(EF_VOTED | EF_TEAMVOTED)) | (ent->client->ps.eFlags & (EF_VOTED | EF_TEAMVOTED));
ent->client->ps = cl->ps;
ent->client->ps.pm_flags |= PMF_FOLLOW;
ent->client->ps.eFlags = flags;
return;
} else {
// drop them to free spectators unless they are dedicated camera followers
if ( ent->client->sess.spectatorClient >= 0 ) {
ent->client->sess.spectatorState = SPECTATOR_FREE;
ClientBegin( ent->client - level.clients, qtrue );
}
}
}
}
if ( ent->client->sess.spectatorState == SPECTATOR_SCOREBOARD ) {
ent->client->ps.pm_flags |= PMF_SCOREBOARD;
} else {
ent->client->ps.pm_flags &= ~PMF_SCOREBOARD;
}
}
开发者ID:Boothand,项目名称:jk2mp,代码行数:45,代码来源:g_active.c
示例8: G_CheckBotSpawn
/*
===============
G_CheckBotSpawn
===============
*/
void G_CheckBotSpawn( void ) {
int n;
G_CheckMinimumPlayers();
for( n = 0; n < BOT_SPAWN_QUEUE_DEPTH; n++ ) {
if( !botSpawnQueue[n].spawnTime ) {
continue;
}
if ( botSpawnQueue[n].spawnTime > level.time ) {
continue;
}
ClientBegin( botSpawnQueue[n].clientNum, qfalse );
botSpawnQueue[n].spawnTime = 0;
/*
if( level.gametype == GT_SINGLE_PLAYER ) {
trap->GetUserinfo( botSpawnQueue[n].clientNum, userinfo, sizeof(userinfo) );
PlayerIntroSound( Info_ValueForKey (userinfo, "model") );
}
*/
}
}
开发者ID:Rhamill7,项目名称:OpenJK,代码行数:28,代码来源:g_bot.c
示例9: vmMain
/*
================
vmMain
This is the only way control passes into the module.
This must be the very first function compiled into the .q3vm file
================
*/
Q_EXPORT intptr_t vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11 ) {
switch ( command ) {
case GAME_INIT:
G_InitGame( arg0, arg1, arg2 );
return 0;
case GAME_SHUTDOWN:
G_ShutdownGame( arg0 );
return 0;
case GAME_CLIENT_CONNECT:
return (intptr_t)ClientConnect( arg0, arg1, arg2 );
case GAME_CLIENT_THINK:
ClientThink( arg0 );
return 0;
case GAME_CLIENT_USERINFO_CHANGED:
ClientUserinfoChanged( arg0 );
return 0;
case GAME_CLIENT_DISCONNECT:
ClientDisconnect( arg0 );
return 0;
case GAME_CLIENT_BEGIN:
ClientBegin( arg0 );
return 0;
case GAME_CLIENT_COMMAND:
ClientCommand( arg0 );
return 0;
case GAME_RUN_FRAME:
G_RunFrame( arg0 );
return 0;
case GAME_CONSOLE_COMMAND:
return ConsoleCommand();
case BOTAI_START_FRAME:
return BotAIStartFrame( arg0 );
}
return -1;
}
开发者ID:CarlGammaSagan,项目名称:Quake-3-Android-Port-QIII4A,代码行数:44,代码来源:g_main.c
示例10: G_BotAdd
bool G_BotAdd( const char *name, team_t team, int skill, const char *behavior, bool filler )
{
int clientNum;
char userinfo[MAX_INFO_STRING];
const char* s = 0;
gentity_t *bot;
bool autoname = false;
bool okay;
if ( !navMeshLoaded )
{
Log::Warn( "No Navigation Mesh file is available for this map" );
return false;
}
// find what clientNum to use for bot
clientNum = trap_BotAllocateClient();
if ( clientNum < 0 )
{
Log::Warn( "no more slots for bot" );
return false;
}
bot = &g_entities[ clientNum ];
bot->r.svFlags |= SVF_BOT;
bot->inuse = true;
if ( !Q_stricmp( name, BOT_NAME_FROM_LIST ) )
{
name = G_BotSelectName( team );
autoname = name != nullptr;
}
//default bot data
okay = G_BotSetDefaults( clientNum, team, skill, behavior );
// register user information
userinfo[0] = '\0';
Info_SetValueForKey( userinfo, "name", name ? name : "", false ); // allow defaulting
Info_SetValueForKey( userinfo, "rate", "25000", false );
Info_SetValueForKey( userinfo, "snaps", "20", false );
if ( autoname )
{
Info_SetValueForKey( userinfo, "autoname", name, false );
}
//so we can connect if server is password protected
if ( g_needpass.integer == 1 )
{
Info_SetValueForKey( userinfo, "password", g_password.string, false );
}
trap_SetUserinfo( clientNum, userinfo );
// have it connect to the game as a normal client
if ( ( s = ClientBotConnect( clientNum, true, team ) ) )
{
// won't let us join
Log::Warn( s );
okay = false;
}
if ( !okay )
{
G_BotDel( clientNum );
return false;
}
if ( autoname )
{
G_BotNameUsed( team, name, true );
}
ClientBegin( clientNum );
bot->pain = BotPain; // ClientBegin resets the pain function
level.clients[clientNum].pers.isFillerBot = filler;
G_ChangeTeam( bot, team );
return true;
}
开发者ID:t4im,项目名称:Unvanquished,代码行数:79,代码来源:sg_bot.cpp
示例11: SpectatorClientEndFrame
/*
==================
SpectatorClientEndFrame
==================
*/
void SpectatorClientEndFrame(gentity_t *ent) {
// OSP - specs periodically get score updates for useful demo playback info
// if we are doing a chase cam or a remote view, grab the latest info
if ((ent->client->sess.spectatorState == SPECTATOR_FOLLOW) || (ent->client->ps.pm_flags & PMF_LIMBO)) {
int clientNum;
gclient_t *cl;
if (ent->client->sess.sessionTeam == TEAM_AXIS || ent->client->sess.sessionTeam == TEAM_ALLIES) {
reinforce(ent);
return;
}
// Limbos aren't following while in MV
if (ent->client->ps.pm_flags & PMF_LIMBO) {
return;
}
clientNum = ent->client->sess.spectatorClient;
// team follow1 and team follow2 go to whatever clients are playing
if (clientNum == -1) {
clientNum = level.follow1;
} else if (clientNum == -2) {
clientNum = level.follow2;
}
if (clientNum >= 0) {
cl = &level.clients[clientNum];
if (cl->pers.connected == CON_CONNECTED && cl->sess.sessionTeam != TEAM_SPECTATOR) {
int flags = (cl->ps.eFlags & ~(EF_VOTED)) | (ent->client->ps.eFlags & (EF_VOTED));
int ping = ent->client->ps.ping;
if (ent->client->sess.sessionTeam != TEAM_SPECTATOR && (ent->client->ps.pm_flags & PMF_LIMBO)) {
int savedScore = ent->client->ps.persistant[PERS_SCORE];
int savedClass = ent->client->ps.stats[STAT_PLAYER_CLASS];
ent->client->ps = cl->ps;
ent->client->ps.pm_flags |= PMF_FOLLOW;
ent->client->ps.pm_flags |= PMF_LIMBO;
ent->client->ps.persistant[PERS_SCORE] = savedScore; // put score back
ent->client->ps.stats[STAT_PLAYER_CLASS] = savedClass; // NERVE - SMF - put player class back
} else {
ent->client->ps = cl->ps;
ent->client->ps.pm_flags |= PMF_FOLLOW;
}
// DHM - Nerve :: carry flags over
ent->client->ps.eFlags = flags;
ent->client->ps.ping = ping;
return;
}
// drop them to free spectators unless they are dedicated camera followers
if (ent->client->sess.spectatorClient >= 0) {
ent->client->sess.spectatorState = SPECTATOR_FREE;
ClientBegin(ent->client - level.clients);
}
}
}
}
开发者ID:ETrun,项目名称:ETrun,代码行数:67,代码来源:g_active.c
示例12: G_AddBot
//.........这里部分代码省略.........
char *botinfo;
char *key;
char *s;
char *botname;
char *model;
char userinfo[MAX_INFO_STRING];
// have the server allocate a client slot
clientNum = trap_BotAllocateClient();
if ( clientNum == -1 ) {
G_Printf( S_COLOR_RED "Unable to add bot. All player slots are in use.\n" );
G_Printf( S_COLOR_RED "Start server with more 'open' slots (or check setting of sv_maxclients cvar).\n" );
return;
}
// get the botinfo from bots.txt
botinfo = G_GetBotInfoByName( name );
if ( !botinfo ) {
G_Printf( S_COLOR_RED "Error: Bot '%s' not defined\n", name );
trap_BotFreeClient( clientNum );
return;
}
// create the bot's userinfo
userinfo[0] = '\0';
botname = Info_ValueForKey( botinfo, "funname" );
if ( !botname[0] ) {
botname = Info_ValueForKey( botinfo, "name" );
}
Info_SetValueForKey( userinfo, "name", botname );
Info_SetValueForKey( userinfo, "rate", "25000" );
Info_SetValueForKey( userinfo, "snaps", "20" );
Info_SetValueForKey( userinfo, "skill", va("%.2f", skill) );
if ( skill == 1 ) {
Info_SetValueForKey( userinfo, "handicap", "50" );
} else if ( skill == 2 ) {
Info_SetValueForKey( userinfo, "handicap", "70" );
} else if ( skill == 3 ) {
Info_SetValueForKey( userinfo, "handicap", "90" );
}
key = "model";
model = Info_ValueForKey( botinfo, key );
if ( !*model ) {
model = "visor/default";
}
Info_SetValueForKey( userinfo, key, model );
key = "gender";
s = Info_ValueForKey( botinfo, key );
if ( !*s ) {
s = "male";
}
Info_SetValueForKey( userinfo, "sex", s );
key = "color";
s = Info_ValueForKey( botinfo, key );
if ( !*s ) {
s = "4";
}
Info_SetValueForKey( userinfo, key, s );
s = Info_ValueForKey( botinfo, "aifile" );
if ( !*s ) {
trap_Print( S_COLOR_RED "Error: bot has no aifile specified\n" );
trap_BotFreeClient( clientNum );
return;
}
Info_SetValueForKey( userinfo, "characterfile", s );
if ( !team || !*team ) {
if ( g_gametype.integer == GT_TEAM || g_gametype.integer == GT_CTF ) {
if ( PickTeam( clientNum ) == TEAM_RED ) {
team = "red";
} else {
team = "blue";
}
} else {
team = "red";
}
}
Info_SetValueForKey( userinfo, "team", team );
// register the userinfo
trap_SetUserinfo( clientNum, userinfo );
// have it connect to the game as a normal client
if ( ClientConnect( clientNum, qtrue, qtrue ) ) {
return;
}
if ( delay == 0 ) {
ClientBegin( clientNum );
return;
}
AddBotToSpawnQueue( clientNum, delay );
}
开发者ID:MAN-AT-ARMS,项目名称:iortcw-archive,代码行数:101,代码来源:g_bot.c
示例13: G_AddBot
//.........这里部分代码省略.........
// Elder: changed to our default
model = "reactionmale/default";
}
Info_SetValueForKey(userinfo, "model", model);
Info_SetValueForKey(userinfo, "team_model", model);
headmodel = Info_ValueForKey(botinfo, "headmodel");
if (!*headmodel) {
headmodel = model;
}
Info_SetValueForKey(userinfo, "headmodel", headmodel);
Info_SetValueForKey(userinfo, "team_headmodel", headmodel);
s = Info_ValueForKey(botinfo, "gender");
if (!*s) {
s = "male";
}
Info_SetValueForKey(userinfo, "sex", s);
s = Info_ValueForKey(botinfo, "color1");
if (!*s) {
s = "4";
}
Info_SetValueForKey(userinfo, "color1", s);
s = Info_ValueForKey(botinfo, "color2");
if (!*s) {
s = "5";
}
Info_SetValueForKey(userinfo, "color2", s);
s = Info_ValueForKey(botinfo, "aifile");
if (!*s) {
trap_Printf(S_COLOR_RED "Error: bot has no aifile specified\n");
return;
}
// have the server allocate a client slot
clientNum = trap_BotAllocateClient();
if (clientNum == -1) {
G_Printf(S_COLOR_RED "Unable to add bot. All player slots are in use.\n");
G_Printf(S_COLOR_RED "Start server with more 'open' slots (or check setting of sv_maxclients cvar).\n");
return;
}
// initialize the bot settings
if (!team || !*team) {
if (g_gametype.integer >= GT_TEAM) {
if (PickTeam(clientNum) == TEAM_RED) {
team = "red";
} else {
team = "blue";
}
} else {
team = "red";
}
}
Info_SetValueForKey(userinfo, "characterfile", Info_ValueForKey(botinfo, "aifile"));
Info_SetValueForKey(userinfo, "skill", va("%5.2f", skill));
Info_SetValueForKey(userinfo, "team", team);
if (g_gametype.integer == GT_TEAMPLAY) {
//Makro - load custom weapon/item from bot file
tpWeapon = CharToWeapon(Info_ValueForKey(botinfo, "weapon"), WP_M4);
tpItem = CharToItem(Info_ValueForKey(botinfo, "item"), HI_LASER);
}
Info_SetValueForKey(userinfo, "tpw", va("%i", tpWeapon - WP_NONE));
Info_SetValueForKey(userinfo, "tpi", va("%i", tpItem - HI_NONE));
bot = &g_entities[clientNum];
bot->r.svFlags |= SVF_BOT;
bot->inuse = qtrue;
// register the userinfo
trap_SetUserinfo(clientNum, userinfo);
// have it connect to the game as a normal client
if (ClientConnect(clientNum, qtrue, qtrue)) {
return;
}
if (delay == 0) {
ClientBegin(clientNum);
//Makro - load custom weapon/item from bot file
if (g_gametype.integer == GT_TEAMPLAY) {
bot->client->teamplayWeapon = tpWeapon;
bot->client->teamplayItem = tpItem;
}
return;
}
AddBotToSpawnQueue(clientNum, delay);
//Makro - load custom weapon/item from bot file
if (g_gametype.integer == GT_TEAMPLAY) {
bot->client->teamplayWeapon = tpWeapon;
bot->client->teamplayItem = tpItem;
}
}
开发者ID:titityy,项目名称:reaction,代码行数:101,代码来源:g_bot.c
示例14: G_AddBot
//.........这里部分代码省略.........
if ( color ) {
if ( strrchr( model, '/' ) ) {
// model is a skin already, append colorname to skin
// fatpad/fatty _red
model = va( "%s_%s", model, color );
}
else {
// model is a "basemodel", append skin
// fatpad /red
model = va( "%s/%s", model, color );
}
}
}
}
Info_SetValueForKey( userinfo, key, model );
key = "team_model";
Info_SetValueForKey( userinfo, key, model );
key = "headmodel";
headmodel = Info_ValueForKey( botinfo, key );
if ( !*headmodel ) {
headmodel = model;
}
Info_SetValueForKey( userinfo, key, headmodel );
key = "team_headmodel";
Info_SetValueForKey( userinfo, key, headmodel );
key = "gender";
s = Info_ValueForKey( botinfo, key );
if ( !*s ) {
s = "male";
}
Info_SetValueForKey( userinfo, "sex", s );
key = "color1";
s = Info_ValueForKey( botinfo, key );
if ( !*s ) {
s = "4";
}
Info_SetValueForKey( userinfo, key, s );
key = "color2";
s = Info_ValueForKey( botinfo, key );
if ( !*s ) {
s = "5";
}
Info_SetValueForKey( userinfo, key, s );
s = Info_ValueForKey(botinfo, "aifile");
if (!*s ) {
trap_Printf( S_COLOR_RED "Error: bot has no aifile specified\n" );
return;
}
// have the server allocate a client slot
clientNum = trap_BotAllocateClient();
if ( clientNum == -1 ) {
G_Printf( S_COLOR_RED "Unable to add bot. All player slots are in use.\n" );
G_Printf( S_COLOR_RED "Start server with more 'open' slots (or check setting of sv_maxclients cvar).\n" );
return;
}
// initialize the bot settings
if( !team || !*team ) {
if( g_gametype.integer >= GT_TEAM ) {
if( PickTeam(clientNum) == TEAM_RED) {
team = "red";
}
else {
team = "blue";
}
}
else {
team = "red";
}
}
Info_SetValueForKey( userinfo, "characterfile", Info_ValueForKey( botinfo, "aifile" ) );
Info_SetValueForKey( userinfo, "skill", va( "%5.2f", skill ) );
Info_SetValueForKey( userinfo, "team", team );
bot = &g_entities[ clientNum ];
bot->r.svFlags |= SVF_BOT;
bot->inuse = qtrue;
// register the userinfo
trap_SetUserinfo( clientNum, userinfo );
// have it connect to the game as a normal client
if ( ClientConnect( clientNum, qtrue, qtrue ) ) {
return;
}
if( delay == 0 ) {
ClientBegin( clientNum );
return;
}
AddBotToSpawnQueue( clientNum, delay );
}
开发者ID:PadWorld-Entertainment,项目名称:wop-gamesource,代码行数:101,代码来源:g_bot.c
示例15: G_AddBot
//.........这里部分代码省略.........
{
if (team && Q_stricmp(team, "red") == 0)
{
bot->client->sess.sessionTeam = TEAM_RED;
}
else if (team && Q_stricmp(team, "blue") == 0)
{
bot->client->sess.sessionTeam = TEAM_BLUE;
}
else
{
bot->client->sess.sessionTeam = PickTeam( -1 );
}
}
if (g_gametype.integer == GT_SIEGE)
{
bot->client->sess.siegeDesiredTeam = bot->client->sess.sessionTeam;
bot->client->sess.sessionTeam = TEAM_SPECTATOR;
}
preTeam = bot->client->sess.sessionTeam;
// have it connect to the game as a normal client
if ( ClientConnect( clientNum, qtrue, qtrue ) ) {
return;
}
if (bot->client->sess.sessionTeam != preTeam)
{
trap_GetUserinfo(clientNum, userinfo, MAX_INFO_STRING);
if (bot->client->sess.sessionTeam == TEAM_SPECTATOR)
{
bot->client->sess.sessionTeam = preTeam;
}
if (bot->client->sess.sessionTeam == TEAM_RED)
{
team = "Red";
}
else
{
if (g_gametype.integer == GT_SIEGE)
{
if (bot->client->sess.sessionTeam == TEAM_BLUE)
{
team = "Blue";
}
else
{
team = "s";
}
}
else
{
team = "Blue";
}
}
Info_SetValueForKey( userinfo, "team", team );
trap_SetUserinfo( clientNum, userinfo );
bot->client->ps.persistant[ PERS_TEAM ] = bot->client->sess.sessionTeam;
G_ReadSessionData( bot->client );
ClientUserinfoChanged( clientNum );
}
if (g_gametype.integer == GT_DUEL ||
g_gametype.integer == GT_POWERDUEL)
{
int loners = 0;
int doubles = 0;
bot->client->sess.duelTeam = 0;
G_PowerDuelCount(&loners, &doubles, qtrue);
if (!doubles || loners > (doubles/2))
{
bot->client->sess.duelTeam = DUELTEAM_DOUBLE;
}
else
{
bot->client->sess.duelTeam = DUELTEAM_LONE;
}
bot->client->sess.sessionTeam = TEAM_SPECTATOR;
SetTeam(bot, "s");
}
else
{
if( delay == 0 ) {
ClientBegin( clientNum, qfalse );
return;
}
AddBotToSpawnQueue( clientNum, delay );
}
}
开发者ID:Mattman1153,项目名称:jedi-academy,代码行数:101,代码来源:g_bot.c
示例16: SpectatorClientEndFrame
/*
==================
SpectatorClientEndFrame
==================
*/
void SpectatorClientEndFrame(gentity_t * ent)
{
gclient_t *cl;
int savedPing, savedFlags, i;
int savedPers[MAX_PERSISTANT];
// if we are doing a chase cam or a remote view, grab the latest info
if (ent->client->sess.spectatorState == SPECTATOR_FOLLOW) {
int clientNum, flags;
clientNum = ent->client->sess.spectatorClient;
// team follow1 and team follow2 go to whatever clients are playing
if (clientNum == -1) {
clientNum = level.follow1;
} else if (clientNum == -2) {
clientNum = level.follow2;
}
if (clientNum >= 0) {
cl = &level.clients[clientNum];
if (cl->pers.connected == CON_CONNECTED && cl->sess.sessionTeam != TEAM_SPECTATOR) {
flags =
(cl->ps.eFlags & ~(EF_VOTED | EF_TEAMVOTED)) | (ent->client->ps.
eFlags & (EF_VOTED | EF_TEAMVOTED));
// JBravo: saving score and ping to fix the scoreboard
savedPing = ent->client->ps.ping;
//Slicer saving pm_flags & pers
savedFlags = ent->client->ps.pm_flags;
for (i = 0; i < MAX_PERSISTANT; i++)
savedPers[i] = ent->client->ps.persistant[i];
//This will make the spectator get the client's stuff
ent->client->ps = cl->ps;
//Reposting score and ping..
if (g_gametype.integer >= GT_TEAM) {
for (i = 0; i < MAX_PERSISTANT; i++)
ent->client->ps.persistant[i] = savedPers[i];
ent->client->ps.ping = savedPing;
//Slicer reposting pmflags
ent->client->ps.pm_flags = savedFlags;
}
ent->client->ps.pm_flags |= PMF_FOLLOW;
ent->client->ps.eFlags = flags;
return;
} else {
// drop them to free spectators unless they are dedicated camera followers
if (ent->client->sess.spectatorClient >= 0) {
ent->client->sess.spectatorState = SPECTATOR_FREE;
// JBravo: saving spectatorState
ent->client->specMode = SPECTATOR_FREE;
ClientBegin(ent->client - level.clients);
}
}
}
}
if (ent->client->sess.spectatorState == SPECTATOR_SCOREBOARD) {
ent->client->ps.pm_flags |= PMF_SCOREBOARD;
} else {
ent->client->ps.pm_flags &= ~PMF_SCOREBOARD;
}
}
开发者ID:Zekom,项目名称:reaction,代码行数:68,代码来源:g_active.c
示例17: G_AddBot
//.........这里部分代码省略.........
if ( !team || !*team ) {
if ( level.gametype >= GT_TEAM ) {
if ( PickTeam( clientNum ) == TEAM_RED)
team = "red";
else
team = "blue";
}
else
team = "red";
}
Info_SetValueForKey( userinfo, "team", team );
bot = &g_entities[ clientNum ];
// bot->r.svFlags |= SVF_BOT;
// bot->inuse = qtrue;
// register the userinfo
trap->SetUserinfo( clientNum, userinfo );
if ( level.gametype >= GT_TEAM )
{
if ( team && !Q_stricmp( team, "red" ) )
bot->client->sess.sessionTeam = TEAM_RED;
else if ( team && !Q_stricmp( team, "blue" ) )
bot->client->sess.sessionTeam = TEAM_BLUE;
else
bot->client->sess.sessionTeam = PickTeam( -1 );
}
if ( level.gametype == GT_SIEGE )
{
bot->client->sess.siegeDesiredTeam = bot->client->sess.sessionTeam;
bot->client->sess.sessionTeam = TEAM_SPECTATOR;
}
preTeam = bot->client->sess.sessionTeam;
// have it connect to the game as a normal client
if ( ClientConnect( clientNum, qtrue, qtrue ) )
return;
if ( bot->client->sess.sessionTeam != preTeam )
{
trap->GetUserinfo( clientNum, userinfo, sizeof( userinfo ) );
if ( bot->client->sess.sessionTeam == TEAM_SPECTATOR )
bot->client->sess.sessionTeam = preTeam;
if ( bot->client->sess.sessionTeam == TEAM_RED )
team = "Red";
else
{
if ( level.gametype == GT_SIEGE )
team = (bot->client->sess.sessionTeam == TEAM_BLUE) ? "Blue" : "s";
else
team = "Blue";
}
Info_SetValueForKey( userinfo, "team", team );
trap->SetUserinfo( clientNum, userinfo );
bot->client->ps.persistant[ PERS_TEAM ] = bot->client->sess.sessionTeam;
G_ReadSessionData( bot->client );
if ( !ClientUserinfoChanged( clientNum ) )
return;
}
if (level.gametype == GT_DUEL ||
level.gametype == GT_POWERDUEL)
{
int loners = 0;
int doubles = 0;
bot->client->sess.duelTeam = 0;
G_PowerDuelCount(&loners, &doubles, qtrue);
if (!doubles || loners > (doubles/2))
{
bot->client->sess.duelTeam = DUELTEAM_DOUBLE;
}
else
{
bot->client->sess.duelTeam = DUELTEAM_LONE;
}
bot->client->sess.sessionTeam = TEAM_SPECTATOR;
SetTeam(bot, "s");
}
else
{
if( delay == 0 ) {
ClientBegin( clientNum, qfalse );
return;
}
AddBotToSpawnQueue( clientNum, delay );
}
}
开发者ID:Rhamill7,项目名称:OpenJK,代码行数:101,代码来源:g_bot.c
示例18: SpectatorClientEndFrame
/*
==================
SpectatorClientEndFrame
==================
*/
void SpectatorClientEndFrame( gentity_t *ent ) {
gclient_t *cl;
int do_respawn = 0; // JPW NERVE
int savedScore; // DHM - Nerve
int savedRespawns; // DHM - Nerve
int savedClass; // NERVE - SMF
int flags;
int testtime;
// if we are doing a chase cam or a remote view, grab the latest info
if ( ( ent->client->sess.spectatorState == SPECTATOR_FOLLOW ) || ( ent->client->ps.pm_flags & PMF_LIMBO ) ) { // JPW NERVE for limbo
int clientNum;
if ( ent->client->sess.sessionTeam == TEAM_RED ) {
testtime = level.time % g_redlimbotime.integer;
if ( testtime < ent->client->pers.lastReinforceTime ) {
do_respawn = 1;
}
ent->client->pers.lastReinforceTime = testtime;
} else if ( ent->client->sess.sessionTeam == TEAM_BLUE ) {
testtime = level.time % g_bluelimbotime.integer;
if ( testtime < ent->client->pers.lastReinforceTime ) {
do_respawn = 1;
}
ent->client->pers.lastReinforceTime = testtime;
}
if ( ( g_maxlives.integer > 0 || g_alliedmaxlives.integer > 0 || g_axismaxlives.integer > 0 ) && ent->client->ps.persistant[PERS_RESPAWNS_LEFT] == 0 ) {
do_respawn = 0;
}
if ( do_respawn ) {
reinforce( ent );
return;
}
clientNum = ent->client->sess.spectatorClient;
// team follow1 and team follow2 go to whatever clients are playing
if ( clientNum == -1 ) {
clientNum = level.follow1;
} else if ( clientNum == -2 ) {
clientNum = level.follow2;
}
if ( clientNum >= 0 ) {
cl = &level.clients[ clientNum ];
if ( cl->pers.connected == CON_CONNECTED && cl->sess.sessionTeam != TEAM_SPECTATOR ) {
// DHM - Nerve :: carry flags over
flags = ( cl->ps.eFlags & ~( EF_VOTED ) ) | ( ent->client->ps.eFlags & ( EF_VOTED ) );
// JPW NERVE -- limbo latch
if ( ent->client->sess.sessionTeam != TEAM_SPECTATOR && ent->client->ps.pm_flags & PMF_LIMBO ) {
// abuse do_respawn var
savedScore = ent->client->ps.persistant[PERS_SCORE];
do_respawn = ent->client->ps.pm_time;
savedRespawns = ent->client->ps.persistant[PERS_RESPAWNS_LEFT];
savedClass = ent->client->ps.stats[STAT_PLAYER_CLASS];
ent->client->ps = cl->ps;
ent->client->ps.pm_flags |= PMF_FOLLOW;
ent->client->ps.pm_flags |= PMF_LIMBO;
ent->client->ps.persistant[PERS_RESPAWNS_LEFT] = savedRespawns;
ent->client->ps.pm_time = do_respawn; // put pm_time back
ent->client->ps.persistant[PERS_SCORE] = savedScore; // put score back
ent->client->ps.stats[STAT_PLAYER_CLASS] = savedClass; // NERVE - SMF - put player class back
} else {
ent->client->ps = cl->ps;
ent->client->ps.pm_flags |= PMF_FOLLOW;
}
// jpw
// DHM - Nerve :: carry flags over
ent->client->ps.eFlags = flags;
return;
} else {
// drop them to free spectators unless they are dedicated camera followers
if ( ent->client->sess.spectatorClient >= 0 ) {
ent->client->sess.spectatorState = SPECTATOR_FREE;
ClientBegin( ent->client - level.clients );
}
}
}
}
if ( ent->client->sess.spectatorState == SPECTATOR_SCOREBOARD ) {
ent->client->ps.pm_flags |= PMF_SCOREBOARD;
} else {
ent->client->ps.pm_flags &= ~PMF_SCOREBOARD;
}
}
开发者ID:chegestar,项目名称:omni-bot,代码行数:95,代码来源:g_active.c
示例19: SetTeam
//.........这里部分代码省略.........
// see what change is requested
clientNum = ARRAY_INDEX( level.clients, client );
if ( !Q_stricmp( s, "scoreboard" ) || !Q_stricmp( s, "score" ) ) {
team = TEAM_SPECTATOR;
specState = SPECTATOR_SCOREBOARD;
}
else if ( !Q_stricmp( s, "follow1" ) ) {
team = TEAM_SPECTATOR;
specState = SPECTATOR_FOLLOW;
specClient = -1;
}
else if ( !Q_stricmp( s, "follow2" ) ) {
team = TEAM_SPECTATOR;
specState = SPECTATOR_FOLLOW;
specClient = -2;
}
else if ( !Q_stricmp( s, "spectator" ) || !Q_stricmp( s, "s" ) ) {
team = TEAM_SPECTATOR;
specState = SPECTATOR_FREE;
}
// if running a team game, assign player to one of the teams
else if ( level.gametype >= GT_TEAMBLOOD ) {
specState = SPECTATOR_NOT;
if ( !Q_stricmp( s, "red" ) || !Q_stricmp( s, "r" ) )
team = TEAM_RED;
else if ( !Q_stricmp( s, "blue" ) || !Q_stricmp( s, "b" ) )
team = TEAM_BLUE;
else
team = PickTeam( clientNum ); // pick the team with the least number of players
if ( g_teamForceBalance->integer ) {
int counts[TEAM_NUM_TEAMS];
counts[TEAM_BLUE] = TeamCount( clientNum, TEAM_BLUE );
counts[TEAM_RED] = TeamCount( clientNum, TEAM_RED );
// We allow a spread of two
if ( team == TEAM_RED && counts[TEAM_RED] - counts[TEAM_BLUE] > 1 ) {
trap->SV_GameSendServerCommand( clientNum, "cp \"Red team has too many players.\n\"" );
return; // ignore the request
}
if ( team == TEAM_BLUE && counts[TEAM_BLUE] - counts[TEAM_RED] > 1 ) {
trap->SV_GameSendServerCommand( clientNum, "cp \"Blue team has too many players.\n\"" );
return; // ignore the request
}
// It's ok, the team we are switching to has less or same number of players
}
}
else
team = TEAM_FREE; // force them to spectators if there aren't any spots free
// override decision if limiting the players
if ( (level.gametype == GT_DUEL) && level.numNonSpectatorClients >= 2 )
team = TEAM_SPECTATOR;
else if ( g_maxGameClients->integer > 0 && level.numNonSpectatorClients >= g_maxGameClients->integer )
team = TEAM_SPECTATOR;
// decide if we will allow the change
oldTeam = client->sess.sessionTeam;
if ( team == oldTeam && team != TEAM_SPECTATOR )
return;
// if the player was dead leave the body
if ( client->ps.stats[STAT_HEALTH] <= 0 ) {
CopyToBodyQue( ent );
}
// he starts at 'base'
client->pers.teamState.state = TEAM_BEGIN;
if ( oldTeam != TEAM_SPECTATOR ) {
// Kill him (makes sure he loses flags, etc)
ent->flags &= ~FL_GODMODE;
ent->client->ps.stats[STAT_HEALTH] = ent->health = 0;
player_die( ent, ent, ent, 100000, MOD_SUICIDE );
}
// they go to the end of the line for tournaments
if ( team == TEAM_SPECTATOR && oldTeam != team )
AddTournamentQueue( client );
// exploit fix: with 3 (any odd amount?) players connected, one could /callvote map x followed by /team s to force the vote
G_ClearVote( ent );
client->sess.sessionTeam = team;
client->sess.spectatorState = specState;
client->sess.spectatorClient = specClient;
BroadcastTeamChange( client, oldTeam );
ClientUserinfoChanged( clientNum );
ClientBegin( clientNum );
}
开发者ID:Razish,项目名称:QtZ,代码行数:101,代码来源:g_cmds.c
示例20: ClientBegin
/*
===========
ClientBegin
called when a client has finished connecting, and is ready
to be placed into the level. This will happen every level load,
and on transition between teams, but doesn't happen on respawns
============
*/
void ClientBegin( int clientNum, qboolean allowTeamReset ) {
gentity_t *ent;
gclient_t *client;
gentity_t *tent;
int flags, i;
char userinfo[MAX_INFO_VALUE], *modelname;
ent = g_entities + clientNum;
if ((ent->r.svFlags & SVF_BOT) && g_gametype.integer >= GT_TEAM)
{
if (allowTeamReset)
{
const char *team = "Red";
int preSess;
//SetTeam(ent, "");
ent->client->sess.sessionTeam = PickTeam(-1);
trap_GetUserinfo(clientNum, userinfo, MAX_INFO_STRING);
if (ent->client->sess.sessionTeam == TEAM_SPECTATOR)
{
ent->client->sess.sessionTeam = TEAM_RED;
}
if (ent->client->sess.sessionTeam == TEAM_RED)
{
team = "Red";
}
else
{
team = "Blue";
}
Info_SetValueForKey( userinfo, "team", team );
trap_SetUserinfo( clientNum, userinfo );
ent->client->ps.persistant[ P
|
请发表评论