/** * @brief Chain together all entities with a matching team field. * All but the first will have the FL_GROUPSLAVE flag set. * All but the last will have the groupchain field set to the next one */ static void G_FindEdictGroups (void) { edict_t *ent = G_EdictsGetFirst(); /* the first edict is always a world edict that can be skipped */ while ((ent = G_EdictsGetNextInUse(ent))) { edict_t *ent2, *chain; if (!ent->group) continue; if (ent->flags & FL_GROUPSLAVE) continue; chain = ent; ent->groupMaster = ent; ent2 = ent; /* search only the remainder of the entities */ while ((ent2 = G_EdictsGetNextInUse(ent2))) { if (!ent2->group) continue; if (ent2->flags & FL_GROUPSLAVE) continue; if (Q_streq(ent->group, ent2->group)) { chain->groupChain = ent2; ent2->groupMaster = ent; chain = ent2; ent2->flags |= FL_GROUPSLAVE; } } } }
/** * @brief Chain together all entities with a matching team field. * All but the first will have the FL_GROUPSLAVE flag set. * All but the last will have the groupchain field set to the next one */ static void G_FindEdictGroups (void) { Edict* ent = G_EdictsGetFirst(); /* the first edict is always a world edict that can be skipped */ while ((ent = G_EdictsGetNextInUse(ent))) { /* no group at all */ if (!ent->group) continue; /* already marked as slave in another group */ if (ent->flags & FL_GROUPSLAVE) continue; Edict* chain = ent; ent->groupMaster = ent; Edict* groupMember = ent; /* search only the remainder of the entities */ while ((groupMember = G_EdictsGetNextInUse(groupMember))) { /* no group at all */ if (!groupMember->group) continue; /* already marked as slave in another group */ if (groupMember->flags & FL_GROUPSLAVE) continue; /* same group as the master? */ if (Q_streq(ent->group, groupMember->group)) { chain->groupChain = groupMember; groupMember->groupMaster = ent; chain = groupMember; groupMember->flags |= FL_GROUPSLAVE; } } } }
static void G_SendBoundingBoxes (void) { if (sv_send_edicts->integer) { edict_t *ent = G_EdictsGetFirst(); /* skip the world */ while ((ent = G_EdictsGetNextInUse(ent))) G_EventSendEdict(ent); } }
/** * @brief Send brush models for entities like func_breakable and func_door and triggers * with their bounding boxes to the client and let him know about them. * There are also entities that are announced here, but fully handled clientside - like * func_rotating. * @sa CL_AddBrushModel * @sa EV_ADD_BRUSH_MODEL * @param[in] player The player the edicts are send to */ static void G_ClientSendEdictsAndBrushModels (const player_t *player) { const int mask = G_PlayerToPM(player); /* skip the world */ edict_t *ent = G_EdictsGetFirst(); /* make SOLID_BSP edicts visible to the client */ while ((ent = G_EdictsGetNextInUse(ent))) { /* brush models that have a type - not the world - keep in * mind that there are several world edicts in the list in case of * a map assembly */ if (ent->solid != SOLID_BSP) continue; /* skip the world(s) in case of map assembly */ if (ent->type > ET_NULL) { G_EventAddBrushModel(mask, ent); G_VisFlagsAdd(ent, ~ent->visflags); } } }