MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / MultiDoVisiblePlayers

Function MultiDoVisiblePlayers

Descent3/multi.cpp:6244–6284  ·  view source on GitHub ↗

Server is telling us about players that we can see

Source from the content-addressed store, hash-verified

6242
6243// Server is telling us about players that we can see
6244void MultiDoVisiblePlayers(uint8_t *data) {
6245 int count = 0;
6246 int i;
6247
6248 if (Netgame.local_role == LR_SERVER)
6249 return;
6250
6251 SKIP_HEADER(data, &count);
6252
6253 int bitmask = MultiGetUint(data, &count);
6254
6255 MULTI_ASSERT_NOMESSAGE(MAX_NET_PLAYERS <= 32);
6256
6257 for (i = 0; i < MAX_NET_PLAYERS; i++) {
6258 int hide_it = 0;
6259
6260 if (i == Player_num)
6261 continue;
6262
6263 if (!(NetPlayers[i].flags & NPF_CONNECTED) || NetPlayers[i].sequence != NETSEQ_PLAYING)
6264 hide_it = 1;
6265
6266 if (!(bitmask & (1 << i)) || hide_it) {
6267 if (Objects[Players[i].objnum].type == OBJ_PLAYER || hide_it) {
6268 // Kill all the sounds, render types, etc.
6269 Objects[Players[i].objnum].render_type = RT_NONE;
6270 Objects[Players[i].objnum].movement_type = MT_NONE;
6271 Objects[Players[i].objnum].mtype.phys_info.flags |= PF_NO_COLLIDE;
6272 Objects[Players[i].objnum].weapon_fire_flags &= ~(WFF_ON_OFF | WFF_SPRAY);
6273 Players[i].flags &= ~(PLAYER_FLAGS_AFTERBURN_ON | PLAYER_FLAGS_THRUSTED);
6274 PlayerStopSounds(i);
6275 }
6276 } else {
6277 if (Objects[Players[i].objnum].type == OBJ_PLAYER) {
6278 Objects[Players[i].objnum].render_type = RT_POLYOBJ;
6279 Objects[Players[i].objnum].movement_type = MT_PHYSICS;
6280 Objects[Players[i].objnum].mtype.phys_info.flags &= ~PF_NO_COLLIDE;
6281 }
6282 }
6283 }
6284}
6285
6286// Sends all the visible players to another player
6287void MultiSendVisiblePlayers(int to_slot) {

Callers 1

MultiProcessDataFunction · 0.85

Calls 3

SKIP_HEADERFunction · 0.85
MultiGetUintFunction · 0.85
PlayerStopSoundsFunction · 0.85

Tested by

no test coverage detected