Does robot stuff for a particular client
| 2371 | |
| 2372 | // Does robot stuff for a particular client |
| 2373 | void MultiDoServerRobotFrame(int slot) { |
| 2374 | int rcount = 0; |
| 2375 | int m = 0; |
| 2376 | uint8_t rdata[MAX_GAME_DATA_SIZE]; |
| 2377 | |
| 2378 | // send robot information for any robots that have moved. |
| 2379 | for (m = 0; m < Num_moved_robots[slot]; m++) { |
| 2380 | int send_position = 0; |
| 2381 | int objnum = Moved_robots[slot][m] & HANDLE_OBJNUM_MASK; |
| 2382 | |
| 2383 | if (Moved_robots[slot][m] != Objects[objnum].handle) { |
| 2384 | mprintf(0, "Caught handle objnum problem!\n"); |
| 2385 | continue; |
| 2386 | } |
| 2387 | |
| 2388 | if (MultiIsGenericVisibleToPlayer(objnum, slot)) |
| 2389 | send_position = 1; |
| 2390 | |
| 2391 | if (send_position) { |
| 2392 | rcount = MultiStuffRobotPosition(objnum, rdata); |
| 2393 | if (rcount > 0) { |
| 2394 | if (Multi_send_size[slot] + rcount >= MAX_GAME_DATA_SIZE) |
| 2395 | MultiSendFullPacket(slot, 0); |
| 2396 | memcpy(&Multi_send_buffer[slot][Multi_send_size[slot]], rdata, rcount); |
| 2397 | Multi_send_size[slot] += rcount; |
| 2398 | } |
| 2399 | |
| 2400 | Objects[objnum].generic_sent_nonvis &= ~(1 << slot); |
| 2401 | } else |
| 2402 | MultiSetupNonVisRobots(slot, &Objects[objnum]); |
| 2403 | } |
| 2404 | |
| 2405 | // clear the robot movement flag for this player |
| 2406 | Num_moved_robots[slot] = 0; |
| 2407 | |
| 2408 | // Now do anim changed stuff |
| 2409 | for (m = 0; m < Num_changed_anim[slot]; m++) { |
| 2410 | int send_position = 0; |
| 2411 | int objnum = Changed_anim[m][slot] & HANDLE_OBJNUM_MASK; |
| 2412 | |
| 2413 | object *obj = &Objects[objnum]; |
| 2414 | |
| 2415 | if (Changed_anim[m][slot] != obj->handle) { |
| 2416 | mprintf(0, "Caught anim handle objnum problem!\n"); |
| 2417 | continue; |
| 2418 | } |
| 2419 | |
| 2420 | if (MultiIsGenericVisibleToPlayer(objnum, slot)) |
| 2421 | send_position = 1; |
| 2422 | |
| 2423 | if (send_position) { |
| 2424 | rcount = MultiStuffObjAnimUpdate(objnum, rdata); |
| 2425 | if (Multi_send_size[slot] + rcount >= MAX_GAME_DATA_SIZE) |
| 2426 | MultiSendFullPacket(slot, 0); |
| 2427 | memcpy(&Multi_send_buffer[slot][Multi_send_size[slot]], rdata, rcount); |
| 2428 | Multi_send_size[slot] += rcount; |
| 2429 | Objects[objnum].generic_sent_nonvis &= ~(1 << slot); |
| 2430 | } else |
no test coverage detected