void CG_DrawPlayerSF(panel_button_t *button, int *pageofs) { float y = button->rect.y; const char *str; int i, x; for (i = 0; i < 8; i++) { x = CG_PlayerSFFromPos(i, pageofs); if (x == -1) { break; } if (cg_quickMessageAlt.integer) { str = va("%i. %s", (i + 1) % 10, cgs.clientinfo[x].name); } else { str = va("%c. %s", 'A' + i, cgs.clientinfo[x].name); } 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; } if (*pageofs) { if (cg_quickMessageAlt.integer) { str = va("%i. %s", (8 + 1) % 10, CG_TranslateString("Previous")); } else { str = va("%c. %s", 'P', CG_TranslateString("Previous")); } 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; } if (CG_CountPlayersSF() > (*pageofs + 1) * 8) { if (cg_quickMessageAlt.integer) { str = va("%i. %s", (9 + 1) % 10, CG_TranslateString("Next")); } else { str = va("%c. %s", 'N', CG_TranslateString("Next")); } 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; } }
qboolean CG_FireteamCheckExecKey(int key, qboolean doaction) { if (key == K_ESCAPE) { return qtrue; } if ((key & K_CHAR_FLAG)) { return qfalse; } key &= ~K_CHAR_FLAG; switch (cgs.ftMenuMode) { case 0: if (cgs.ftMenuPos == -1) { if (cg_quickMessageAlt.integer) { if (key >= '0' && key <= '9') { int i = ((key - '0') + 9) % 10; if (i < 5) { if (!CG_FireteamHasClass(i, qtrue)) { return qfalse; } } if (i > 7) { return qfalse; } if (doaction) { if (i < 5) { cgs.ftMenuPos = i; } else if (i == 5) { CG_QuickFireteamMessage_f(); } else { trap_SendClientCommand(va ("vsay_buddy -1 %s %s", CG_BuildSelectedFirteamString(), ftMenuRootStringsMsg[i])); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } } return qtrue; } } else { int i; if (key >= 'a' || key <= 'z') { for (i = 0; ftMenuRootStrings[i]; i++) { if (key == tolower(*ftMenuRootStringsAlphachars[i])) { if (i < 5) { if (!CG_FireteamHasClass(i, qtrue)) { return qfalse; } } if (doaction) { if (i < 5) { cgs.ftMenuPos = i; } else if (i == 5) { CG_QuickFireteamMessage_f(); } else { trap_SendClientCommand(va ("vsay_buddy -1 %s %s", CG_BuildSelectedFirteamString(), ftMenuRootStringsMsg[i])); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } } return qtrue; } } } } } else { if (cgs.ftMenuPos < 0 || cgs.ftMenuPos > 4) { return qfalse; } if (cg_quickMessageAlt.integer) { if (key >= '0' && key <= '9') { int i = ((key - '0') + 9) % 10; int x; const char **strings = ftMenuStrings[cgs.ftMenuPos]; for (x = 0; strings[x]; x++) { if (x == i) { if (doaction) { trap_SendClientCommand(va ("vsay_buddy %i %s %s", cgs.ftMenuPos, CG_BuildSelectedFirteamString(), (ftMenuStringsMsg[cgs.ftMenuPos])[i])); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } return qtrue; } } } } else { int i; const char **strings = ftMenuStrings[cgs.ftMenuPos]; if (key >= 'a' || key <= 'z') { for (i = 0; strings[i]; i++) { if (key == tolower(*ftMenuStringsAlphachars[cgs.ftMenuPos][i])) { if (doaction) { trap_SendClientCommand(va ("vsay_buddy %i %s %s", cgs.ftMenuPos, CG_BuildSelectedFirteamString(), (ftMenuStringsMsg[cgs.ftMenuPos])[i])); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } return qtrue; } } } } } break; case 1: { int i = -1, x; if (cg_quickMessageAlt.integer) { if (key >= '0' && key <= '9') { i = ((key - '0') + 9) % 10; } } else { const char **strings; if (!CG_IsOnFireteam(cg.clientNum)) { strings = ftOffMenuListAlphachars; } else { if (!CG_IsFireTeamLeader(cg.clientNum)) { strings = ftOnMenuListAlphachars; } else { strings = ftLeaderMenuListAlphachars; } } if (key >= 'a' || key <= 'z') { for (x = 0; strings[x]; x++) { if (key == tolower(*strings[x])) { i = x; break; } } } } if (i == -1) { break; } if (!CG_IsOnFireteam(cg.clientNum)) { if (i >= 2) { break; } if (i == 0 && !CG_CountFireteamsByTeam(cgs.clientinfo[cg.clientNum].team)) { return qfalse; } if (doaction) { if (i == 1) { trap_SendConsoleCommand("fireteam create\n"); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } else { cgs.ftMenuMode = 2; cgs.ftMenuModeEx = 0; cgs.ftMenuPos = i; } } return qtrue; } else { if (!CG_IsFireTeamLeader(cg.clientNum)) { if (i >= 2) { break; } if (i == 0 && !CG_CountPlayersNF()) { break; } if (doaction) { if (i == 1) { trap_SendConsoleCommand("fireteam leave\n"); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } else { cgs.ftMenuMode = 3; cgs.ftMenuModeEx = 0; cgs.ftMenuPos = i; } } return qtrue; } else { if (i >= 5) { break; } if (i == 2 && !CG_CountPlayersNF()) { break; } if ((i == 3 || i == 4) && !CG_CountPlayersSF()) { break; } if (doaction) { if (i == 0) { trap_SendConsoleCommand("fireteam disband\n"); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } else if (i == 1) { trap_SendConsoleCommand("fireteam leave\n"); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } else { cgs.ftMenuMode = 4; cgs.ftMenuModeEx = 0; cgs.ftMenuPos = i; } } return qtrue; } } } break; case 2: { int i; for (i = 0; i < MAX_FIRETEAMS; i++) { if (!cg.fireTeams[i].inuse) { continue; } if (cgs.clientinfo[cg.fireTeams[i].leader].team != cgs.clientinfo[cg.clientNum].team) { continue; } if (cg_quickMessageAlt.integer) { if (key >= '0' && key <= '9') { if (((key - '0') + 9) % 10 == cg.fireTeams[i].ident) { if (doaction) { trap_SendConsoleCommand(va("fireteam apply %i", i + 1)); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } return qtrue; } } } else { if (key >= 'a' || key <= 'z') { if (key - 'a' == cg.fireTeams[i].ident) { if (doaction) { trap_SendConsoleCommand(va("fireteam apply %i", i + 1)); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } return qtrue; } } } } } break; case 3: { int i = -1, x; if (cg_quickMessageAlt.integer) { if (key >= '0' && key <= '9') { i = ((key - '0') + 9) % 10; } } else { if (key >= 'a' || key <= 'g') { i = key - 'a'; } if (key == 'n') { i = 9; } if (key == 'p') { i = 0; } } if (i == -1) { break; } if (CG_CountPlayersNF() > (cgs.ftMenuModeEx + 1) * 8) { if (i == 0) { cgs.ftMenuModeEx++; } } if (cgs.ftMenuModeEx) { if (i == 9) { cgs.ftMenuModeEx--; } } x = CG_PlayerNFFromPos(i, &cgs.ftMenuModeEx); if (x != -1) { if (doaction) { trap_SendConsoleCommand(va("fireteam propose %i", x + 1)); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } return qtrue; } break; } break; case 4: { int i = -1, x; if (cg_quickMessageAlt.integer) { if (key >= '0' && key <= '9') { i = ((key - '0') + 9) % 10; } } else { if (key >= 'a' || key <= 'g') { i = key - 'a'; } if (key == 'n') { i = 9; } if (key == 'p') { i = 8; } } if (i == -1) { break; } switch (cgs.ftMenuPos) { case 2: if (CG_CountPlayersNF() > (cgs.ftMenuModeEx + 1) * 8) { if (i == 9) { if (doaction) { cgs.ftMenuModeEx++; } return qtrue; } } if (cgs.ftMenuModeEx) { if (i == 8) { if (doaction) { cgs.ftMenuModeEx--; } return qtrue; } } x = CG_PlayerNFFromPos(i, &cgs.ftMenuModeEx); if (x != -1) { if (doaction) { trap_SendConsoleCommand(va("fireteam invite %i", x + 1)); CG_EventHandling(CGAME_EVENT_NONE, qfalse); } return qtrue; } break; case 3: case 4: if (CG_CountPlayersSF() > (cgs.ftMenuModeEx + 1) * 8) { if (i == 0) { cgs.ftMenuModeEx++; } } if (cgs.ftMenuModeEx) { if (i == 9) { cgs.ftMenuModeEx--; } } x = CG_PlayerSFFromPos(i, &cgs.ftMenuModeEx); if (x != -1) { if (doaction) { switch (cgs.ftMenuPos) { case 4: trap_SendConsoleCommand(va("fireteam warn %i", x + 1)); CG_EventHandling(CGAME_EVENT_NONE, qfalse); break; case 3: trap_SendConsoleCommand(va("fireteam kick %i", x + 1)); CG_EventHandling(CGAME_EVENT_NONE, qfalse); break; } } return qtrue; } break; } } break; } return qfalse; }