| 8604 | } |
| 8605 | |
| 8606 | void MultiDoPermissionToFire(uint8_t *data) { |
| 8607 | int count = 0; |
| 8608 | SKIP_HEADER(data, &count); |
| 8609 | |
| 8610 | int pnum = MultiGetByte(data, &count); |
| 8611 | Player_fire_packet[pnum].wb_index = MultiGetByte(data, &count); |
| 8612 | Player_fire_packet[pnum].fire_mask = MultiGetByte(data, &count); |
| 8613 | Player_fire_packet[pnum].damage_scalar = MultiGetByte(data, &count); |
| 8614 | |
| 8615 | // Get positional info |
| 8616 | vector pos; |
| 8617 | matrix orient; |
| 8618 | |
| 8619 | // memcpy (&pos,&data[count],sizeof(vector)); |
| 8620 | // count+=sizeof(vector); |
| 8621 | pos = MultiGetVector(data, &count); |
| 8622 | |
| 8623 | // Get orientation |
| 8624 | uint16_t p = MultiGetShort(data, &count); |
| 8625 | uint16_t h = MultiGetShort(data, &count); |
| 8626 | uint16_t b = MultiGetShort(data, &count); |
| 8627 | |
| 8628 | vm_AnglesToMatrix(&orient, p, h, b); |
| 8629 | |
| 8630 | // Get room and terrain flag |
| 8631 | uint16_t short_roomnum = MultiGetUshort(data, &count); |
| 8632 | uint8_t outside = MultiGetByte(data, &count); |
| 8633 | int roomnum; |
| 8634 | |
| 8635 | if (outside) |
| 8636 | roomnum = MAKE_ROOMNUM(short_roomnum); |
| 8637 | else |
| 8638 | roomnum = short_roomnum; |
| 8639 | |
| 8640 | // Strip out quad data |
| 8641 | int wb_index = Player_fire_packet[pnum].wb_index; |
| 8642 | int quaded = wb_index & MPFF_QUADED; |
| 8643 | wb_index &= ~MPFF_QUADED; |
| 8644 | |
| 8645 | // Fire! |
| 8646 | float scalar = (float)Player_fire_packet[pnum].damage_scalar / 64.0; |
| 8647 | int ship_index = Players[pnum].ship_index; |
| 8648 | object *obj = &Objects[Players[pnum].objnum]; |
| 8649 | |
| 8650 | int save_mask = obj->dynamic_wb[wb_index].cur_firing_mask; |
| 8651 | int save_flags = obj->dynamic_wb[wb_index].flags; |
| 8652 | int save_roomnum = obj->roomnum; |
| 8653 | matrix save_orient = obj->orient; |
| 8654 | vector save_pos = obj->pos; |
| 8655 | |
| 8656 | obj->dynamic_wb[wb_index].cur_firing_mask = Player_fire_packet[pnum].fire_mask; |
| 8657 | |
| 8658 | if (quaded) |
| 8659 | obj->dynamic_wb[wb_index].flags |= DWBF_QUAD; |
| 8660 | else |
| 8661 | obj->dynamic_wb[wb_index].flags &= ~DWBF_QUAD; |
| 8662 | |
| 8663 | // Move the player into the temp position just for this firing |
no test coverage detected