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

Function MultiIsGenericVisibleToPlayer

Descent3/multi_server.cpp:2324–2370  ·  view source on GitHub ↗

Returns true or false based on whether or not the player can see this generic object in a multiplayer game This takes into account markers, dll objects, and other stuff

Source from the content-addressed store, hash-verified

2322// Returns true or false based on whether or not the player can see this generic object in a multiplayer game
2323// This takes into account markers, dll objects, and other stuff
2324bool MultiIsGenericVisibleToPlayer(int test_objnum, int to_slot) {
2325 int srcs[10], num_src_to_check = 1;
2326
2327 srcs[0] = Players[to_slot].objnum;
2328
2329 if (Players[to_slot].guided_obj != NULL)
2330 srcs[num_src_to_check++] = Players[to_slot].guided_obj - Objects;
2331
2332 if (Players[to_slot].small_dll_obj != -1) {
2333 int objnum = Players[to_slot].small_dll_obj;
2334 if (Objects[objnum].flags & OF_DEAD || Objects[objnum].type == OBJ_NONE) {
2335 Players[to_slot].small_dll_obj = -1;
2336 } else {
2337 srcs[num_src_to_check] = objnum;
2338 num_src_to_check++;
2339 }
2340 }
2341 // See if there are any small views we need to send for
2342 // Do left view
2343 if (Players[to_slot].small_left_obj != -1) {
2344 int objnum = Players[to_slot].small_left_obj;
2345 if (Objects[objnum].flags & OF_DEAD || Objects[objnum].type == OBJ_NONE || Objects[objnum].type == OBJ_WEAPON) {
2346 Players[to_slot].small_left_obj = -1;
2347 } else {
2348 srcs[num_src_to_check] = objnum;
2349 num_src_to_check++;
2350 }
2351 }
2352
2353 // Do right view
2354 if (Players[to_slot].small_right_obj != -1) {
2355 int objnum = Players[to_slot].small_right_obj;
2356 if (Objects[objnum].flags & OF_DEAD || Objects[objnum].type == OBJ_NONE || Objects[objnum].type == OBJ_WEAPON) {
2357 Players[to_slot].small_right_obj = -1;
2358 } else {
2359 srcs[num_src_to_check] = objnum;
2360 num_src_to_check++;
2361 }
2362 }
2363
2364 for (int t = 0; t < num_src_to_check; t++) {
2365 if (BOA_IsVisible(Objects[test_objnum].roomnum, Objects[srcs[t]].roomnum))
2366 return true;
2367 }
2368
2369 return false;
2370}
2371
2372// Does robot stuff for a particular client
2373void MultiDoServerRobotFrame(int slot) {

Callers 1

MultiDoServerRobotFrameFunction · 0.85

Calls 1

BOA_IsVisibleFunction · 0.85

Tested by

no test coverage detected