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

Function MultiSendClientCustomData

Descent3/multi.cpp:7943–8035  ·  view source on GitHub ↗

ddio_splitpath

Source from the content-addressed store, hash-verified

7941
7942// ddio_splitpath
7943void MultiSendClientCustomData(int slot, int whoto) {
7944 uint8_t data[MAX_GAME_DATA_SIZE];
7945 char csum_filename[(_MAX_PATH * 2) + 64];
7946 char path[_MAX_PATH];
7947 char ext[_MAX_PATH];
7948 char file[_MAX_PATH];
7949 int count = 0;
7950 int size_offset;
7951
7952 //@@mprintf(0,"Sending player %d's data to %d.\n",slot,whoto);
7953
7954 size_offset = START_DATA(MP_PLAYER_CUSTOM_DATA, data, &count);
7955 // Who we are talking about
7956 MultiAddShort(slot, data, &count);
7957
7958 // Send custom logo filename (all 0's if none)
7959 csum_filename[0] = '\0';
7960 if (NetPlayers[slot].ship_logo[0]) {
7961 if (slot == Player_num) {
7962 char szcrc[_MAX_PATH];
7963 ddio_SplitPath(NetPlayers[slot].ship_logo, path, file, ext);
7964 snprintf(szcrc, sizeof(szcrc), "_%.8x", cf_GetfileCRC(NetPlayers[slot].ship_logo));
7965 // See if the the CRC is already in the filename
7966 if (strnicmp(szcrc, file + (strlen(file) - 9), 9) == 0) {
7967 snprintf(csum_filename, sizeof(csum_filename), "%s%s", file, ext);
7968 } else {
7969 snprintf(csum_filename, sizeof(csum_filename), "%s_%.8x%s", file, cf_GetfileCRC(NetPlayers[slot].ship_logo),
7970 ext);
7971 }
7972 } else {
7973 strcpy(csum_filename, NetPlayers[slot].ship_logo);
7974 }
7975 }
7976 uint16_t logo_len = strlen(csum_filename) + 1;
7977 MultiAddUshort(logo_len, data, &count);
7978 memcpy(data + count, csum_filename, logo_len);
7979 count += logo_len;
7980
7981 for (int t = 0; t < 4; t++) {
7982 // Send custom voice taunts (all 0's if none)
7983 csum_filename[0] = '\0';
7984 char *filename;
7985
7986 switch (t) {
7987 case 0:
7988 filename = NetPlayers[slot].voice_taunt1;
7989 break;
7990 case 1:
7991 filename = NetPlayers[slot].voice_taunt2;
7992 break;
7993 case 2:
7994 filename = NetPlayers[slot].voice_taunt3;
7995 break;
7996 case 3:
7997 filename = NetPlayers[slot].voice_taunt4;
7998 break;
7999 }
8000

Callers 2

DoNextPlayerFileFunction · 0.85
MultiDoClientFrameFunction · 0.85

Calls 8

START_DATAFunction · 0.85
MultiAddShortFunction · 0.85
cf_GetfileCRCFunction · 0.85
MultiAddUshortFunction · 0.85
END_DATAFunction · 0.85
nw_SendReliableFunction · 0.85
ddio_SplitPathFunction · 0.50

Tested by

no test coverage detected