#include "g_local.h"#include "bg_saga.h"Go to the source code of this file.
|
|
Definition at line 941 of file g_team.c. Referenced by SelectRandomTeamSpawnPoint(). |
|
|
|
|
||||||||||||||||
|
|
||||||||||||
|
|
Definition at line 37 of file g_team.c. References TEAM_BLUE, and TEAM_RED. Referenced by Team_FragBonuses().
|
|
|
Definition at line 55 of file g_team.c. References TEAM_BLUE, TEAM_RED, and TEAM_SPECTATOR.
00055 {
00056 if (team==TEAM_RED)
00057 return "BLUE";
00058 else if (team==TEAM_BLUE)
00059 return "RED";
00060 else if (team==TEAM_SPECTATOR)
00061 return "SPECTATOR";
00062 return "FREE";
00063 }
|
|
||||||||||||
|
Definition at line 839 of file g_team.c. References gentity_s::classname, gentity_s::client, gclient_t, gentity_t, gclient_s::sess, clientSession_t::sessionTeam, strcmp(), TEAM_BLUE, TEAM_FREE, TEAM_RED, Team_TouchEnemyFlag(), and Team_TouchOurFlag(). Referenced by Touch_Item().
00839 {
00840 int team;
00841 gclient_t *cl = other->client;
00842
00843 // figure out what team this flag is
00844 if( strcmp(ent->classname, "team_CTF_redflag") == 0 ) {
00845 team = TEAM_RED;
00846 }
00847 else if( strcmp(ent->classname, "team_CTF_blueflag") == 0 ) {
00848 team = TEAM_BLUE;
00849 }
00850 else if( strcmp(ent->classname, "team_CTF_neutralflag") == 0 ) {
00851 team = TEAM_FREE;
00852 }
00853 else {
00854 // PrintMsg ( other, "Don't know what team the flag is on.\n");
00855 return 0;
00856 }
00857 // GT_CTF
00858 if( team == cl->sess.sessionTeam) {
00859 return Team_TouchOurFlag( ent, other, team );
00860 }
00861 return Team_TouchEnemyFlag( ent, other, team );
00862 }
|
|
||||||||||||||||
|
Definition at line 100 of file g_team.c. References CTFMESSAGE_PLAYER_CAPTURED_FLAG, EV_CTFMESSAGE, entityState_s::eventParm, G_TempEntity(), gentity_t, MAX_CLIENTS, gentity_s::r, gentity_s::s, SVF_BROADCAST, entityShared_t::svFlags, TEAM_BLUE, TEAM_RED, entityState_s::trickedentindex, entityState_s::trickedentindex2, and vec3_origin. Referenced by Team_FragBonuses(), Team_ReturnFlag(), Team_TouchEnemyFlag(), and Team_TouchOurFlag().
00101 {
00102 gentity_t *te;
00103
00104 if (plIndex == -1)
00105 {
00106 plIndex = MAX_CLIENTS+1;
00107 }
00108 if (teamIndex == -1)
00109 {
00110 teamIndex = 50;
00111 }
00112
00113 te = G_TempEntity(vec3_origin, EV_CTFMESSAGE);
00114 te->r.svFlags |= SVF_BROADCAST;
00115 te->s.eventParm = ctfMessage;
00116 te->s.trickedentindex = plIndex;
00117 if (ctfMessage == CTFMESSAGE_PLAYER_CAPTURED_FLAG)
00118 {
00119 if (teamIndex == TEAM_RED)
00120 {
00121 te->s.trickedentindex2 = TEAM_BLUE;
00122 }
00123 else
00124 {
00125 te->s.trickedentindex2 = TEAM_RED;
00126 }
00127 }
00128 else
00129 {
00130 te->s.trickedentindex2 = teamIndex;
00131 }
00132 }
|
|
||||||||||||||||||||
|
Definition at line 1040 of file g_team.c. References entityState_s::angles, gentity_t, entityState_s::origin, gentity_s::s, SelectRandomTeamSpawnPoint(), SelectSpawnPoint(), team_t, vec3_origin, vec3_t, and VectorCopy. Referenced by ClientSpawn().
01040 {
01041 gentity_t *spot;
01042
01043 spot = SelectRandomTeamSpawnPoint ( teamstate, team, -1 );
01044
01045 if (!spot) {
01046 return SelectSpawnPoint( vec3_origin, origin, angles, team );
01047 }
01048
01049 VectorCopy (spot->s.origin, origin);
01050 origin[2] += 9;
01051 VectorCopy (spot->s.angles, angles);
01052
01053 return spot;
01054 }
|
|
||||||||||||||||
|
Definition at line 942 of file g_team.c. References bgSiegeClasses, FOFS, G_Find(), g_gametype, gentity_s::genericValue1, gentity_t, GT_SIEGE, gentity_s::idealclass, vmCvar_t::integer, MAX_TEAM_SPAWN_POINTS, name, siegeClass_t::name, NULL, Q_stricmp(), qboolean, qfalse, qtrue, rand(), SIEGETEAM_TEAM1, SpotWouldTelefrag(), TEAM_BEGIN, TEAM_BLUE, TEAM_RED, and team_t. Referenced by SelectCTFSpawnPoint(), and SelectSiegeSpawnPoint().
00942 {
00943 gentity_t *spot;
00944 int count;
00945 int selection;
00946 gentity_t *spots[MAX_TEAM_SPAWN_POINTS];
00947 char *classname;
00948 qboolean mustBeEnabled = qfalse;
00949
00950 if (g_gametype.integer == GT_SIEGE)
00951 {
00952 if (team == SIEGETEAM_TEAM1)
00953 {
00954 classname = "info_player_siegeteam1";
00955 }
00956 else
00957 {
00958 classname = "info_player_siegeteam2";
00959 }
00960
00961 mustBeEnabled = qtrue; //siege spawn points need to be "enabled" to be used (because multiple spawnpoint sets can be placed at once)
00962 }
00963 else
00964 {
00965 if (teamstate == TEAM_BEGIN) {
00966 if (team == TEAM_RED)
00967 classname = "team_CTF_redplayer";
00968 else if (team == TEAM_BLUE)
00969 classname = "team_CTF_blueplayer";
00970 else
00971 return NULL;
00972 } else {
00973 if (team == TEAM_RED)
00974 classname = "team_CTF_redspawn";
00975 else if (team == TEAM_BLUE)
00976 classname = "team_CTF_bluespawn";
00977 else
00978 return NULL;
00979 }
00980 }
00981 count = 0;
00982
00983 spot = NULL;
00984
00985 while ((spot = G_Find (spot, FOFS(classname), classname)) != NULL) {
00986 if ( SpotWouldTelefrag( spot ) ) {
00987 continue;
00988 }
00989
00990 if (mustBeEnabled && !spot->genericValue1)
00991 { //siege point that's not enabled, can't use it
00992 continue;
00993 }
00994
00995 spots[ count ] = spot;
00996 if (++count == MAX_TEAM_SPAWN_POINTS)
00997 break;
00998 }
00999
01000 if ( !count ) { // no spots that won't telefrag
01001 return G_Find( NULL, FOFS(classname), classname);
01002 }
01003
01004 if (g_gametype.integer == GT_SIEGE && siegeClass >= 0 &&
01005 bgSiegeClasses[siegeClass].name[0])
01006 { //out of the spots found, see if any have an idealclass to match our class name
01007 gentity_t *classSpots[MAX_TEAM_SPAWN_POINTS];
01008 int classCount = 0;
01009 int i = 0;
01010
01011 while (i < count)
01012 {
01013 if (spots[i] && spots[i]->idealclass && spots[i]->idealclass[0] &&
01014 !Q_stricmp(spots[i]->idealclass, bgSiegeClasses[siegeClass].name))
01015 { //this spot's idealclass matches the class name
01016 classSpots[classCount] = spots[i];
01017 classCount++;
01018 }
01019 i++;
01020 }
01021
01022 if (classCount > 0)
01023 { //found at least one
01024 selection = rand() % classCount;
01025 return spots[ selection ];
01026 }
01027 }
01028
01029 selection = rand() % count;
01030 return spots[ selection ];
01031 }
|
|
||||||||||||||||||||||||
|
Definition at line 1062 of file g_team.c. References entityState_s::angles, gentity_t, entityState_s::origin, gentity_s::s, SelectRandomTeamSpawnPoint(), SelectSpawnPoint(), team_t, vec3_origin, vec3_t, and VectorCopy. Referenced by ClientSpawn().
01062 {
01063 gentity_t *spot;
01064
01065 spot = SelectRandomTeamSpawnPoint ( teamstate, team, siegeClass );
01066
01067 if (!spot) {
01068 return SelectSpawnPoint( vec3_origin, origin, angles, team );
01069 }
01070
01071 VectorCopy (spot->s.origin, origin);
01072 origin[2] += 9;
01073 VectorCopy (spot->s.angles, angles);
01074
01075 return spot;
01076 }
|
|
|
Definition at line 1207 of file g_team.c. References gentity_t.
01207 {
01208 }
|
|
|
Definition at line 1222 of file g_team.c. References gentity_t.
01222 {
01223 }
|
|
|
Definition at line 1200 of file g_team.c. References gentity_t.
01200 {
01201 }
|
|
|
Definition at line 1215 of file g_team.c. References gentity_t.
01215 {
01216 }
|
|
||||||||||||
|
Definition at line 655 of file g_team.c. References EV_GLOBAL_TEAM_SOUND, entityState_s::eventParm, G_Printf(), G_TempEntity(), gentity_t, GTS_BLUE_CAPTURE, GTS_RED_CAPTURE, NULL, entityState_s::pos, gentity_s::r, gentity_s::s, SVF_BROADCAST, entityShared_t::svFlags, TEAM_BLUE, and trajectory_t::trBase. Referenced by Team_TouchOurFlag().
00655 {
00656 gentity_t *te;
00657
00658 if (ent == NULL) {
00659 G_Printf ("Warning: NULL passed to Team_CaptureFlagSound\n");
00660 return;
00661 }
00662
00663 te = G_TempEntity( ent->s.pos.trBase, EV_GLOBAL_TEAM_SOUND );
00664 if( team == TEAM_BLUE ) {
00665 te->s.eventParm = GTS_BLUE_CAPTURE;
00666 }
00667 else {
00668 te->s.eventParm = GTS_RED_CAPTURE;
00669 }
00670 te->r.svFlags |= SVF_BROADCAST;
00671 }
|
|
|
Definition at line 311 of file g_team.c. References FLAG_DROPPED, gentity_t, gitem_s::giTag, gentity_s::item, PW_BLUEFLAG, PW_NEUTRALFLAG, PW_REDFLAG, TEAM_BLUE, TEAM_FREE, TEAM_RED, and Team_SetFlagStatus(). Referenced by LaunchItem().
00311 {
00312 if( dropped->item->giTag == PW_REDFLAG ) {
00313 Team_SetFlagStatus( TEAM_RED, FLAG_DROPPED );
00314 }
00315 else if( dropped->item->giTag == PW_BLUEFLAG ) {
00316 Team_SetFlagStatus( TEAM_BLUE, FLAG_DROPPED );
00317 }
00318 else if( dropped->item->giTag == PW_NEUTRALFLAG ) {
00319 Team_SetFlagStatus( TEAM_FREE, FLAG_DROPPED );
00320 }
00321 }
|
|
||||||||||||
|
|
Definition at line 705 of file g_team.c. References gentity_t, gitem_s::giTag, gentity_s::item, PW_BLUEFLAG, PW_NEUTRALFLAG, PW_REDFLAG, TEAM_BLUE, TEAM_FREE, TEAM_RED, Team_ResetFlag(), and Team_ReturnFlagSound(). Referenced by LaunchItem().
00705 {
00706 int team = TEAM_FREE;
00707
00708 if( ent->item->giTag == PW_REDFLAG ) {
00709 team = TEAM_RED;
00710 }
00711 else if( ent->item->giTag == PW_BLUEFLAG ) {
00712 team = TEAM_BLUE;
00713 }
00714 else if( ent->item->giTag == PW_NEUTRALFLAG ) {
00715 team = TEAM_FREE;
00716 }
00717
00718 Team_ReturnFlagSound( Team_ResetFlag( team ), team );
00719 // Reset Flag will delete this entity
00720 }
|
|
|
Definition at line 328 of file g_team.c. References gentity_s::client, FL_FORCE_GESTURE, gentity_s::flags, g_entities, gentity_t, gentity_s::inuse, MAX_CLIENTS, gclient_s::sess, and clientSession_t::sessionTeam.
00328 {
00329 int i;
00330 gentity_t *ent;
00331
00332 for (i = 0; i < MAX_CLIENTS; i++) {
00333 ent = &g_entities[i];
00334 if (!ent->inuse)
00335 continue;
00336 if (!ent->client)
00337 continue;
00338 if (ent->client->sess.sessionTeam != team)
00339 continue;
00340 //
00341 ent->flags |= FL_FORCE_GESTURE;
00342 }
00343 }
|
|
||||||||||||||||
|
Definition at line 354 of file g_team.c. References AddScore(), playerTeamState_t::basedefense, playerTeamState_t::carrierdefense, gentity_s::client, CTF_ATTACKER_PROTECT_RADIUS, CTF_CARRIER_DANGER_PROTECT_BONUS, CTF_CARRIER_DANGER_PROTECT_TIMEOUT, CTF_CARRIER_PROTECT_BONUS, CTF_FLAG_DEFENSE_BONUS, CTF_FRAG_CARRIER_BONUS, CTF_TARGET_PROTECT_RADIUS, CTFMESSAGE_FRAGGED_FLAG_CARRIER, entityShared_t::currentOrigin, FL_DROPPED_ITEM, gentity_s::flags, FOFS, playerTeamState_t::fragcarrier, g_entities, G_Find(), g_maxclients, gentity_t, vmCvar_t::integer, gentity_s::inuse, playerTeamState_t::lastfraggedcarrier, playerTeamState_t::lasthurtcarrier, level, NULL, entityState_s::number, OnSameTeam(), OtherTeam(), gclient_s::pers, PERS_DEFEND_COUNT, playerState_s::persistant, playerState_s::powerups, PrintCTFMessage(), gclient_s::ps, PW_BLUEFLAG, PW_REDFLAG, gentity_s::r, REWARD_SPRITE_TIME, gclient_s::rewardTime, gentity_s::s, gclient_s::sess, clientSession_t::sessionTeam, TEAM_BLUE, TEAM_RED, clientPersistant_t::teamState, level_locals_t::time, trap_InPVS(), vec3_t, and VectorSubtract. Referenced by player_die().
00355 {
00356 int i;
00357 gentity_t *ent;
00358 int flag_pw, enemy_flag_pw;
00359 int otherteam;
00360 int tokens;
00361 gentity_t *flag, *carrier = NULL;
00362 char *c;
00363 vec3_t v1, v2;
00364 int team;
00365
00366 // no bonus for fragging yourself or team mates
00367 if (!targ->client || !attacker->client || targ == attacker || OnSameTeam(targ, attacker))
00368 return;
00369
00370 team = targ->client->sess.sessionTeam;
00371 otherteam = OtherTeam(targ->client->sess.sessionTeam);
00372 if (otherteam < 0)
00373 return; // whoever died isn't on a team
00374
00375 // same team, if the flag at base, check to he has the enemy flag
00376 if (team == TEAM_RED) {
00377 flag_pw = PW_REDFLAG;
00378 enemy_flag_pw = PW_BLUEFLAG;
00379 } else {
00380 flag_pw = PW_BLUEFLAG;
00381 enemy_flag_pw = PW_REDFLAG;
00382 }
00383
00384 // did the attacker frag the flag carrier?
00385 tokens = 0;
00386 if (targ->client->ps.powerups[enemy_flag_pw]) {
00387 attacker->client->pers.teamState.lastfraggedcarrier = level.time;
00388 AddScore(attacker, targ->r.currentOrigin, CTF_FRAG_CARRIER_BONUS);
00389 attacker->client->pers.teamState.fragcarrier++;
00390 //PrintMsg(NULL, "%s" S_COLOR_WHITE " fragged %s's flag carrier!\n",
00391 // attacker->client->pers.netname, TeamName(team));
00392 PrintCTFMessage(attacker->s.number, team, CTFMESSAGE_FRAGGED_FLAG_CARRIER);
00393
00394 // the target had the flag, clear the hurt carrier
00395 // field on the other team
00396 for (i = 0; i < g_maxclients.integer; i++) {
00397 ent = g_entities + i;
00398 if (ent->inuse && ent->client->sess.sessionTeam == otherteam)
00399 ent->client->pers.teamState.lasthurtcarrier = 0;
00400 }
00401 return;
00402 }
00403
00404 // did the attacker frag a head carrier? other->client->ps.generic1
00405 if (tokens) {
00406 attacker->client->pers.teamState.lastfraggedcarrier = level.time;
00407 AddScore(attacker, targ->r.currentOrigin, CTF_FRAG_CARRIER_BONUS * tokens * tokens);
00408 attacker->client->pers.teamState.fragcarrier++;
00409 //PrintMsg(NULL, "%s" S_COLOR_WHITE " fragged %s's skull carrier!\n",
00410 // attacker->client->pers.netname, TeamName(team));
00411
00412 // the target had the flag, clear the hurt carrier
00413 // field on the other team
00414 for (i = 0; i < g_maxclients.integer; i++) {
00415 ent = g_entities + i;
00416 if (ent->inuse && ent->client->sess.sessionTeam == otherteam)
00417 ent->client->pers.teamState.lasthurtcarrier = 0;
00418 }
00419 return;
00420 }
00421
00422 if (targ->client->pers.teamState.lasthurtcarrier &&
00423 level.time - targ->client->pers.teamState.lasthurtcarrier < CTF_CARRIER_DANGER_PROTECT_TIMEOUT &&
00424 !attacker->client->ps.powerups[flag_pw]) {
00425 // attacker is on the same team as the flag carrier and
00426 // fragged a guy who hurt our flag carrier
00427 AddScore(attacker, targ->r.currentOrigin, CTF_CARRIER_DANGER_PROTECT_BONUS);
00428
00429 attacker->client->pers.teamState.carrierdefense++;
00430 targ->client->pers.teamState.lasthurtcarrier = 0;
00431
00432 attacker->client->ps.persistant[PERS_DEFEND_COUNT]++;
00433 team = attacker->client->sess.sessionTeam;
00434 attacker->client->rewardTime = level.time + REWARD_SPRITE_TIME;
00435
00436 return;
00437 }
00438
00439 if (targ->client->pers.teamState.lasthurtcarrier &&
00440 level.time - targ->client->pers.teamState.lasthurtcarrier < CTF_CARRIER_DANGER_PROTECT_TIMEOUT) {
00441 // attacker is on the same team as the skull carrier and
00442 AddScore(attacker, targ->r.currentOrigin, CTF_CARRIER_DANGER_PROTECT_BONUS);
00443
00444 attacker->client->pers.teamState.carrierdefense++;
00445 targ->client->pers.teamState.lasthurtcarrier = 0;
00446
00447 attacker->client->ps.persistant[PERS_DEFEND_COUNT]++;
00448 team = attacker->client->sess.sessionTeam;
00449 attacker->client->rewardTime = level.time + REWARD_SPRITE_TIME;
00450
00451 return;
00452 }
00453
00454 // flag and flag carrier area defense bonuses
00455
00456 // we have to find the flag and carrier entities
00457
00458 // find the flag
00459 switch (attacker->client->sess.sessionTeam) {
00460 case TEAM_RED:
00461 c = "team_CTF_redflag";
00462 break;
00463 case TEAM_BLUE:
00464 c = "team_CTF_blueflag";
00465 break;
00466 default:
00467 return;
00468 }
00469 // find attacker's team's flag carrier
00470 for (i = 0; i < g_maxclients.integer; i++) {
00471 carrier = g_entities + i;
00472 if (carrier->inuse && carrier->client->ps.powerups[flag_pw])
00473 break;
00474 carrier = NULL;
00475 }
00476 flag = NULL;
00477 while ((flag = G_Find (flag, FOFS(classname), c)) != NULL) {
00478 if (!(flag->flags & FL_DROPPED_ITEM))
00479 break;
00480 }
00481
00482 if (!flag)
00483 return; // can't find attacker's flag
00484
00485 // ok we have the attackers flag and a pointer to the carrier
00486
00487 // check to see if we are defending the base's flag
00488 VectorSubtract(targ->r.currentOrigin, flag->r.currentOrigin, v1);
00489 VectorSubtract(attacker->r.currentOrigin, flag->r.currentOrigin, v2);
00490
00491 if ( ( ( VectorLength(v1) < CTF_TARGET_PROTECT_RADIUS &&
00492 trap_InPVS(flag->r.currentOrigin, targ->r.currentOrigin ) ) ||
00493 ( VectorLength(v2) < CTF_TARGET_PROTECT_RADIUS &&
00494 trap_InPVS(flag->r.currentOrigin, attacker->r.currentOrigin ) ) ) &&
00495 attacker->client->sess.sessionTeam != targ->client->sess.sessionTeam) {
00496
00497 // we defended the base flag
00498 AddScore(attacker, targ->r.currentOrigin, CTF_FLAG_DEFENSE_BONUS);
00499 attacker->client->pers.teamState.basedefense++;
00500
00501 attacker->client->ps.persistant[PERS_DEFEND_COUNT]++;
00502 attacker->client->rewardTime = level.time + REWARD_SPRITE_TIME;
00503
00504 return;
00505 }
00506
00507 if (carrier && carrier != attacker) {
00508 VectorSubtract(targ->r.currentOrigin, carrier->r.currentOrigin, v1);
00509 VectorSubtract(attacker->r.currentOrigin, carrier->r.currentOrigin, v1);
00510
00511 if ( ( ( VectorLength(v1) < CTF_ATTACKER_PROTECT_RADIUS &&
00512 trap_InPVS(carrier->r.currentOrigin, targ->r.currentOrigin ) ) ||
00513 ( VectorLength(v2) < CTF_ATTACKER_PROTECT_RADIUS &&
00514 trap_InPVS(carrier->r.currentOrigin, attacker->r.currentOrigin ) ) ) &&
00515 attacker->client->sess.sessionTeam != targ->client->sess.sessionTeam) {
00516 AddScore(attacker, targ->r.currentOrigin, CTF_CARRIER_PROTECT_BONUS);
00517 attacker->client->pers.teamState.carrierdefense++;
00518
00519 attacker->client->ps.persistant[PERS_DEFEND_COUNT]++;
00520 attacker->client->rewardTime = level.time + REWARD_SPRITE_TIME;
00521
00522 return;
00523 }
00524 }
00525 }
|
|
|
Definition at line 684 of file g_team.c. References gentity_t, gitem_s::giTag, gentity_s::item, PW_BLUEFLAG, PW_NEUTRALFLAG, PW_REDFLAG, TEAM_BLUE, TEAM_FREE, TEAM_RED, and Team_ReturnFlag(). Referenced by G_RunItem().
00684 {
00685 if( ent->item->giTag == PW_REDFLAG ) {
00686 Team_ReturnFlag( TEAM_RED );
00687 }
00688 else if( ent->item->giTag == PW_BLUEFLAG ) {
00689 Team_ReturnFlag( TEAM_BLUE );
00690 }
00691 else if( ent->item->giTag == PW_NEUTRALFLAG ) {
00692 Team_ReturnFlag( TEAM_FREE );
00693 }
00694 }
|
|
|
Definition at line 871 of file g_team.c. References entityShared_t::currentOrigin, gentity_t, level, level_locals_t::locationHead, gentity_s::nextTrain, NULL, gentity_s::r, trap_InPVS(), vec3_t, and VectorCopy. Referenced by CheckTeamStatus(), and Team_GetLocationMsg().
00872 {
00873 gentity_t *eloc, *best;
00874 float bestlen, len;
00875 vec3_t origin;
00876
00877 best = NULL;
00878 bestlen = 3*8192.0*8192.0;
00879
00880 VectorCopy( ent->r.currentOrigin, origin );
00881
00882 for (eloc = level.locationHead; eloc; eloc = eloc->nextTrain) {
00883 len = ( origin[0] - eloc->r.currentOrigin[0] ) * ( origin[0] - eloc->r.currentOrigin[0] )
00884 + ( origin[1] - eloc->r.currentOrigin[1] ) * ( origin[1] - eloc->r.currentOrigin[1] )
00885 + ( origin[2] - eloc->r.currentOrigin[2] ) * ( origin[2] - eloc->r.currentOrigin[2] );
00886
00887 if ( len > bestlen ) {
00888 continue;
00889 }
00890
00891 if ( !trap_InPVS( origin, eloc->r.currentOrigin ) ) {
00892 continue;
00893 }
00894
00895 bestlen = len;
00896 best = eloc;
00897 }
00898
00899 return best;
00900 }
|
|
||||||||||||||||
|
Definition at line 910 of file g_team.c. References Com_sprintf(), gentity_s::count, gentity_t, gentity_s::message, Q_COLOR_ESCAPE, qboolean, qfalse, qtrue, S_COLOR_WHITE, and Team_GetLocation(). Referenced by G_Say().
00911 {
00912 gentity_t *best;
00913
00914 best = Team_GetLocation( ent );
00915
00916 if (!best)
00917 return qfalse;
00918
00919 if (best->count) {
00920 if (best->count < 0)
00921 best->count = 0;
00922 if (best->count > 7)
00923 best->count = 7;
00924 Com_sprintf(loc, loclen, "%c%c%s" S_COLOR_WHITE, Q_COLOR_ESCAPE, best->count + '0', best->message );
00925 } else
00926 Com_sprintf(loc, loclen, "%s", best->message);
00927
00928 return qtrue;
00929 }
|
|
|
Definition at line 22 of file g_team.c. References teamgame_s::blueStatus, FLAG_ATBASE, g_gametype, GT_CTF, GT_CTY, vmCvar_t::integer, memset(), teamgame_s::redStatus, TEAM_BLUE, TEAM_RED, Team_SetFlagStatus(), and teamgame. Referenced by G_CheckTeamItems().
00022 {
00023 memset(&teamgame, 0, sizeof teamgame);
00024
00025 switch( g_gametype.integer ) {
00026 case GT_CTF:
00027 case GT_CTY:
00028 teamgame.redStatus = teamgame.blueStatus = -1; // Invalid to force update
00029 Team_SetFlagStatus( TEAM_RED, FLAG_ATBASE );
00030 Team_SetFlagStatus( TEAM_BLUE, FLAG_ATBASE );
00031 break;
00032 default:
00033 break;
00034 }
00035 }
|
|
|
Definition at line 559 of file g_team.c. References FL_DROPPED_ITEM, FLAG_ATBASE, gentity_s::flags, FOFS, G_Find(), G_FreeEntity(), gentity_t, NULL, RespawnItem(), TEAM_BLUE, TEAM_FREE, TEAM_RED, and Team_SetFlagStatus(). Referenced by Team_DroppedFlagThink(), Team_ResetFlags(), Team_ReturnFlag(), and Team_TouchOurFlag().
00559 {
00560 char *c;
00561 gentity_t *ent, *rent = NULL;
00562
00563 switch (team) {
00564 case TEAM_RED:
00565 c = "team_CTF_redflag";
00566 break;
00567 case TEAM_BLUE:
00568 c = "team_CTF_blueflag";
00569 break;
00570 case TEAM_FREE:
00571 c = "team_CTF_neutralflag";
00572 break;
00573 default:
00574 return NULL;
00575 }
00576
00577 ent = NULL;
00578 while ((ent = G_Find (ent, FOFS(classname), c)) != NULL) {
00579 if (ent->flags & FL_DROPPED_ITEM)
00580 G_FreeEntity(ent);
00581 else {
00582 rent = ent;
00583 RespawnItem(ent);
00584 }
00585 }
00586
00587 Team_SetFlagStatus( team, FLAG_ATBASE );
00588
00589 return rent;
00590 }
|
|
|
Definition at line 592 of file g_team.c. References g_gametype, GT_CTF, GT_CTY, vmCvar_t::integer, TEAM_BLUE, TEAM_RED, and Team_ResetFlag(). Referenced by Team_TouchOurFlag().
00592 {
00593 if( g_gametype.integer == GT_CTF || g_gametype.integer == GT_CTY ) {
00594 Team_ResetFlag( TEAM_RED );
00595 Team_ResetFlag( TEAM_BLUE );
00596 }
00597 }
|
|
|
Definition at line 673 of file g_team.c. References CTFMESSAGE_FLAG_RETURNED, PrintCTFMessage(), TEAM_FREE, Team_ResetFlag(), and Team_ReturnFlagSound(). Referenced by player_die(), Team_FreeEntity(), and Use_target_remove_powerups().
00673 {
00674 Team_ReturnFlagSound(Team_ResetFlag(team), team);
00675 if( team == TEAM_FREE ) {
00676 //PrintMsg(NULL, "The flag has returned!\n" );
00677 }
00678 else { //flag should always have team in normal CTF
00679 //PrintMsg(NULL, "The %s flag has returned!\n", TeamName(team));
00680 PrintCTFMessage(-1, team, CTFMESSAGE_FLAG_RETURNED);
00681 }
00682 }
|
|
||||||||||||
|
Definition at line 599 of file g_team.c. References EV_GLOBAL_TEAM_SOUND, entityState_s::eventParm, G_Printf(), G_TempEntity(), gentity_t, GTS_BLUE_RETURN, GTS_RED_RETURN, NULL, entityState_s::pos, gentity_s::r, gentity_s::s, SVF_BROADCAST, entityShared_t::svFlags, TEAM_BLUE, and trajectory_t::trBase. Referenced by Team_DroppedFlagThink(), Team_ReturnFlag(), and Team_TouchOurFlag().
00599 {
00600 gentity_t *te;
00601
00602 if (ent == NULL) {
00603 G_Printf ("Warning: NULL passed to Team_ReturnFlagSound\n");
00604 return;
00605 }
00606
00607 te = G_TempEntity( ent->s.pos.trBase, EV_GLOBAL_TEAM_SOUND );
00608 if( team == TEAM_BLUE ) {
00609 te->s.eventParm = GTS_RED_RETURN;
00610 }
00611 else {
00612 te->s.eventParm = GTS_BLUE_RETURN;
00613 }
00614 te->r.svFlags |= SVF_BROADCAST;
00615 }
|
|
||||||||||||
|
Definition at line 272 of file g_team.c. References teamgame_s::blueStatus, CS_FLAGSTATUS, teamgame_s::flagStatus, flagStatus_t, g_gametype, GT_CTF, GT_CTY, vmCvar_t::integer, qboolean, qfalse, qtrue, teamgame_s::redStatus, TEAM_BLUE, TEAM_FREE, TEAM_RED, teamgame, and trap_SetConfigstring(). Referenced by Team_CheckDroppedItem(), Team_InitGame(), Team_ResetFlag(), and Team_TouchEnemyFlag().
00272 {
00273 qboolean modified = qfalse;
00274
00275 switch( team ) {
00276 case TEAM_RED: // CTF
00277 if( teamgame.redStatus != status ) {
00278 teamgame.redStatus = status;
00279 modified = qtrue;
00280 }
00281 break;
00282
00283 case TEAM_BLUE: // CTF
00284 if( teamgame.blueStatus != status ) {
00285 teamgame.blueStatus = status;
00286 modified = qtrue;
00287 }
00288 break;
00289
00290 case TEAM_FREE: // One Flag CTF
00291 if( teamgame.flagStatus != status ) {
00292 teamgame.flagStatus = status;
00293 modified = qtrue;
00294 }
00295 break;
00296 }
00297
00298 if( modified ) {
00299 char st[4];
00300
00301 if( g_gametype.integer == GT_CTF || g_gametype.integer == GT_CTY ) {
00302 st[0] = ctfFlagStatusRemap[teamgame.redStatus];
00303 st[1] = ctfFlagStatusRemap[teamgame.blueStatus];
00304 st[2] = 0;
00305 }
00306
00307 trap_SetConfigstring( CS_FLAGSTATUS, st );
00308 }
00309 }
|
|
||||||||||||
|
Definition at line 617 of file g_team.c. References teamgame_s::blueStatus, teamgame_s::blueTakenTime, EV_GLOBAL_TEAM_SOUND, entityState_s::eventParm, FLAG_ATBASE, G_Printf(), G_TempEntity(), gentity_t, GTS_BLUE_TAKEN, GTS_RED_TAKEN, level, NULL, entityState_s::pos, gentity_s::r, teamgame_s::redStatus, teamgame_s::redTakenTime, gentity_s::s, SVF_BROADCAST, entityShared_t::svFlags, TEAM_BLUE, TEAM_RED, teamgame, level_locals_t::time, and trajectory_t::trBase. Referenced by Team_TouchEnemyFlag().
00617 {
00618 gentity_t *te;
00619
00620 if (ent == NULL) {
00621 G_Printf ("Warning: NULL passed to Team_TakeFlagSound\n");
00622 return;
00623 }
00624
00625 // only play sound when the flag was at the base
00626 // or not picked up the last 10 seconds
00627 switch(team) {
00628 case TEAM_RED:
00629 if( teamgame.blueStatus != FLAG_ATBASE ) {
00630 if (teamgame.blueTakenTime > level.time - 10000)
00631 return;
00632 }
00633 teamgame.blueTakenTime = level.time;
00634 break;
00635
00636 case TEAM_BLUE: // CTF
00637 if( teamgame.redStatus != FLAG_ATBASE ) {
00638 if (teamgame.redTakenTime > level.time - 10000)
00639 return;
00640 }
00641 teamgame.redTakenTime = level.time;
00642 break;
00643 }
00644
00645 te = G_TempEntity( ent->s.pos.trBase, EV_GLOBAL_TEAM_SOUND );
00646 if( team == TEAM_BLUE ) {
00647 te->s.eventParm = GTS_RED_TAKEN;
00648 }
00649 else {
00650 te->s.eventParm = GTS_BLUE_TAKEN;
00651 }
00652 te->r.svFlags |= SVF_BROADCAST;
00653 }
|
|
||||||||||||||||
|
Definition at line 818 of file g_team.c. References AddScore(), gentity_s::client, CTF_FLAG_BONUS, CTFMESSAGE_PLAYER_GOT_FLAG, entityShared_t::currentOrigin, FLAG_TAKEN, playerTeamState_t::flagsince, gclient_t, gentity_t, INT_MAX, level, entityState_s::number, gclient_s::pers, playerState_s::powerups, PrintCTFMessage(), gclient_s::ps, PW_BLUEFLAG, PW_REDFLAG, gentity_s::r, gentity_s::s, TEAM_RED, Team_SetFlagStatus(), Team_TakeFlagSound(), clientPersistant_t::teamState, and level_locals_t::time. Referenced by Pickup_Team().
00818 {
00819 gclient_t *cl = other->client;
00820
00821 //PrintMsg (NULL, "%s" S_COLOR_WHITE " got the %s flag!\n",
00822 // other->client->pers.netname, TeamName(team));
00823 PrintCTFMessage(other->s.number, team, CTFMESSAGE_PLAYER_GOT_FLAG);
00824
00825 if (team == TEAM_RED)
00826 cl->ps.powerups[PW_REDFLAG] = INT_MAX; // flags never expire
00827 else
00828 cl->ps.powerups[PW_BLUEFLAG] = INT_MAX; // flags never expire
00829
00830 Team_SetFlagStatus( team, FLAG_TAKEN );
00831
00832 AddScore(other, ent->r.currentOrigin, CTF_FLAG_BONUS);
00833 cl->pers.teamState.flagsince = level.time;
00834 Team_TakeFlagSound( ent, team );
00835
00836 return -1; // Do not respawn this automatically, but do delete it if it was FL_DROPPED
00837 }
|
|
||||||||||||||||
|
Definition at line 728 of file g_team.c. References AddScore(), AddTeamScore(), playerTeamState_t::assists, CalculateRanks(), playerTeamState_t::captures, gentity_s::client, CTF_CAPTURE_BONUS, CTF_FRAG_CARRIER_ASSIST_BONUS, CTF_FRAG_CARRIER_ASSIST_TIMEOUT, CTF_RECOVERY_BONUS, CTF_RETURN_FLAG_ASSIST_BONUS, CTF_RETURN_FLAG_ASSIST_TIMEOUT, CTF_TEAM_BONUS, CTFMESSAGE_PLAYER_CAPTURED_FLAG, CTFMESSAGE_PLAYER_RETURNED_FLAG, entityShared_t::currentOrigin, FL_DROPPED_ITEM, playerTeamState_t::flagrecovery, gentity_s::flags, g_entities, g_maxclients, gclient_t, gentity_t, vmCvar_t::integer, gentity_s::inuse, teamgame_s::last_capture_team, teamgame_s::last_flag_capture, playerTeamState_t::lastfraggedcarrier, playerTeamState_t::lasthurtcarrier, playerTeamState_t::lastreturnedflag, level, entityState_s::number, gclient_s::pers, PERS_ASSIST_COUNT, PERS_CAPTURES, playerState_s::persistant, entityState_s::pos, playerState_s::powerups, PrintCTFMessage(), gclient_s::ps, PW_BLUEFLAG, PW_REDFLAG, gentity_s::r, REWARD_SPRITE_TIME, gclient_s::rewardTime, gentity_s::s, gclient_s::sess, clientSession_t::sessionTeam, Team_CaptureFlagSound(), TEAM_RED, Team_ResetFlag(), Team_ResetFlags(), Team_ReturnFlagSound(), teamgame, clientPersistant_t::teamState, level_locals_t::time, and trajectory_t::trBase. Referenced by Pickup_Team().
00728 {
00729 int i;
00730 gentity_t *player;
00731 gclient_t *cl = other->client;
00732 int enemy_flag;
00733
00734 if (cl->sess.sessionTeam == TEAM_RED) {
00735 enemy_flag = PW_BLUEFLAG;
00736 } else {
00737 enemy_flag = PW_REDFLAG;
00738 }
00739
00740 if ( ent->flags & FL_DROPPED_ITEM ) {
00741 // hey, its not home. return it by teleporting it back
00742 //PrintMsg( NULL, "%s" S_COLOR_WHITE " returned the %s flag!\n",
00743 // cl->pers.netname, TeamName(team));
00744 PrintCTFMessage(other->s.number, team, CTFMESSAGE_PLAYER_RETURNED_FLAG);
00745
00746 AddScore(other, ent->r.currentOrigin, CTF_RECOVERY_BONUS);
00747 other->client->pers.teamState.flagrecovery++;
00748 other->client->pers.teamState.lastreturnedflag = level.time;
00749 //ResetFlag will remove this entity! We must return zero
00750 Team_ReturnFlagSound(Team_ResetFlag(team), team);
00751 return 0;
00752 }
00753
00754 // the flag is at home base. if the player has the enemy
00755 // flag, he's just won!
00756 if (!cl->ps.powerups[enemy_flag])
00757 return 0; // We don't have the flag
00758 //PrintMsg( NULL, "%s" S_COLOR_WHITE " captured the %s flag!\n", cl->pers.netname, TeamName(OtherTeam(team)));
00759 PrintCTFMessage(other->s.number, team, CTFMESSAGE_PLAYER_CAPTURED_FLAG);
00760
00761 cl->ps.powerups[enemy_flag] = 0;
00762
00763 teamgame.last_flag_capture = level.time;
00764 teamgame.last_capture_team = team;
00765
00766 // Increase the team's score
00767 AddTeamScore(ent->s.pos.trBase, other->client->sess.sessionTeam, 1);
00768 // Team_ForceGesture(other->client->sess.sessionTeam);
00769 //rww - don't really want to do this now. Mainly because performing a gesture disables your upper torso animations until it's done and you can't fire
00770
00771 other->client->pers.teamState.captures++;
00772 other->client->rewardTime = level.time + REWARD_SPRITE_TIME;
00773 other->client->ps.persistant[PERS_CAPTURES]++;
00774
00775 // other gets another 10 frag bonus
00776 AddScore(other, ent->r.currentOrigin, CTF_CAPTURE_BONUS);
00777
00778 Team_CaptureFlagSound( ent, team );
00779
00780 // Ok, let's do the player loop, hand out the bonuses
00781 for (i = 0; i < g_maxclients.integer; i++) {
00782 player = &g_entities[i];
00783 if (!player->inuse)
00784 continue;
00785
00786 if (player->client->sess.sessionTeam !=
00787 cl->sess.sessionTeam) {
00788 player->client->pers.teamState.lasthurtcarrier = -5;
00789 } else if (player->client->sess.sessionTeam ==
00790 cl->sess.sessionTeam) {
00791 if (player != other)
00792 AddScore(player, ent->r.currentOrigin, CTF_TEAM_BONUS);
00793 // award extra points for capture assists
00794 if (player->client->pers.teamState.lastreturnedflag +
00795 CTF_RETURN_FLAG_ASSIST_TIMEOUT > level.time) {
00796 AddScore (player, ent->r.currentOrigin, CTF_RETURN_FLAG_ASSIST_BONUS);
00797 other->client->pers.teamState.assists++;
00798
00799 player->client->ps.persistant[PERS_ASSIST_COUNT]++;
00800 player->client->rewardTime = level.time + REWARD_SPRITE_TIME;
00801
00802 } else if (player->client->pers.teamState.lastfraggedcarrier +
00803 CTF_FRAG_CARRIER_ASSIST_TIMEOUT > level.time) {
00804 AddScore(player, ent->r.currentOrigin, CTF_FRAG_CARRIER_ASSIST_BONUS);
00805 other->client->pers.teamState.assists++;
00806 player->client->ps.persistant[PERS_ASSIST_COUNT]++;
00807 player->client->rewardTime = level.time + REWARD_SPRITE_TIME;
00808 }
00809 }
00810 }
00811 Team_ResetFlags();
00812
00813 CalculateRanks();
00814
00815 return 0; // Do not respawn this automatically
00816 }
|
|
|
Definition at line 65 of file g_team.c. References S_COLOR_BLUE, S_COLOR_RED, S_COLOR_WHITE, S_COLOR_YELLOW, TEAM_BLUE, TEAM_RED, and TEAM_SPECTATOR.
00065 {
00066 if (team==TEAM_RED)
00067 return S_COLOR_RED;
00068 else if (team==TEAM_BLUE)
00069 return S_COLOR_BLUE;
00070 else if (team==TEAM_SPECTATOR)
00071 return S_COLOR_YELLOW;
00072 return S_COLOR_WHITE;
00073 }
|
|
|
Definition at line 45 of file g_team.c. References TEAM_BLUE, TEAM_RED, and TEAM_SPECTATOR. Referenced by BroadcastTeamChange(), and ClientSpawn().
00045 {
00046 if (team==TEAM_RED)
00047 return "RED";
00048 else if (team==TEAM_BLUE)
00049 return "BLUE";
00050 else if (team==TEAM_SPECTATOR)
00051 return "SPECTATOR";
00052 return "FREE";
00053 }
|
|
|
Definition at line 1094 of file g_team.c. References gentity_s::client, Com_sprintf(), g_entities, g_maxclients, gentity_t, vmCvar_t::integer, gentity_s::inuse, level, playerTeamState_t::location, gclient_s::pers, entityState_s::powerups, gclient_s::ps, qsort(), gentity_s::s, gclient_s::sess, clientSession_t::sessionTeam, level_locals_t::sortedClients, STAT_ARMOR, STAT_HEALTH, playerState_s::stats, strcpy(), strlen(), TEAM_MAXOVERLAY, clientPersistant_t::teamInfo, clientPersistant_t::teamState, trap_SendServerCommand(), va(), and playerState_s::weapon. Referenced by CheckTeamStatus().
01094 {
01095 char entry[1024];
01096 char string[8192];
01097 int stringlength;
01098 int i, j;
01099 gentity_t *player;
01100 int cnt;
01101 int h, a;
01102 int clients[TEAM_MAXOVERLAY];
01103
01104 if ( ! ent->client->pers.teamInfo )
01105 return;
01106
01107 // figure out what client should be on the display
01108 // we are limited to 8, but we want to use the top eight players
01109 // but in client order (so they don't keep changing position on the overlay)
01110 for (i = 0, cnt = 0; i < g_maxclients.integer && cnt < TEAM_MAXOVERLAY; i++) {
01111 player = g_entities + level.sortedClients[i];
01112 if (player->inuse && player->client->sess.sessionTeam ==
01113 ent->client->sess.sessionTeam ) {
01114 clients[cnt++] = level.sortedClients[i];
01115 }
01116 }
01117
01118 // We have the top eight players, sort them by clientNum
01119 qsort( clients, cnt, sizeof( clients[0] ), SortClients );
01120
01121 // send the latest information on all clients
01122 string[0] = 0;
01123 stringlength = 0;
01124
01125 for (i = 0, cnt = 0; i < g_maxclients.integer && cnt < TEAM_MAXOVERLAY; i++) {
01126 player = g_entities + i;
01127 if (player->inuse && player->client->sess.sessionTeam ==
01128 ent->client->sess.sessionTeam ) {
01129
01130 h = player->client->ps.stats[STAT_HEALTH];
01131 a = player->client->ps.stats[STAT_ARMOR];
01132 if (h < 0) h = 0;
01133 if (a < 0) a = 0;
01134
01135 Com_sprintf (entry, sizeof(entry),
01136 " %i %i %i %i %i %i",
01137 // level.sortedClients[i], player->client->pers.teamState.location, h, a,
01138 i, player->client->pers.teamState.location, h, a,
01139 player->client->ps.weapon, player->s.powerups);
01140 j = strlen(entry);
01141 if (stringlength + j > sizeof(string))
01142 break;
01143 strcpy (string + stringlength, entry);
01144 stringlength += j;
01145 cnt++;
01146 }
01147 }
01148
01149 trap_SendServerCommand( ent-g_entities, va("tinfo %i %s", cnt, string) );
01150 }
|
|
|
Definition at line 18 of file g_team.c. Referenced by Team_InitGame(), Team_SetFlagStatus(), Team_TakeFlagSound(), and Team_TouchOurFlag(). |