void G_smvAdd_cmd(gentity_t *ent) { int pID; char str[MAX_TOKEN_CHARS]; // Clients will always send pIDs trap_Argv(1, str, sizeof(str)); pID = atoi(str); if (pID < 0 || pID > level.maxclients || g_entities[pID].client->pers.connected != CON_CONNECTED) { CP(va("print \"[lof]** [lon]Client[lof] %d [lon]is not connected[lof]!\n\"", pID)); return; } if (g_entities[pID].client->sess.sessionTeam == TEAM_SPECTATOR) { CP(va("print \"[lof]** [lon]Client[lof] %s^7 [lon]is not in the game[lof]!\n\"", level.clients[pID].pers.netname)); return; } if (!G_allowFollow(ent, G_teamID(&g_entities[pID]))) { CP(va("print \"[lof]** [lon]The %s team is locked from spectators[lof]!\n\"", aTeams[G_teamID(&g_entities[pID])])); return; } G_smvAddView(ent, pID); }
void G_smvAddTeam_cmd(gentity_t *ent, int nTeam) { int i, pID; if (!G_allowFollow(ent, nTeam)) { CP(va("print \"[lof]** [lon]The %s team is locked from spectators[lof]!\n\"", aTeams[nTeam])); return; } // For limbo'd MV action if (ent->client->sess.sessionTeam != TEAM_SPECTATOR && (!(ent->client->ps.pm_flags & PMF_LIMBO) || ent->client->sess.sessionTeam != nTeam)) { return; } for (i = 0; i < level.numPlayingClients; i++) { pID = level.sortedClients[i]; if (g_entities[pID].client->sess.sessionTeam == nTeam && ent != &g_entities[pID]) { G_smvAddView(ent, pID); } } }
/** * @brief Figure out if we are allowed/want to follow a given player * @param[in] ent * @param[in] nTeam * @return */ qboolean G_desiredFollow(gentity_t *ent, int nTeam) { if (G_allowFollow(ent, nTeam) && (ent->client->sess.spec_team == 0 || ent->client->sess.spec_team == nTeam)) { return qtrue; } return qfalse; }
/** * @brief Return blockout status for a player * @param[in] ent * @param[in] nTeam * @return */ int G_blockoutTeam(gentity_t *ent, int nTeam) { return(!G_allowFollow(ent, nTeam)); }