Go to the source code of this file.
|
|
Definition at line 18 of file g_team.h. Referenced by Team_FragBonuses(). |
|
|
Definition at line 4 of file g_team.h. Referenced by Team_TouchOurFlag(). |
|
|
Definition at line 11 of file g_team.h. Referenced by Team_FragBonuses(). |
|
|
Definition at line 20 of file g_team.h. Referenced by Team_FragBonuses(). |
|
|
Definition at line 12 of file g_team.h. Referenced by Team_FragBonuses(). |
|
|
Definition at line 7 of file g_team.h. Referenced by Team_TouchEnemyFlag(). |
|
|
Definition at line 13 of file g_team.h. Referenced by Team_FragBonuses(). |
|
|
|
|
|
Definition at line 15 of file g_team.h. Referenced by Team_TouchOurFlag(). |
|
|
Definition at line 21 of file g_team.h. Referenced by Team_TouchOurFlag(). |
|
|
Definition at line 8 of file g_team.h. Referenced by Team_FragBonuses(). |
|
|
|
|
|
|
|
|
Definition at line 6 of file g_team.h. Referenced by Team_TouchOurFlag(). |
|
|
Definition at line 14 of file g_team.h. Referenced by Team_TouchOurFlag(). |
|
|
Definition at line 22 of file g_team.h. Referenced by Team_TouchOurFlag(). |
|
|
Definition at line 17 of file g_team.h. Referenced by Team_FragBonuses(). |
|
|
Definition at line 5 of file g_team.h. Referenced by Team_TouchOurFlag(). |
|
|
|
|
||||||||||||||||
|
|
|
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 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 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 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 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 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 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 }
|