本文整理汇总了C++中CG_IsOnFireteam函数的典型用法代码示例。如果您正苦于以下问题:C++ CG_IsOnFireteam函数的具体用法?C++ CG_IsOnFireteam怎么用?C++ CG_IsOnFireteam使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CG_IsOnFireteam函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CG_FireteamHasClass
qboolean CG_FireteamHasClass(int classnum, qboolean selectedonly) {
fireteamData_t *ft;
int i;
ft = CG_IsOnFireteam(cg.clientNum);
if (!ft) {
return qfalse;
}
for (i = 0; i < MAX_CLIENTS; i++) {
if (!cgs.clientinfo[i].infoValid) {
continue;
}
if (ft != CG_IsOnFireteam(i)) {
continue;
}
if (cgs.clientinfo[i].cls != classnum) {
continue;
}
if (selectedonly && !cgs.clientinfo[i].selected) {
continue;
}
return qtrue;
}
return qfalse;
}
示例2: CG_IsOnFireteam
// Client, not sorted by rank, on CLIENT'S fireteam
clientInfo_t *CG_FireTeamPlayerForPosition(int pos, int max)
{
int i, cnt = 0;
fireteamData_t *f = CG_IsOnFireteam(cg.clientNum);
if (!f)
{
return NULL;
}
for (i = 0; i < MAX_CLIENTS && cnt < max; i++)
{
if (cgs.clientinfo[i].infoValid && cgs.clientinfo[cg.clientNum].team == cgs.clientinfo[i].team)
{
if (!(f == CG_IsOnFireteam(i)))
{
continue;
}
if (cnt == pos)
{
return &cgs.clientinfo[i];
}
cnt++;
}
}
return NULL;
}
示例3: CG_IsOnFireteam
// Fireteam that both specified clients are on, if they both are on the same team
fireteamData_t *CG_IsOnSameFireteam(int clientNum, int clientNum2) {
if (CG_IsOnFireteam(clientNum) == CG_IsOnFireteam(clientNum2)) {
return CG_IsOnFireteam(clientNum);
}
return NULL;
}
示例4: CG_CountPlayersSF
int CG_CountPlayersSF(void)
{
int i, cnt = 0;
for (i = 0; i < MAX_CLIENTS; i++)
{
if (i == cg.clientNum)
{
continue;
}
if (!cgs.clientinfo[i].infoValid)
{
continue;
}
if (cgs.clientinfo[i].team != cgs.clientinfo[cg.clientNum].team)
{
continue;
}
if (CG_IsOnFireteam(i) != CG_IsOnFireteam(cg.clientNum))
{
continue;
}
cnt++;
}
return cnt;
}
示例5: CG_IsOnFireteam
// Client, sorted by rank, on CLIENT'S fireteam
clientInfo_t *CG_SortedFireTeamPlayerForPosition(int pos, int max)
{
int i, cnt = 0;
fireteamData_t *f = CG_IsOnFireteam(cg.clientNum);
if (!f)
{
return NULL;
}
for (i = 0; i < MAX_CLIENTS && cnt < max; i++)
{
if (!(f == CG_IsOnFireteam(sortedFireTeamClients[i])))
{
return NULL;
}
if (cnt == pos)
{
return &cgs.clientinfo[sortedFireTeamClients[i]];
}
cnt++;
}
return NULL;
}
示例6: CG_PlayerNFFromPos
int CG_PlayerNFFromPos(int pos, int *pageofs)
{
int x, i;
if (!CG_IsOnFireteam(cg.clientNum))
{
*pageofs = 0;
return -1;
}
x = CG_CountPlayersNF();
if (x < ((*pageofs) * 8))
{
*pageofs = 0;
}
x = 0;
for (i = 0; i < MAX_CLIENTS; i++)
{
if (i == cg.clientNum)
{
continue;
}
if (!cgs.clientinfo[i].infoValid)
{
continue;
}
if (cgs.clientinfo[i].team != cgs.clientinfo[cg.clientNum].team)
{
continue;
}
if (CG_IsOnFireteam(i))
{
continue;
}
if (x >= ((*pageofs) * 8) && x < ((*pageofs + 1) * 8))
{
int ofs = x - ((*pageofs) * 8);
if (pos == ofs)
{
return i;
}
}
x++;
}
return -1;
}
示例7: CG_DrawUpperRight
/*
=====================
CG_DrawUpperRight
=====================
*/
void CG_DrawUpperRight(void)
{
int y = 152; // 20 + 100 + 32;
if (cg_drawFireteamOverlay.integer && CG_IsOnFireteam(cg.clientNum))
{
CG_DrawFireTeamOverlay(&activehud->fireteam.location);
}
if (!(cg.snap->ps.pm_flags & PMF_LIMBO) && (cg.snap->ps.persistant[PERS_TEAM] != TEAM_SPECTATOR) &&
(cgs.autoMapExpanded || (!cgs.autoMapExpanded && (cg.time - cgs.autoMapExpandTime < 250.f))))
{
return;
}
if (cg_drawRoundTimer.integer)
{
y = CG_DrawTimer(y);
}
if (cg_drawFPS.integer)
{
y = CG_DrawFPS(y);
}
if (cg_drawSnapshot.integer)
{
y = CG_DrawSnapshot(y);
}
}
示例8: CG_QuickFireteams_f
static void CG_QuickFireteams_f( void ) {
if( cg.showFireteamMenu ) {
if( cgs.ftMenuMode == 0 ) {
CG_EventHandling( CGAME_EVENT_NONE, qfalse );
} else {
cgs.ftMenuMode = 0;
}
} else if( CG_IsOnFireteam( cg.clientNum ) ) {
CG_EventHandling( CGAME_EVENT_FIRETEAMMSG, qfalse );
cgs.ftMenuMode = 0;
}
}
示例9: CG_IsFireTeamLeader
// Fireteam that specified client is leader of, or NULL if none
fireteamData_t* CG_IsFireTeamLeader( int clientNum ) {
fireteamData_t* f;
if(!(f = CG_IsOnFireteam(clientNum))) {
return NULL;
}
if(f->leader != clientNum) {
return NULL;
}
return f ;
}
示例10: CG_ClientInfoForPosition
// Client, not on a fireteam, not sorted, but on your team
clientInfo_t* CG_ClientInfoForPosition(int pos, int max) {
int i, cnt = 0;
for(i = 0; i < MAX_CLIENTS && cnt < max; i++) {
if(cg.clientNum != i && cgs.clientinfo[i].infoValid && !CG_IsOnFireteam( i ) && cgs.clientinfo[cg.clientNum].team == cgs.clientinfo[i].team ) {
if(cnt == pos) {
return &cgs.clientinfo[i];
}
cnt++;
}
}
return NULL;
}
示例11: CG_SelectBuddy_f
static void CG_SelectBuddy_f( void ) {
int pos = atoi( CG_Argv( 1 ) );
int i;
clientInfo_t* ci;
if( !CG_IsOnFireteam( cg.clientNum ) ) {
return; // Gordon: we aren't a leader, so dont allow selection
}
// Gordon:
// 0 - 5 = select that person
// -1 = none
// -2 = all
switch( pos ) {
case -1:
for(i = 0; i < MAX_FIRETEAM_MEMBERS; i++) {
ci = CG_SortedFireTeamPlayerForPosition( i );
if( !ci ) {
return; // there was no-one in this position
}
ci->selected = qfalse;
}
return;
case -2:
for(i = 0; i < MAX_FIRETEAM_MEMBERS; i++) {
ci = CG_SortedFireTeamPlayerForPosition( i );
if(!ci) {
return; // there was no-one in this position
}
ci->selected = qtrue;
}
return;
}
if( pos >= MAX_FIRETEAM_MEMBERS || pos < 0)
return;
ci = CG_SortedFireTeamPlayerForPosition( pos );
if( !ci ) {
return; // there was no-one in this position
}
ci->selected ^= qtrue;
}
示例12: CG_SelectBuddy_f
static void CG_SelectBuddy_f(void)
{
int pos = atoi(CG_Argv(1));
int i;
clientInfo_t *ci;
// 0 - 7 = select that person
// -1 = none
// -2 = all
switch (pos)
{
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
if (!CG_IsOnFireteam(cg.clientNum))
{
break; // we aren't a leader, so dont allow selection
}
ci = CG_SortedFireTeamPlayerForPosition(pos);
if (!ci)
{
break; // there was no-one in this position
}
ci->selected ^= qtrue;
break;
case -1:
if (!CG_IsOnFireteam(cg.clientNum))
{
break; // we aren't a leader, so dont allow selection
}
for (i = 0; i < MAX_FIRETEAM_MEMBERS; i++)
{
ci = CG_SortedFireTeamPlayerForPosition(i);
if (!ci)
{
break; // there was no-one in this position
}
ci->selected = qfalse;
}
break;
case -2:
if (!CG_IsOnFireteam(cg.clientNum))
{
break; // we aren't a leader, so dont allow selection
}
for (i = 0; i < MAX_FIRETEAM_MEMBERS; i++)
{
ci = CG_SortedFireTeamPlayerForPosition(i);
if (!ci)
{
break; // there was no-one in this position
}
ci->selected = qtrue;
}
break;
}
}
示例13: CG_ParseFireteams
// Parses fireteam servercommand
void CG_ParseFireteams()
{
int i, j;
char *s;
const char *p;
int clnts[2];
qboolean onFireteam2;
qboolean isLeader2;
// qboolean onFireteam = CG_IsOnFireteam( cg.clientNum ) ? qtrue : qfalse;
// qboolean isLeader = CG_IsFireTeamLeader( cg.clientNum ) ? qtrue : qfalse;
for (i = 0; i < MAX_CLIENTS; i++)
{
cgs.clientinfo[i].fireteamData = NULL;
}
for (i = 0; i < MAX_FIRETEAMS; i++)
{
char hexbuffer[11] = "0x00000000";
p = CG_ConfigString(CS_FIRETEAMS + i);
/* s = Info_ValueForKey(p, "n");
if(!s || !*s) {
cg.fireTeams[i].inuse = qfalse;
continue;
} else {
cg.fireTeams[i].inuse = qtrue;
}*/
// Q_strncpyz(cg.fireTeams[i].name, s, 32);
// CG_Printf("Fireteam: %s\n", cg.fireTeams[i].name);
j = atoi(Info_ValueForKey(p, "id"));
if (j == -1)
{
cg.fireTeams[i].inuse = qfalse;
continue;
}
else
{
cg.fireTeams[i].inuse = qtrue;
cg.fireTeams[i].ident = j;
}
s = Info_ValueForKey(p, "l");
cg.fireTeams[i].leader = atoi(s);
s = Info_ValueForKey(p, "c");
Q_strncpyz(hexbuffer + 2, s, 9);
sscanf(hexbuffer, "%x", &clnts[1]);
Q_strncpyz(hexbuffer + 2, s + 8, 9);
sscanf(hexbuffer, "%x", &clnts[0]);
for (j = 0; j < MAX_CLIENTS; j++)
{
if (COM_BitCheck(clnts, j))
{
cg.fireTeams[i].joinOrder[j] = qtrue;
cgs.clientinfo[j].fireteamData = &cg.fireTeams[i];
// CG_Printf("%s\n", cgs.clientinfo[j].name);
}
else
{
cg.fireTeams[i].joinOrder[j] = qfalse;
}
}
}
CG_SortClientFireteam();
onFireteam2 = CG_IsOnFireteam(cg.clientNum) ? qtrue : qfalse;
isLeader2 = CG_IsFireTeamLeader(cg.clientNum) ? qtrue : qfalse;
}
示例14: CG_Fireteams_MenuText_Draw
void CG_Fireteams_MenuText_Draw(panel_button_t *button)
{
float y = button->rect.y;
int i;
switch (cgs.ftMenuMode)
{
case 0:
if (cgs.ftMenuPos == -1)
{
for (i = 0; ftMenuRootStrings[i]; i++)
{
const char *str;
if (i < 5)
{
if (!CG_FireteamHasClass(i, qtrue))
{
continue;
}
}
if (cg_quickMessageAlt.integer)
{
str = va("%i. %s", (i + 1) % 10, ftMenuRootStrings[i]);
}
else
{
str = va("%s. %s", ftMenuRootStringsAlphachars[i], ftMenuRootStrings[i]);
}
CG_Text_Paint_Ext(button->rect.x, y, button->font->scalex, button->font->scaley, button->font->colour, str, 0,
0, button->font->style, button->font->font);
y += button->rect.h;
}
}
else
{
if (cgs.ftMenuPos < 0 || cgs.ftMenuPos > 4)
{
return;
}
else
{
const char **strings = ftMenuStrings[cgs.ftMenuPos];
for (i = 0; strings[i]; i++)
{
const char *str;
if (cg_quickMessageAlt.integer)
{
str = va("%i. %s", (i + 1) % 10, strings[i]);
}
else
{
str = va("%s. %s", (ftMenuStringsAlphachars[cgs.ftMenuPos])[i], strings[i]);
}
CG_Text_Paint_Ext(button->rect.x, y, button->font->scalex, button->font->scaley, button->font->colour,
str, 0, 0, button->font->style, button->font->font);
y += button->rect.h;
}
}
}
break;
case 1:
if (!CG_IsOnFireteam(cg.clientNum))
{
for (i = 0; ftOffMenuList[i]; i++)
{
const char *str;
if (i == 0 && !CG_CountFireteamsByTeam(cgs.clientinfo[cg.clientNum].team))
{
continue;
}
if (cg_quickMessageAlt.integer)
{
str = va("%i. %s", (i + 1) % 10, ftOffMenuList[i]);
}
else
{
str = va("%s. %s", ftOffMenuListAlphachars[i], ftOffMenuList[i]);
}
CG_Text_Paint_Ext(button->rect.x, y, button->font->scalex, button->font->scaley, button->font->colour, str, 0,
0, button->font->style, button->font->font);
y += button->rect.h;
}
}
else
{
if (!CG_IsFireTeamLeader(cg.clientNum))
//.........这里部分代码省略.........
示例15: CG_DrawFireTeamOverlay
// FIXME: add more options to shorten this box
void CG_DrawFireTeamOverlay(rectDef_t *rect)
{
int x = rect->x;
int y = rect->y + 1; // +1, jitter it into place in 1024 :)
int i;
int boxWidth = 106;
int bestWidth = -1;
char buffer[64];
float h = 16; // 12 + 2 + 2
clientInfo_t *ci = NULL;
fireteamData_t *f = NULL;
char *locStr[MAX_FIRETEAM_MEMBERS];
int locwidth;
int namewidth;
vec3_t origin;
int curWeap;
// assign fireteam data, and early out if not on one
if (!(f = CG_IsOnFireteam(cg.clientNum)))
{
return;
}
memset(locStr, 0, sizeof(locStr));
// First get name and location width, also store location names
for (i = 0; i < MAX_FIRETEAM_MEMBERS; i++)
{
ci = CG_SortedFireTeamPlayerForPosition(i);
// Make sure it's valid
if (!ci)
{
break;
}
origin[0] = ci->location[0];
origin[1] = ci->location[1];
locStr[i] = CG_BuildLocationString(ci->clientNum, origin, LOC_FTEAM);
if (!locStr[i][1] || !*locStr[i])
{
locStr[i] = "";
}
locwidth = CG_Text_Width_Ext(locStr[i], 0.2f, 0, &cgs.media.limboFont2);
//if ( cg_fixedFTeamSize.integer ) {
// namewidth = 102;
//}
//else {
namewidth = CG_Text_Width_Ext(ci->name, 0.2f, 17, &cgs.media.limboFont2);
if (ci->health == 0)
{
namewidth += 7;
}
//}
if ((locwidth + namewidth) > bestWidth)
{
bestWidth = locwidth + namewidth;
}
h += 12.f;
}
boxWidth += bestWidth;
CG_DrawRect(x, y, boxWidth, h, 1, borderColor);
CG_FillRect(x + 1, y + 1, boxWidth - 2, h - 2, bgColor);
x += 2;
y += 2;
CG_FillRect(x, y, boxWidth - 4, 12, clr1);
Com_sprintf(buffer, 64, "Fireteam: %s", bg_fireteamNames[f->ident]);
Q_strupr(buffer);
CG_Text_Paint_Ext(x + 3, y + FT_BAR_HEIGHT, .19f, .19f, tclr, buffer, 0, 0, 0, &cgs.media.limboFont1);
x += 2;
for (i = 0; i < MAX_FIRETEAM_MEMBERS; i++)
{
y += FT_BAR_HEIGHT + FT_BAR_YSPACING;
x = rect->x + 2;
// Grab a pointer to the current player
ci = CG_SortedFireTeamPlayerForPosition(i);
// Make sure it's valid
if (!ci)
{
break;
}
//.........这里部分代码省略.........