qboolean SV_ValidClientMulticast(client_t *client, int soundLeaf, int to){ if (Host_IsSinglePlayerGame() || client->proxy) { return TRUE; } int destination = to & ~(MSG_FL_ONE); if (destination == MSG_FL_BROADCAST) { return TRUE; } unsigned char* mask; if (destination == MSG_FL_PVS) { mask = CM_LeafPVS(soundLeaf); } else { if (destination == MSG_FL_PAS) { mask = CM_LeafPAS(soundLeaf); } else { Con_Printf("MULTICAST: Error %d!\n", to); return FALSE; } } if (!mask) { return TRUE; } const edict_t *viewent = client->pViewEntity; if (!viewent) { viewent = client->edict; } const vec3_t& origin_ref = viewent->v.origin; vec_t* vec_t_ptr = const_cast<vec_t*>(reinterpret_cast<const vec_t*>(&origin_ref)); int bitNumber = SV_PointLeafnum(vec_t_ptr); if (mask[(bitNumber - 1) >> 3] & (1 << ((bitNumber - 1) & 7))) { return TRUE; } return FALSE;}