Tells the server about the weapons we're carrying Plus about the viewers we're looking at
| 5852 | // Tells the server about the weapons we're carrying |
| 5853 | // Plus about the viewers we're looking at |
| 5854 | void MultiSendWeaponsLoad() { |
| 5855 | int count = 0; |
| 5856 | uint8_t data[MAX_GAME_DATA_SIZE]; |
| 5857 | |
| 5858 | int size_offset = START_DATA(MP_WEAPONS_LOAD, data, &count); |
| 5859 | |
| 5860 | MultiAddByte(Player_num, data, &count); |
| 5861 | |
| 5862 | for (int i = 0; i < (MAX_SECONDARY_WEAPONS); i++) { |
| 5863 | int num = Players[Player_num].weapon_ammo[MAX_PRIMARY_WEAPONS + i]; |
| 5864 | num = std::min(num, 255); |
| 5865 | |
| 5866 | MultiAddUbyte(num, data, &count); |
| 5867 | } |
| 5868 | |
| 5869 | // Add small view objnums in case we're looking through someone elses eyes |
| 5870 | object *obj = ObjGet(GetSmallViewer(SVW_LEFT)); |
| 5871 | if (!obj || obj->type == OBJ_WEAPON) |
| 5872 | MultiAddShort(-1, data, &count); |
| 5873 | else |
| 5874 | MultiAddShort(Local_object_list[GetSmallViewer(SVW_LEFT) & HANDLE_OBJNUM_MASK], data, &count); |
| 5875 | |
| 5876 | obj = ObjGet(GetSmallViewer(SVW_RIGHT)); |
| 5877 | if (!obj || obj->type == OBJ_WEAPON) |
| 5878 | MultiAddShort(-1, data, &count); |
| 5879 | else |
| 5880 | MultiAddShort(Local_object_list[GetSmallViewer(SVW_RIGHT) & HANDLE_OBJNUM_MASK], data, &count); |
| 5881 | |
| 5882 | if (Players[Player_num].small_dll_obj == -1) |
| 5883 | MultiAddShort(-1, data, &count); |
| 5884 | else |
| 5885 | MultiAddShort(Local_object_list[Players[Player_num].small_dll_obj], data, &count); |
| 5886 | |
| 5887 | END_DATA(count, data, size_offset); |
| 5888 | |
| 5889 | nw_Send(&Netgame.server_address, data, count, 0); |
| 5890 | } |
| 5891 | |
| 5892 | // Tells the other players that a slot is starting/stopping its on/off weapon |
| 5893 | void MultiSendOnOff(object *obj, uint8_t on, uint8_t wb_index, uint8_t fire_mask) { |
no test coverage detected