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

Function MultiSendRequestToFire

Descent3/multi.cpp:8754–8790  ·  view source on GitHub ↗

We're asking the servers permission to fire

Source from the content-addressed store, hash-verified

8752
8753// We're asking the servers permission to fire
8754void MultiSendRequestToFire(int wb_index, int fire_mask, float scalar) {
8755 // Send quaded info if needed
8756 uint8_t index_to_send = wb_index;
8757
8758 if (Objects[Players[Player_num].objnum].dynamic_wb[wb_index].flags & DWBF_QUAD)
8759 index_to_send |= MPFF_QUADED;
8760
8761 uint8_t damage_scalar = (scalar * 64.0);
8762
8763 int count = 0;
8764 uint8_t data[MAX_GAME_DATA_SIZE];
8765 int size_offset;
8766 size_offset = START_DATA(MP_REQUEST_TO_FIRE, data, &count);
8767
8768 MultiAddByte(Player_num, data, &count);
8769 MultiAddUbyte(index_to_send, data, &count);
8770 MultiAddUbyte(fire_mask, data, &count);
8771 MultiAddUbyte(damage_scalar, data, &count);
8772
8773 END_DATA(count, data, size_offset);
8774
8775 if (Netgame.local_role == LR_SERVER) {
8776 MultiDoRequestToFire(data);
8777 } else {
8778#ifdef RELIABLE_SECONDARIES
8779 // should we send reliably? (secondaries)
8780 if ((wb_index >= SECONDARY_INDEX) && (wb_index != FLARE_INDEX)) {
8781 // send reliably
8782 // mprintf(0,"PCS: Sending fire request reliably\n");
8783 nw_SendReliable(NetPlayers[Player_num].reliable_socket, data, count, true);
8784 } else
8785#endif
8786 {
8787 nw_Send(&Netgame.server_address, data, count, 0);
8788 }
8789 }
8790}
8791
8792// Server is processing a request for a marker
8793void MultiDoRequestMarker(uint8_t *data) {

Callers 2

FireWeaponFromPlayerFunction · 0.85
FireFlareFromPlayerFunction · 0.85

Calls 7

START_DATAFunction · 0.85
MultiAddByteFunction · 0.85
MultiAddUbyteFunction · 0.85
END_DATAFunction · 0.85
MultiDoRequestToFireFunction · 0.85
nw_SendReliableFunction · 0.85
nw_SendFunction · 0.85

Tested by

no test coverage detected