#include "g_local.h"#include "../ghoul2/G2.h"#include "bg_saga.h"#include "../namespace_begin.h"#include "../namespace_end.h"Go to the source code of this file.
|
|
Definition at line 946 of file g_client.c. Referenced by BodySink(). |
|
|
Definition at line 256 of file g_client.c. Referenced by JMSaberThink(), and JMSaberTouch(). |
|
|
Definition at line 621 of file g_client.c. |
|
|
Definition at line 621 of file g_client.c. Referenced by SelectRandomDeathmatchSpawnPoint(). |
|
|
Definition at line 1599 of file bg_vehicleLoad.c. References BG_VehicleGetIndex(), Com_Error(), ERR_DROP, g_vehicleInfo, strcpy(), and VEHICLE_NONE. Referenced by CG_CacheG2AnimInfo(), CG_G2AnimEntModelLoad(), and SetupGameGhoul2Model().
01600 {
01601 char *vehName = &modelname[1];
01602 int vIndex = BG_VehicleGetIndex(vehName);
01603 assert(modelname[0] == '$');
01604
01605 if (vIndex == VEHICLE_NONE)
01606 {
01607 Com_Error(ERR_DROP, "BG_GetVehicleModelName: couldn't find vehicle %s", vehName);
01608 }
01609
01610 strcpy(modelname, g_vehicleInfo[vIndex].model);
01611 }
|
|
||||||||||||
|
Definition at line 2744 of file bg_misc.c. References Q_stricmp(), qboolean, qfalse, and qtrue. Referenced by BG_ValidateSkinForTeam(), and SetupGameGhoul2Model().
02745 {
02746 if (!Q_stricmp(skinName, "menu"))
02747 {
02748 return qfalse;
02749 }
02750 else if (!Q_stricmp(modelName, "kyle"))
02751 {
02752 if (!Q_stricmp(skinName, "fpls"))
02753 {
02754 return qfalse;
02755 }
02756 else if (!Q_stricmp(skinName, "fpls2"))
02757 {
02758 return qfalse;
02759 }
02760 else if (!Q_stricmp(skinName, "fpls3"))
02761 {
02762 return qfalse;
02763 }
02764 }
02765 return qtrue;
02766 }
|
|
|
Definition at line 33 of file bg_panimate.c. References BOTH_SABERDUAL_STANCE, BOTH_SABERFAST_STANCE, BOTH_SABERSLOW_STANCE, BOTH_SABERSTAFF_STANCE, BOTH_STAND1, BOTH_STAND2, qboolean, qfalse, and qtrue. Referenced by G_UpdateClientAnims().
00034 {
00035 switch ( anim )
00036 {
00037 case BOTH_STAND1://not really a saberstance anim, actually... "saber off" stance
00038 case BOTH_STAND2://single-saber, medium style
00039 case BOTH_SABERFAST_STANCE://single-saber, fast style
00040 case BOTH_SABERSLOW_STANCE://single-saber, strong style
00041 case BOTH_SABERSTAFF_STANCE://saber staff style
00042 case BOTH_SABERDUAL_STANCE://dual saber style
00043 return qtrue;
00044 break;
00045 }
00046 return qfalse;
00047 }
|
|
||||||||||||||||||||
|
Definition at line 2768 of file bg_misc.c. References BG_FileExists(), BG_IsValidCharacterModel(), MAX_QPATH, Q_strcat(), Q_stricmp(), Q_stricmpn(), Q_strncmp(), Q_strncpyz(), qboolean, qfalse, qtrue, strchr(), strlen(), TEAM_BLUE, TEAM_RED, and va(). Referenced by CG_NewClientInfo(), and SetupGameGhoul2Model().
02769 {
02770 if (!Q_stricmpn(modelName, "jedi_",5))
02771 { //argh, it's a custom player skin!
02772 if (team == TEAM_RED && colors)
02773 {
02774 colors[0] = 1.0f;
02775 colors[1] = 0.0f;
02776 colors[2] = 0.0f;
02777 }
02778 else if (team == TEAM_BLUE && colors)
02779 {
02780 colors[0] = 0.0f;
02781 colors[1] = 0.0f;
02782 colors[2] = 1.0f;
02783 }
02784 return qtrue;
02785 }
02786
02787 if (team == TEAM_RED)
02788 {
02789 if ( Q_stricmp( "red", skinName ) != 0 )
02790 {//not "red"
02791 if ( Q_stricmp( "blue", skinName ) == 0
02792 || Q_stricmp( "default", skinName ) == 0
02793 || strchr(skinName, '|')//a multi-skin playerModel
02794 || !BG_IsValidCharacterModel(modelName, skinName) )
02795 {
02796 Q_strncpyz(skinName, "red", MAX_QPATH);
02797 return qfalse;
02798 }
02799 else
02800 {//need to set it to red
02801 int len = strlen( skinName );
02802 if ( len < 3 )
02803 {//too short to be "red"
02804 Q_strcat(skinName, MAX_QPATH, "_red");
02805 }
02806 else
02807 {
02808 char *start = &skinName[len-3];
02809 if ( Q_strncmp( "red", start, 3 ) != 0 )
02810 {//doesn't already end in "red"
02811 if ( len+4 >= MAX_QPATH )
02812 {//too big to append "_red"
02813 Q_strncpyz(skinName, "red", MAX_QPATH);
02814 return qfalse;
02815 }
02816 else
02817 {
02818 Q_strcat(skinName, MAX_QPATH, "_red");
02819 }
02820 }
02821 }
02822 //if file does not exist, set to "red"
02823 if ( !BG_FileExists( va( "models/players/%s/model_%s.skin", modelName, skinName ) ) )
02824 {
02825 Q_strncpyz(skinName, "red", MAX_QPATH);
02826 }
02827 return qfalse;
02828 }
02829 }
02830
02831 }
02832 else if (team == TEAM_BLUE)
02833 {
02834 if ( Q_stricmp( "blue", skinName ) != 0 )
02835 {
02836 if ( Q_stricmp( "red", skinName ) == 0
02837 || Q_stricmp( "default", skinName ) == 0
02838 || strchr(skinName, '|')//a multi-skin playerModel
02839 || !BG_IsValidCharacterModel(modelName, skinName) )
02840 {
02841 Q_strncpyz(skinName, "blue", MAX_QPATH);
02842 return qfalse;
02843 }
02844 else
02845 {//need to set it to blue
02846 int len = strlen( skinName );
02847 if ( len < 4 )
02848 {//too short to be "blue"
02849 Q_strcat(skinName, MAX_QPATH, "_blue");
02850 }
02851 else
02852 {
02853 char *start = &skinName[len-4];
02854 if ( Q_strncmp( "blue", start, 4 ) != 0 )
02855 {//doesn't already end in "blue"
02856 if ( len+5 >= MAX_QPATH )
02857 {//too big to append "_blue"
02858 Q_strncpyz(skinName, "blue", MAX_QPATH);
02859 return qfalse;
02860 }
02861 else
02862 {
02863 Q_strcat(skinName, MAX_QPATH, "_blue");
02864 }
02865 }
02866 }
02867 //if file does not exist, set to "blue"
02868 if ( !BG_FileExists( va( "models/players/%s/model_%s.skin", modelName, skinName ) ) )
02869 {
02870 Q_strncpyz(skinName, "blue", MAX_QPATH);
02871 }
02872 return qfalse;
02873 }
02874 }
02875 }
02876 return qtrue;
02877 }
|
|
|
Definition at line 973 of file g_client.c. References BODY_SINK_TIME, EV_BODYFADE, G_AddEvent(), gentity_t, level, gentity_s::nextthink, gentity_s::physicsObject, qfalse, gentity_s::takedamage, level_locals_t::time, gentity_s::timestamp, and trap_UnlinkEntity().
00973 {
00974 if ( level.time - ent->timestamp > BODY_SINK_TIME + 2500 ) {
00975 // the body ques are never actually freed, they are just unlinked
00976 trap_UnlinkEntity( ent );
00977 ent->physicsObject = qfalse;
00978 return;
00979 }
00980 // ent->nextthink = level.time + 100;
00981 // ent->s.pos.trBase[2] -= 1;
00982
00983 G_AddEvent(ent, EV_BODYFADE, 0);
00984 ent->nextthink = level.time + 18000;
00985 ent->takedamage = qfalse;
00986 }
|
|
||||||||||||
|
Definition at line 2385 of file g_client.c. References CalculateRanks(), CHAN_VOICE, client, gentity_s::client, entityState_s::clientNum, level_locals_t::clients, ClientSpawn(), ClientUserinfoChanged(), CON_CONNECTED, clientPersistant_t::connected, clientSession_t::duelTeam, DUELTEAM_FREE, playerState_s::eFlags, clientPersistant_t::enterTime, EV_PLAYER_TELEPORT_IN, playerState_s::fd, forcedata_s::forcePowersActive, G_ClearClientLog(), g_entities, g_gametype, G_GetStringEdString(), G_InitGentity(), G_LogPrintf(), G_MuteSound(), G_ReadSessionData(), G_SetSaber(), G_TempEntity(), G_WriteClientSessionData(), gclient_t, gentity_t, gentity_s::ghoul2, gSiegeRoundBegun, gSiegeRoundEnded, GT_DUEL, GT_POWERDUEL, GT_SIEGE, GT_TEAM, playerState_s::hasDetPackPlanted, Info_SetValueForKey(), Info_ValueForKey(), vmCvar_t::integer, forcedata_s::killSoundEntIndex, renderInfo_s::lastG2, level, entityShared_t::linked, MAX_GENTITIES, MAX_INFO_STRING, MAX_INFO_VALUE, memset(), clientPersistant_t::netname, NULL, NUM_FORCE_POWERS, NUM_TRACK_CHANNELS, playerState_s::origin, gentity_s::pain, gclient_s::pers, PERS_TEAM, playerState_s::persistant, PickTeam(), gentity_s::playerState, gclient_s::ps, qfalse, gentity_s::r, rand(), gclient_s::renderInfo, gentity_s::s, S_COLOR_WHITE, gclient_s::sess, clientSession_t::sessionTeam, SetTeam(), SetTeamQuick(), SetupGameGhoul2Model(), playerTeamState_t::state, strcpy(), SVF_BOT, entityShared_t::svFlags, TEAM_BEGIN, TEAM_RED, TEAM_SPECTATOR, clientPersistant_t::teamState, level_locals_t::time, gentity_s::touch, TRACK_CHANNEL_1, trap_GetUserinfo(), trap_SendServerCommand(), trap_SetUserinfo(), trap_UnlinkEntity(), va(), WP_ForcePowerStop(), WP_InitForcePowers(), and WP_SaberInitBladeData(). Referenced by Cmd_SiegeClass_f(), G_CheckBotSpawn(), SetTeam(), SetTeamQuick(), SpectatorClientEndFrame(), and vmMain().
02385 {
02386 gentity_t *ent;
02387 gclient_t *client;
02388 gentity_t *tent;
02389 int flags, i;
02390 char userinfo[MAX_INFO_VALUE], *modelname;
02391
02392 ent = g_entities + clientNum;
02393
02394 if ((ent->r.svFlags & SVF_BOT) && g_gametype.integer >= GT_TEAM)
02395 {
02396 if (allowTeamReset)
02397 {
02398 const char *team = "Red";
02399 int preSess;
02400
02401 //SetTeam(ent, "");
02402 ent->client->sess.sessionTeam = PickTeam(-1);
02403 trap_GetUserinfo(clientNum, userinfo, MAX_INFO_STRING);
02404
02405 if (ent->client->sess.sessionTeam == TEAM_SPECTATOR)
02406 {
02407 ent->client->sess.sessionTeam = TEAM_RED;
02408 }
02409
02410 if (ent->client->sess.sessionTeam == TEAM_RED)
02411 {
02412 team = "Red";
02413 }
02414 else
02415 {
02416 team = "Blue";
02417 }
02418
02419 Info_SetValueForKey( userinfo, "team", team );
02420
02421 trap_SetUserinfo( clientNum, userinfo );
02422
02423 ent->client->ps.persistant[ PERS_TEAM ] = ent->client->sess.sessionTeam;
02424
02425 preSess = ent->client->sess.sessionTeam;
02426 G_ReadSessionData( ent->client );
02427 ent->client->sess.sessionTeam = preSess;
02428 G_WriteClientSessionData(ent->client);
02429 ClientUserinfoChanged( clientNum );
02430 ClientBegin(clientNum, qfalse);
02431 return;
02432 }
02433 }
02434
02435 client = level.clients + clientNum;
02436
02437 if ( ent->r.linked ) {
02438 trap_UnlinkEntity( ent );
02439 }
02440 G_InitGentity( ent );
02441 ent->touch = 0;
02442 ent->pain = 0;
02443 ent->client = client;
02444
02445 //assign the pointer for bg entity access
02446 ent->playerState = &ent->client->ps;
02447
02448 client->pers.connected = CON_CONNECTED;
02449 client->pers.enterTime = level.time;
02450 client->pers.teamState.state = TEAM_BEGIN;
02451
02452 // save eflags around this, because changing teams will
02453 // cause this to happen with a valid entity, and we
02454 // want to make sure the teleport bit is set right
02455 // so the viewpoint doesn't interpolate through the
02456 // world to the new position
02457 flags = client->ps.eFlags;
02458
02459 i = 0;
02460
02461 while (i < NUM_FORCE_POWERS)
02462 {
02463 if (ent->client->ps.fd.forcePowersActive & (1 << i))
02464 {
02465 WP_ForcePowerStop(ent, i);
02466 }
02467 i++;
02468 }
02469
02470 i = TRACK_CHANNEL_1;
02471
02472 while (i < NUM_TRACK_CHANNELS)
02473 {
02474 if (ent->client->ps.fd.killSoundEntIndex[i-50] && ent->client->ps.fd.killSoundEntIndex[i-50] < MAX_GENTITIES && ent->client->ps.fd.killSoundEntIndex[i-50] > 0)
02475 {
02476 G_MuteSound(ent->client->ps.fd.killSoundEntIndex[i-50], CHAN_VOICE);
02477 }
02478 i++;
02479 }
02480 i = 0;
02481
02482 memset( &client->ps, 0, sizeof( client->ps ) );
02483 client->ps.eFlags = flags;
02484
02485 client->ps.hasDetPackPlanted = qfalse;
02486
02487 //first-time force power initialization
02488 WP_InitForcePowers( ent );
02489
02490 //init saber ent
02491 WP_SaberInitBladeData( ent );
02492
02493 // First time model setup for that player.
02494 trap_GetUserinfo( clientNum, userinfo, sizeof(userinfo) );
02495 modelname = Info_ValueForKey (userinfo, "model");
02496 SetupGameGhoul2Model(ent, modelname, NULL);
02497
02498 if (ent->ghoul2 && ent->client)
02499 {
02500 ent->client->renderInfo.lastG2 = NULL; //update the renderinfo bolts next update.
02501 }
02502
02503 if (g_gametype.integer == GT_POWERDUEL && client->sess.sessionTeam != TEAM_SPECTATOR &&
02504 client->sess.duelTeam == DUELTEAM_FREE)
02505 {
02506 SetTeam(ent, "s");
02507 }
02508 else
02509 {
02510 if (g_gametype.integer == GT_SIEGE && (!gSiegeRoundBegun || gSiegeRoundEnded))
02511 {
02512 SetTeamQuick(ent, TEAM_SPECTATOR, qfalse);
02513 }
02514
02515 if ((ent->r.svFlags & SVF_BOT) &&
02516 g_gametype.integer != GT_SIEGE)
02517 {
02518 char *saberVal = Info_ValueForKey(userinfo, "saber1");
02519 char *saber2Val = Info_ValueForKey(userinfo, "saber2");
02520
02521 if (!saberVal || !saberVal[0])
02522 { //blah, set em up with a random saber
02523 int r = rand()%50;
02524 char sab1[1024];
02525 char sab2[1024];
02526
02527 if (r <= 17)
02528 {
02529 strcpy(sab1, "Katarn");
02530 strcpy(sab2, "none");
02531 }
02532 else if (r <= 34)
02533 {
02534 strcpy(sab1, "Katarn");
02535 strcpy(sab2, "Katarn");
02536 }
02537 else
02538 {
02539 strcpy(sab1, "dual_1");
02540 strcpy(sab2, "none");
02541 }
02542 G_SetSaber(ent, 0, sab1, qfalse);
02543 G_SetSaber(ent, 0, sab2, qfalse);
02544 Info_SetValueForKey( userinfo, "saber1", sab1 );
02545 Info_SetValueForKey( userinfo, "saber2", sab2 );
02546 trap_SetUserinfo( clientNum, userinfo );
02547 }
02548 else
02549 {
02550 G_SetSaber(ent, 0, saberVal, qfalse);
02551 }
02552
02553 if (saberVal && saberVal[0] &&
02554 (!saber2Val || !saber2Val[0]))
02555 {
02556 G_SetSaber(ent, 0, "none", qfalse);
02557 Info_SetValueForKey( userinfo, "saber2", "none" );
02558 trap_SetUserinfo( clientNum, userinfo );
02559 }
02560 else
02561 {
02562 G_SetSaber(ent, 0, saber2Val, qfalse);
02563 }
02564 }
02565
02566 // locate ent at a spawn point
02567 ClientSpawn( ent );
02568 }
02569
02570 if ( client->sess.sessionTeam != TEAM_SPECTATOR ) {
02571 // send event
02572 tent = G_TempEntity( ent->client->ps.origin, EV_PLAYER_TELEPORT_IN );
02573 tent->s.clientNum = ent->s.clientNum;
02574
02575 if ( g_gametype.integer != GT_DUEL || g_gametype.integer == GT_POWERDUEL ) {
02576 trap_SendServerCommand( -1, va("print \"%s" S_COLOR_WHITE " %s\n\"", client->pers.netname, G_GetStringEdString("MP_SVGAME", "PLENTER")) );
02577 }
02578 }
02579 G_LogPrintf( "ClientBegin: %i\n", clientNum );
02580
02581 // count current clients and rank for scoreboard
02582 CalculateRanks();
02583
02584 G_ClearClientLog(clientNum);
02585 }
|
|
||||||||||||||||
|
Definition at line 2258 of file g_client.c. References BroadcastTeamChange(), CalculateRanks(), client, gentity_s::client, level_locals_t::clients, ClientUserinfoChanged(), CON_CONNECTING, clientPersistant_t::connected, EV_CLIENTJOIN, entityState_s::eventParm, G_BotConnect(), g_entities, G_FilterPacket(), g_gametype, G_GetStringEdString(), G_InitSessionData(), G_LogPrintf(), g_needpass, g_password, G_ReadSessionData(), G_TempEntity(), gclient_t, gentity_t, GT_POWERDUEL, GT_SIEGE, GT_TEAM, Info_ValueForKey(), vmCvar_t::integer, gentity_s::inuse, level, MAX_INFO_STRING, memset(), clientPersistant_t::netname, level_locals_t::newSession, NULL, gclient_s::pers, gentity_s::playerState, gclient_s::ps, Q_stricmp(), Q_strncpyz(), qtrue, gentity_s::r, gentity_s::s, S_COLOR_WHITE, gclient_s::sess, clientSession_t::sessionTeam, clientSession_t::siegeDesiredTeam, strcmp(), vmCvar_t::string, SVF_BOT, SVF_BROADCAST, entityShared_t::svFlags, TEAM_SPECTATOR, trap_GetUserinfo(), trap_SendServerCommand(), va(), and vec3_origin. Referenced by vmMain().
02258 {
02259 char *value;
02260 // char *areabits;
02261 gclient_t *client;
02262 char userinfo[MAX_INFO_STRING];
02263 gentity_t *ent;
02264 gentity_t *te;
02265
02266 ent = &g_entities[ clientNum ];
02267
02268 trap_GetUserinfo( clientNum, userinfo, sizeof( userinfo ) );
02269
02270 // check to see if they are on the banned IP list
02271 value = Info_ValueForKey (userinfo, "ip");
02272 if ( G_FilterPacket( value ) ) {
02273 return "Banned.";
02274 }
02275
02276 if ( !( ent->r.svFlags & SVF_BOT ) && !isBot && g_needpass.integer ) {
02277 // check for a password
02278 value = Info_ValueForKey (userinfo, "password");
02279 if ( g_password.string[0] && Q_stricmp( g_password.string, "none" ) &&
02280 strcmp( g_password.string, value) != 0) {
02281 static char sTemp[1024];
02282 Q_strncpyz(sTemp, G_GetStringEdString("MP_SVGAME","INVALID_ESCAPE_TO_MAIN"), sizeof (sTemp) );
02283 return sTemp;// return "Invalid password";
02284 }
02285 }
02286
02287 // they can connect
02288 ent->client = level.clients + clientNum;
02289 client = ent->client;
02290
02291 //assign the pointer for bg entity access
02292 ent->playerState = &ent->client->ps;
02293
02294 // areabits = client->areabits;
02295
02296 memset( client, 0, sizeof(*client) );
02297
02298 client->pers.connected = CON_CONNECTING;
02299
02300 // read or initialize the session data
02301 if ( firstTime || level.newSession ) {
02302 G_InitSessionData( client, userinfo, isBot );
02303 }
02304 G_ReadSessionData( client );
02305
02306 if (g_gametype.integer == GT_SIEGE &&
02307 (firstTime || level.newSession))
02308 { //if this is the first time then auto-assign a desired siege team and show briefing for that team
02309 client->sess.siegeDesiredTeam = 0;//PickTeam(ent->s.number);
02310 /*
02311 trap_SendServerCommand(ent->s.number, va("sb %i", client->sess.siegeDesiredTeam));
02312 */
02313 //don't just show it - they'll see it if they switch to a team on purpose.
02314 }
02315
02316
02317 if (g_gametype.integer == GT_SIEGE && client->sess.sessionTeam != TEAM_SPECTATOR)
02318 {
02319 if (firstTime || level.newSession)
02320 { //start as spec
02321 client->sess.siegeDesiredTeam = client->sess.sessionTeam;
02322 client->sess.sessionTeam = TEAM_SPECTATOR;
02323 }
02324 }
02325 else if (g_gametype.integer == GT_POWERDUEL && client->sess.sessionTeam != TEAM_SPECTATOR)
02326 {
02327 client->sess.sessionTeam = TEAM_SPECTATOR;
02328 }
02329
02330 if( isBot ) {
02331 ent->r.svFlags |= SVF_BOT;
02332 ent->inuse = qtrue;
02333 if( !G_BotConnect( clientNum, !firstTime ) ) {
02334 return "BotConnectfailed";
02335 }
02336 }
02337
02338 // get and distribute relevent paramters
02339 G_LogPrintf( "ClientConnect: %i\n", clientNum );
02340 ClientUserinfoChanged( clientNum );
02341
02342 // don't do the "xxx connected" messages if they were caried over from previous level
02343 if ( firstTime ) {
02344 trap_SendServerCommand( -1, va("print \"%s" S_COLOR_WHITE " %s\n\"", client->pers.netname, G_GetStringEdString("MP_SVGAME", "PLCONNECT")) );
02345 }
02346
02347 if ( g_gametype.integer >= GT_TEAM &&
02348 client->sess.sessionTeam != TEAM_SPECTATOR ) {
02349 BroadcastTeamChange( client, -1 );
02350 }
02351
02352 // count current clients and rank for scoreboard
02353 CalculateRanks();
02354
02355 te = G_TempEntity( vec3_origin, EV_CLIENTJOIN );
02356 te->r.svFlags |= SVF_BROADCAST;
02357 te->s.eventParm = clientNum;
02358
02359 // for statistics
02360 // client->areabits = areabits;
02361 // if ( !client->areabits )
02362 // client->areabits = G_Alloc( (trap_AAS_PointReachabilityAreaIndex( NULL ) + 7) / 8 );
02363
02364 return NULL;
02365 }
|
|
|