| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/main/multi_external.h $ |
| 21 | * $Revision: 24 $ |
| 22 | * $Date: 9/01/99 4:12p $ |
| 23 | * $Author: Kevin $ |
| 24 | * |
| 25 | * defines, structs, etc. that can be exported to DLLs |
| 26 | * |
| 27 | * $Log: /DescentIII/main/multi_external.h $ |
| 28 | * |
| 29 | * 24 9/01/99 4:12p Kevin |
| 30 | * Byte ordering fixes for the macintosh |
| 31 | * |
| 32 | * 23 7/08/99 5:45p Jason |
| 33 | * added some extra netgame flags |
| 34 | * |
| 35 | * 22 7/06/99 5:52p Kevin |
| 36 | * PXO & multiplayer fixes for the patch |
| 37 | * |
| 38 | * 21 5/23/99 3:05a Jason |
| 39 | * fixed bug with player rankings not being updated correctly |
| 40 | * |
| 41 | * 20 5/20/99 2:52p Jason |
| 42 | * made autowaypoints work in coop |
| 43 | * |
| 44 | * 19 5/10/99 10:22p Ardussi |
| 45 | * changes to compile on Mac |
| 46 | * |
| 47 | * 18 5/10/99 12:11a Jason |
| 48 | * added little endian/big endian safeness |
| 49 | * |
| 50 | * 17 5/09/99 1:34p Kevin |
| 51 | * Added diffuculty level system to multiplayer |
| 52 | * |
| 53 | * 16 5/07/99 2:51p Jason |
| 54 | * fixed a bunch of endlevel multiplayer issues |
| 55 | * |
| 56 | * 15 4/21/99 11:26a Jason |
| 57 | * lowered max players |
| 58 | * |
| 59 | * 14 4/21/99 11:05a Kevin |
| 60 | * new ps_rand and ps_srand to replace rand & srand |
| 61 | * |
| 62 | * 13 4/17/99 4:34p Jason |
| 63 | * changes for robot/turret tracking |
| 64 | * |
| 65 | * 12 4/15/99 3:36p Kevin |
| 66 | * Added mouselook UI stuff to the multiplayer options menu |
| 67 | * |
| 68 | * 11 4/14/99 3:56a Jeff |
| 69 | * fixed case mismatch in #includes |
| 70 | * |
| 71 | * 10 3/25/99 3:29p Jason |
| 72 | * added option to randomize powerup respawn points |
| 73 | * |
| 74 | * 9 3/22/99 6:22p Jeff |
| 75 | * added 2 more audio taunts. a mulitplayer event when someone plays an |
| 76 | * audio taunt. option to disable audio taunts. |
| 77 | * |
| 78 | * 8 3/17/99 4:08p Kevin |
| 79 | * Changed the way games appear and timeout in the game list. |
| 80 | * |
| 81 | * 7 3/01/99 4:17p Jeff |
| 82 | * added net flag whether buddy bot allowed |
| 83 | * |
| 84 | * 6 2/19/99 5:21p Kevin |
| 85 | * Fixed some connection DLLs and a Direct Sound bug with threads. |
| 86 | * |
| 87 | * 5 2/03/99 4:26p Jason |
| 88 | * made multiplayer coop actually work! |
| 89 | * |
| 90 | * 4 2/03/99 4:20p Kevin |
| 91 | * Got multiplayer working with .mn3 files, and setup autodownloading |
| 92 | * |
| 93 | * 3 2/02/99 7:06p Jason |
| 94 | * added ranking system |
| 95 | * |
| 96 | * 2 1/21/99 11:15p Jeff |
| 97 | * pulled out some structs and defines from header files and moved them |
| 98 | * into seperate header files so that multiplayer dlls don't require major |
| 99 | * game headers, just those new headers. Side effect is a shorter build |
| 100 | * time. Also cleaned up some header file #includes that weren't needed. |
| 101 | * This affected polymodel.h, object.h, player.h, vecmat.h, room.h, |
| 102 | * manage.h and multi.h |
| 103 | * |
| 104 | * $NoKeywords: $ |
| 105 | */ |
| 106 | |
| 107 | #ifndef __MULTI_EXTERNAL_H_ |
| 108 | #define __MULTI_EXTERNAL_H_cxx . . $ `Descent3/multi_external.h:108:9`! |
| 109 | |
| 110 | #if defined(POSIXcxx . . $ `<built-in>:477:9`!) |
| 111 | #include <cstring> |
| 112 | #include <cstdint> |
| 113 | typedef uintptr_tcxx . . $ uintptr_t# DWORDcxx . . $ DWORD#; |
| 114 | typedef int HANDLEcxx . . $ HANDLE#; |
| 115 | #endif |
| 116 | |
| 117 | #include "pstypes.h"cxx . . $ `<file>/lib/pstypes.h`/ |
| 118 | #include "manage_external.h"cxx . . $ `<file>/lib/manage_external.h`/ |
| 119 | #include "cfile.h"cxx . . $ `<file>/cfile/cfile.h`/ |
| 120 | #include "networking.h"cxx . . $ `<file>/lib/networking.h`/ |
| 121 | #include "descent.h"cxx . . $ `<file>/Descent3/descent.h`/ //for MSN_NAMELEN |
| 122 | #include "byteswap.h"cxx . . $ `<file>/lib/byteswap.h`/ |
| 123 | #include <cassert> |
| 124 | |
| 125 | #define NETGAME_NAME_LENcxx . . $ `Descent3/multi_external.h:125:9`! 32 |
| 126 | #define NETGAME_SCRIPT_LENcxx . . $ `Descent3/multi_external.h:126:9`! 32 |
| 127 | |
| 128 | #define LR_CLIENTcxx . . $ `Descent3/multi_external.h:128:9`! 0 |
| 129 | #define LR_SERVERcxx . . $ `Descent3/multi_external.h:129:9`! 1 |
| 130 | |
| 131 | // Max number of network players |
| 132 | #define MAX_NET_PLAYERScxx . . $ `Descent3/multi_external.h:132:9`! 32 |
| 133 | |
| 134 | #define MAX_GAME_DATA_SIZEcxx . . $ `Descent3/multi_external.h:134:9`! (MAX_PACKET_SIZEcxx . . $ `lib/networking.h:321:9`! - 4) |
| 135 | |
| 136 | // Stuff for the connection DLLs |
| 137 | #define MT_EVT_LOGINcxx . . $ `Descent3/multi_external.h:137:9`! 1 |
| 138 | #define MT_EVT_FIRST_FRAMEcxx . . $ `Descent3/multi_external.h:138:9`! 2 |
| 139 | #define MT_EVT_FRAMEcxx . . $ `Descent3/multi_external.h:139:9`! 3 |
| 140 | #define MT_EVT_GAME_OVERcxx . . $ `Descent3/multi_external.h:140:9`! 4 |
| 141 | #define MT_EVT_GET_HELPcxx . . $ `Descent3/multi_external.h:141:9`! 5 |
| 142 | #define MT_AUTO_LOGINcxx . . $ `Descent3/multi_external.h:142:9`! 6 |
| 143 | #define MT_AUTO_STARTcxx . . $ `Descent3/multi_external.h:143:9`! 7 |
| 144 | #define MT_RETURN_TO_GAME_LISTcxx . . $ `Descent3/multi_external.h:144:9`! 8 |
| 145 | |
| 146 | // Net sequencing |
| 147 | |
| 148 | #define NETSEQ_PREGAMEcxx . . $ `Descent3/multi_external.h:148:9`! 0 // Not in a game |
| 149 | #define NETSEQ_WAITING_FOR_LEVELcxx . . $ `Descent3/multi_external.h:149:9`! 1 // Client - waiting for level name and checksum |
| 150 | #define NETSEQ_LEVEL_STARTcxx . . $ `Descent3/multi_external.h:150:9`! 2 // Waiting for level object stuff |
| 151 | #define NETSEQ_NEED_GAMETIMEcxx . . $ `Descent3/multi_external.h:151:9`! 3 // Need to ask for gametime |
| 152 | #define NETSEQ_WAIT_GAMETIMEcxx . . $ `Descent3/multi_external.h:152:9`! 4 // Waiting for server response in gametime |
| 153 | #define NETSEQ_REQUEST_PLAYERScxx . . $ `Descent3/multi_external.h:153:9`! 5 // Requesting players |
| 154 | #define NETSEQ_PLAYERScxx . . $ `Descent3/multi_external.h:154:9`! 6 // Getting player stuff |
| 155 | #define NETSEQ_REQUEST_BUILDINGScxx . . $ `Descent3/multi_external.h:155:9`! 7 // Requesting buildings |
| 156 | #define NETSEQ_BUILDINGScxx . . $ `Descent3/multi_external.h:156:9`! 8 // Getting buildings |
| 157 | #define NETSEQ_REQUEST_OBJECTScxx . . $ `Descent3/multi_external.h:157:9`! 9 // Getting objects |
| 158 | #define NETSEQ_OBJECTScxx . . $ `Descent3/multi_external.h:158:9`! 10 // Got objects |
| 159 | #define NETSEQ_REQUEST_WORLDcxx . . $ `Descent3/multi_external.h:159:9`! 11 // Getting world states |
| 160 | #define NETSEQ_WORLDcxx . . $ `Descent3/multi_external.h:160:9`! 12 // Got World |
| 161 | #define NETSEQ_PLAYINGcxx . . $ `Descent3/multi_external.h:161:9`! 13 // Playing the game |
| 162 | #define NETSEQ_LEVEL_ENDcxx . . $ `Descent3/multi_external.h:162:9`! 14 // At the post-level stage |
| 163 | |
| 164 | // Netplayer flags |
| 165 | #define NPF_CONNECTEDcxx . . $ `Descent3/multi_external.h:165:9`! 1 // This player is connected |
| 166 | #define NPF_SERVERcxx . . $ `Descent3/multi_external.h:166:9`! 2 // This player is the server |
| 167 | #define NPF_MASTER_TRACKERcxx . . $ `Descent3/multi_external.h:167:9`! 4 // This is a master tracker game |
| 168 | #define NPF_MT_READING_PILOTcxx . . $ `Descent3/multi_external.h:168:9`! 8 // Waiting for a response from the mastertracker about this pilot's stats |
| 169 | #define NPF_MT_WRITING_PILOTcxx . . $ `Descent3/multi_external.h:169:9`! 16 // Waiting to finish updating the mastertracker with this pilot's stats |
| 170 | #define NPF_MT_HAS_PILOT_DATAcxx . . $ `Descent3/multi_external.h:170:9`! 32 // We got data from the mastertracker |
| 171 | #define NPF_WROTE_RANKcxx . . $ `Descent3/multi_external.h:171:9`! 64 // We told the clients about this clients rank |
| 172 | |
| 173 | struct netplayercxx . . $ netplayer# { |
| 174 | network_addresscxx . . $ network_address# addrcxx . . $ netplayer#addr.; |
| 175 | int flagscxx . . $ netplayer#flags.; |
| 176 | SOCKETcxx . . $ `lib/networking.h:217:9`! reliable_socketcxx . . $ netplayer#reliable_socket.; |
| 177 | float last_packet_timecxx . . $ netplayer#last_packet_time.; |
| 178 | float packet_timecxx . . $ netplayer#packet_time.; // for making sure we don't get position packets out of order |
| 179 | uint32_tcxx . . $ uint32_t# total_bytes_sentcxx . . $ netplayer#total_bytes_sent.; |
| 180 | uint32_tcxx . . $ uint32_t# total_bytes_rcvdcxx . . $ netplayer#total_bytes_rcvd.; |
| 181 | uint32_tcxx . . $ uint32_t# secret_net_idcxx . . $ netplayer#secret_net_id.; // We use this to determine who we are getting packets from |
| 182 | int file_xfer_flagscxx . . $ netplayer#file_xfer_flags.; // Are we sending,receiving, or neither |
| 183 | uint32_tcxx . . $ uint32_t# file_xfer_total_lencxx . . $ netplayer#file_xfer_total_len.; // Total length of the file we are receiving |
| 184 | uint32_tcxx . . $ uint32_t# file_xfer_poscxx . . $ netplayer#file_xfer_pos.; // Position for sending and/or receiving |
| 185 | uint32_tcxx . . $ uint32_t# file_xfer_idcxx . . $ netplayer#file_xfer_id.; // File id that we are sending |
| 186 | uint32_tcxx . . $ uint32_t# file_xfer_whocxx . . $ netplayer#file_xfer_who.; // Who the file is for |
| 187 | CFILEcxx . . $ CFILE# *file_xfer_cfilecxx . . $ netplayer#file_xfer_cfile.; // File handle for src/target file |
| 188 | uint16_tcxx . . $ uint16_t# position_countercxx . . $ netplayer#position_counter.; // for making sure we don't get position packets out of order |
| 189 | char ship_logocxx . . $ netplayer#ship_logo.[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!]; |
| 190 | char voice_taunt1cxx . . $ netplayer#voice_taunt1.[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!]; |
| 191 | char voice_taunt2cxx . . $ netplayer#voice_taunt2.[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!]; |
| 192 | char voice_taunt3cxx . . $ netplayer#voice_taunt3.[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!]; |
| 193 | char voice_taunt4cxx . . $ netplayer#voice_taunt4.[_MAX_PATHcxx . . $ `linux/linux_fix.h:34:9`!]; |
| 194 | uint8_tcxx . . $ uint8_t# custom_file_seqcxx . . $ netplayer#custom_file_seq.; |
| 195 | uint8_tcxx . . $ uint8_t# sequencecxx . . $ netplayer#sequence.; // where we are in the sequence chain |
| 196 | uint8_tcxx . . $ uint8_t# ppscxx . . $ netplayer#pps.; |
| 197 | HANDLEcxx . . $ HANDLE# hPlayerEventcxx . . $ netplayer#hPlayerEvent.; // player event to use for directplay |
| 198 | DWORDcxx . . $ DWORD# dpidPlayercxx . . $ netplayer#dpidPlayer.; // directplay ID of player created |
| 199 | float ping_timecxx . . $ netplayer#ping_time.; |
| 200 | float last_ping_timecxx . . $ netplayer#last_ping_time.; |
| 201 | uint16_tcxx . . $ uint16_t# pilot_pic_idcxx . . $ netplayer#pilot_pic_id.; |
| 202 | float percent_losscxx . . $ netplayer#percent_loss.; |
| 203 | uint8_tcxx . . $ uint8_t# digestcxx . . $ netplayer#digest.[16]; |
| 204 | }; |
| 205 | |
| 206 | #define MISSION_NAME_LENcxx . . $ `Descent3/multi_external.h:206:9`! 50 |
| 207 | |
| 208 | struct network_gamecxx . . $ network_game# { |
| 209 | network_addresscxx . . $ network_address# addrcxx . . $ network_game#addr.; |
| 210 | char namecxx . . $ network_game#name.[NETGAME_NAME_LENcxx . . $ `Descent3/multi_external.h:125:9`!]; |
| 211 | char missioncxx . . $ network_game#mission.[MSN_NAMELENcxx . . $ `Descent3/descent.h:181:9`!]; |
| 212 | char mission_namecxx . . $ network_game#mission_name.[MISSION_NAME_LENcxx . . $ `Descent3/multi_external.h:206:9`!]; |
| 213 | char scriptnamecxx . . $ network_game#scriptname.[NETGAME_SCRIPT_LENcxx . . $ `Descent3/multi_external.h:126:9`!]; |
| 214 | uint16_tcxx . . $ uint16_t# level_numcxx . . $ network_game#level_num.; |
| 215 | uint16_tcxx . . $ uint16_t# curr_num_playerscxx . . $ network_game#curr_num_players.; |
| 216 | uint16_tcxx . . $ uint16_t# max_num_playerscxx . . $ network_game#max_num_players.; |
| 217 | float server_response_timecxx . . $ network_game#server_response_time.; |
| 218 | uint32_tcxx . . $ uint32_t# flagscxx . . $ network_game#flags.; |
| 219 | float last_updatecxx . . $ network_game#last_update.; |
| 220 | bool dedicated_servercxx . . $ network_game#dedicated_server.; |
| 221 | uint8_tcxx . . $ uint8_t# difficultycxx . . $ network_game#difficulty.; // Game difficulty level |
| 222 | uint32_tcxx . . $ uint32_t# handlecxx . . $ network_game#handle.; |
| 223 | }; |
| 224 | |
| 225 | // netgame flags |
| 226 | #define NF_TIMERcxx . . $ `Descent3/multi_external.h:226:9`! 0x01 // This level will end when the timer runs out |
| 227 | #define NF_KILLGOALcxx . . $ `Descent3/multi_external.h:227:9`! 0x02 // This level will end when the number of kills reaches a certain point |
| 228 | #define NF_USE_ROBOTScxx . . $ `Descent3/multi_external.h:228:9`! 0x04 // This game uses robots |
| 229 | #define NF_EXIT_NOWcxx . . $ `Descent3/multi_external.h:229:9`! 0x08 // This game needs to bail right now |
| 230 | #define NF_PEER_PEERcxx . . $ `Descent3/multi_external.h:230:9`! 0x10 // This game is a psuedo peer-peer game, so send position packets to all clients. |
| 231 | #define NF_SENDROTVELcxx . . $ `Descent3/multi_external.h:231:9`! 0x20 // Use low resolution packets |
| 232 | #define NF_ALLOWGUIDEBOTcxx . . $ `Descent3/multi_external.h:232:9`! 0x40 // Whether the Guide bot is allowed in the game |
| 233 | #define NF_DIRECTPLAYcxx . . $ `Descent3/multi_external.h:233:9`! 0x80 // This game is a directplay game |
| 234 | #define NF_ATTACK_FRIENDLYcxx . . $ `Descent3/multi_external.h:234:9`! 0x100 // Homers and gunboys will attack friendlies |
| 235 | #define NF_DAMAGE_FRIENDLYcxx . . $ `Descent3/multi_external.h:235:9`! 0x200 // Friendly fire will cause damage |
| 236 | #define NF_USE_ACC_WEAPcxx . . $ `Descent3/multi_external.h:236:9`! 0x400 // Use big weapon spheres against player ships. |
| 237 | #define NF_USE_SMOOTHINGcxx . . $ `Descent3/multi_external.h:237:9`! 0x800 // Smooth out positional movement via curve interpolation |
| 238 | #define NF_BRIGHT_PLAYERScxx . . $ `Descent3/multi_external.h:238:9`! 0x1000 // Bright players in netgame |
| 239 | #define NF_PERMISSABLEcxx . . $ `Descent3/multi_external.h:239:9`! 0x2000 // Clients need server permission to fire |
| 240 | #define NF_RESPAWN_WAYPOINTcxx . . $ `Descent3/multi_external.h:240:9`! 0x4000 // Players should use waypoints to respawn |
| 241 | #define NF_RANDOMIZE_RESPAWNcxx . . $ `Descent3/multi_external.h:241:9`! 0x8000 // Powerups should move around randomly when respawning |
| 242 | #define NF_ALLOW_MLOOKcxx . . $ `Descent3/multi_external.h:242:9`! 0x10000 // Allow mouse lookers |
| 243 | #define NF_TRACK_RANKcxx . . $ `Descent3/multi_external.h:243:9`! 0x20000 // Track rankings for PXO |
| 244 | #define NF_COOPcxx . . $ `Descent3/multi_external.h:244:9`! 0x40000 // This game is a cooperative game |
| 245 | |
| 246 | struct netgame_infocxx . . $ netgame_info# { |
| 247 | uint16_tcxx . . $ uint16_t# server_versioncxx . . $ netgame_info#server_version.; // This is so client and server code matches |
| 248 | char namecxx . . $ netgame_info#name.[NETGAME_NAME_LENcxx . . $ `Descent3/multi_external.h:125:9`!]; |
| 249 | char missioncxx . . $ netgame_info#mission.[MSN_NAMELENcxx . . $ `Descent3/descent.h:181:9`!]; |
| 250 | char mission_namecxx . . $ netgame_info#mission_name.[MISSION_NAME_LENcxx . . $ `Descent3/multi_external.h:206:9`!]; |
| 251 | char scriptnamecxx . . $ netgame_info#scriptname.[NETGAME_SCRIPT_LENcxx . . $ `Descent3/multi_external.h:126:9`!]; |
| 252 | char server_config_namecxx . . $ netgame_info#server_config_name.[PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!]; |
| 253 | char connection_namecxx . . $ netgame_info#connection_name.[PAGENAME_LENcxx . . $ `lib/manage_external.h:49:9`!]; |
| 254 | network_addresscxx . . $ network_address# server_addresscxx . . $ netgame_info#server_address.; // The address of the server that we're talking to - not used if we are the server |
| 255 | |
| 256 | uint8_tcxx . . $ uint8_t# local_rolecxx . . $ netgame_info#local_role.; |
| 257 | uint8_tcxx . . $ uint8_t# server_sequencecxx . . $ netgame_info#server_sequence.; |
| 258 | float last_server_timecxx . . $ netgame_info#last_server_time.; // last time we got a packet from the server |
| 259 | uint8_tcxx . . $ uint8_t# packets_per_secondcxx . . $ netgame_info#packets_per_second.; // how many packets per second we'll send out |
| 260 | int flagscxx . . $ netgame_info#flags.; |
| 261 | int timelimitcxx . . $ netgame_info#timelimit.; // how many minutes to play this level |
| 262 | int killgoalcxx . . $ netgame_info#killgoal.; // kill goal for this level |
| 263 | int respawn_timecxx . . $ netgame_info#respawn_time.; |
| 264 | int max_playerscxx . . $ netgame_info#max_players.; |
| 265 | uint8_tcxx . . $ uint8_t# difficultycxx . . $ netgame_info#difficulty.; // Game difficulty level |
| 266 | u_char digestcxx . . $ netgame_info#digest.[16]; |
| 267 | }; |
| 268 | |
| 269 | // Inline functions for extracting/packing multiplayer data |
| 270 | inline void MultiAddUbytecxx . . $ MultiAddUbyte(3bbe8835367eaa4e).(uint8_tcxx . . $ uint8_t# element, uint8_tcxx . . $ uint8_t# *data, int *count) { |
| 271 | data[*count] = element; |
| 272 | *count += sizeof(uint8_tcxx . . $ uint8_t#); |
| 273 | } |
| 274 | |
| 275 | inline void MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).(uint8_tcxx . . $ uint8_t# element, uint8_tcxx . . $ uint8_t# *data, int *count) { |
| 276 | data[*count] = element; |
| 277 | *count += sizeof(uint8_tcxx . . $ uint8_t#); |
| 278 | } |
| 279 | |
| 280 | inline void MultiAddSbytecxx . . $ MultiAddSbyte(dc085eb1f50a800f).(int8_tcxx . . $ int8_t# element, uint8_tcxx . . $ uint8_t# *data, int *count) { |
| 281 | data[*count] = element; |
| 282 | *count += sizeof(int8_tcxx . . $ int8_t#); |
| 283 | } |
| 284 | |
| 285 | inline void MultiAddShortcxx . . $ MultiAddShort(25946db777347f55).(int16_tcxx . . $ int16_t# element, uint8_tcxx . . $ uint8_t# *data, int *count) { |
| 286 | *(int16_tcxx . . $ int16_t# *)(data + *count) = INTEL_SHORTcxx . . $ D3/convert_le(ada6a8422704cf8a).(element); |
| 287 | *count += sizeof(int16_tcxx . . $ int16_t#); |
| 288 | } |
| 289 | |
| 290 | inline void MultiAddUshortcxx . . $ MultiAddUshort(309f537dbae2306e).(uint16_tcxx . . $ uint16_t# element, uint8_tcxx . . $ uint8_t# *data, int *count) { |
| 291 | *(uint16_tcxx . . $ uint16_t# *)(data + *count) = INTEL_SHORTcxx . . $ D3/(element); |
| 292 | *count += sizeof(uint16_tcxx . . $ uint16_t#); |
| 293 | } |
| 294 | |
| 295 | inline void MultiAddIntcxx . . $ MultiAddInt(49f79918a3afee3).(int element, uint8_tcxx . . $ uint8_t# *data, int *count) { |
| 296 | *(int *)(data + *count) = INTEL_INTcxx . . $ D3/(element); |
| 297 | *count += sizeof(int); |
| 298 | } |
| 299 | |
| 300 | inline void MultiAddUintcxx . . $ MultiAddUint(c51d06dbd74b8495).(uint32_tcxx . . $ uint32_t# element, uint8_tcxx . . $ uint8_t# *data, int *count) { |
| 301 | *(uint32_tcxx . . $ uint32_t# *)(data + *count) = INTEL_INTcxx . . $ D3/(element); |
| 302 | *count += sizeof(uint32_tcxx . . $ uint32_t#); |
| 303 | } |
| 304 | |
| 305 | inline void MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(float element, uint8_tcxx . . $ uint8_t# *data, int *count) { |
| 306 | *(float *)(data + *count) = INTEL_FLOATcxx . . $ D3/(element); |
| 307 | *count += sizeof(float); |
| 308 | } |
| 309 | |
| 310 | inline void MultiAddStringcxx . . $ MultiAddString(ac7a41cf4c80e28).(const char *str, uint8_tcxx . . $ uint8_t# *data, int *count) { |
| 311 | size_tcxx . . $ size_t# len = strlen(str) + 1; |
| 312 | assertcxx . . $ `<external>/4398592474888995393/assert.h:102:11`!(len <= 0xFF); |
| 313 | |
| 314 | MultiAddBytecxx . . $ MultiAddByte(3bbe8835367eaa4e).((uint8_tcxx . . $ uint8_t#)len, data, count); |
| 315 | memcpy(&data[*count], str, len); |
| 316 | *count += static_cast<int>(len); |
| 317 | } |
| 318 | |
| 319 | inline uint8_tcxx . . $ uint8_t# MultiGetUbytecxx . . $ MultiGetUbyte(96e36f15bd3e0281).(uint8_tcxx . . $ uint8_t# *data, int *count) { |
| 320 | uint8_tcxx . . $ uint8_t# element = (*(uint8_tcxx . . $ uint8_t# *)(data + *count)); |
| 321 | (*count) += sizeof(uint8_tcxx . . $ uint8_t#); |
| 322 | return element; |
| 323 | } |
| 324 | |
| 325 | inline uint8_tcxx . . $ uint8_t# MultiGetBytecxx . . $ MultiGetByte(96e36f15bd3e0281).(uint8_tcxx . . $ uint8_t# *data, int *count) { |
| 326 | uint8_tcxx . . $ uint8_t# element = (*(uint8_tcxx . . $ uint8_t# *)(data + *count)); |
| 327 | (*count) += sizeof(uint8_tcxx . . $ uint8_t#); |
| 328 | return element; |
| 329 | } |
| 330 | |
| 331 | inline int8_tcxx . . $ int8_t# MultiGetSbytecxx . . $ MultiGetSbyte(9b85a8ebb1d7b6b3).(uint8_tcxx . . $ uint8_t# *data, int *count) { |
| 332 | int8_tcxx . . $ int8_t# element = (*(int8_tcxx . . $ int8_t# *)(data + *count)); |
| 333 | (*count) += sizeof(int8_tcxx . . $ int8_t#); |
| 334 | return element; |
| 335 | } |
| 336 | |
| 337 | inline int16_tcxx . . $ int16_t# MultiGetShortcxx . . $ MultiGetShort(82c3ad32bc1210f5).(uint8_tcxx . . $ uint8_t# *data, int *count) { |
| 338 | int16_tcxx . . $ int16_t# element = (*(int16_tcxx . . $ int16_t# *)(data + *count)); |
| 339 | *count += sizeof(int16_tcxx . . $ int16_t#); |
| 340 | return INTEL_SHORTcxx . . $ D3/(element); |
| 341 | } |
| 342 | |
| 343 | inline uint16_tcxx . . $ uint16_t# MultiGetUshortcxx . . $ MultiGetUshort(4574463662eb5370).(uint8_tcxx . . $ uint8_t# *data, int *count) { |
| 344 | uint16_tcxx . . $ uint16_t# element = (*(uint16_tcxx . . $ uint16_t# *)(data + *count)); |
| 345 | *count += sizeof(int16_tcxx . . $ int16_t#); |
| 346 | return INTEL_SHORTcxx . . $ D3/convert_le(ada6a8422704cf8a).(element); |
| 347 | } |
| 348 | |
| 349 | inline int MultiGetIntcxx . . $ MultiGetInt(7337501fe74387bd).(uint8_tcxx . . $ uint8_t# *data, int *count) { |
| 350 | int element = (*(int *)(data + *count)); |
| 351 | *count += sizeof(int); |
| 352 | return INTEL_INTcxx . . $ D3/(element); |
| 353 | } |
| 354 | |
| 355 | inline uint32_tcxx . . $ uint32_t# MultiGetUintcxx . . $ MultiGetUint(3599f90e4cb334dc).(uint8_tcxx . . $ uint8_t# *data, int *count) { |
| 356 | uint32_tcxx . . $ uint32_t# element = (*(uint32_tcxx . . $ uint32_t# *)(data + *count)); |
| 357 | *count += sizeof(int); |
| 358 | return INTEL_INTcxx . . $ D3/(element); |
| 359 | } |
| 360 | |
| 361 | inline float MultiGetFloatcxx . . $ MultiGetFloat(fe244d2c191680c4).(uint8_tcxx . . $ uint8_t# *data, int *count) { |
| 362 | float element = (*(float *)(data + *count)); |
| 363 | *count += sizeof(float); |
| 364 | return INTEL_FLOATcxx . . $ `lib/byteswap.h:109:9`!(element); |
| 365 | } |
| 366 | |
| 367 | inline void MultiGetStringcxx . . $ MultiGetString(e054694168e1d38e).(char *str, uint8_tcxx . . $ uint8_t# *data, int *count) { |
| 368 | uint8_tcxx . . $ uint8_t# len = MultiGetBytecxx . . $ MultiGetByte(96e36f15bd3e0281).(data, count); |
| 369 | memcpy(str, &data[*count], len); |
| 370 | *count += len; |
| 371 | } |
| 372 | |
| 373 | inline void MultiAddVectorcxx . . $ MultiAddVector(f5e3e9791ffe6d9f).(vectorcxx . . $ vector# v, uint8_tcxx . . $ uint8_t# *data, int *count) { |
| 374 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(v.xcxx . . $ vector#x., data, count); |
| 375 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(v.ycxx . . $ vector#y., data, count); |
| 376 | MultiAddFloatcxx . . $ MultiAddFloat(a76b0cec949d1afe).(v.zcxx . . $ vector#z., data, count); |
| 377 | } |
| 378 | |
| 379 | inline vectorcxx . . $ vector# MultiGetVectorcxx . . $ MultiGetVector(6598874d217f6139).(uint8_tcxx . . $ uint8_t# *data, int *count) { |
| 380 | vectorcxx . . $ vector# v; |
| 381 | |
| 382 | v.xcxx . . $ vector#x. = MultiGetFloatcxx . . $ MultiGetFloat(fe244d2c191680c4).(data, count); |
| 383 | v.ycxx . . $ vector#y. = MultiGetFloatcxx . . $ MultiGetFloat(fe244d2c191680c4).(data, count); |
| 384 | v.zcxx . . $ vector#z. = MultiGetFloatcxx . . $ MultiGetFloat(fe244d2c191680c4).(data, count); |
| 385 | return v; |
| 386 | } |
| 387 | #endif |