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

Function MultiDoMessageFromServer

Descent3/multi.cpp:4930–4953  ·  view source on GitHub ↗

Prints out a message we got from the server

Source from the content-addressed store, hash-verified

4928
4929// Prints out a message we got from the server
4930void MultiDoMessageFromServer(uint8_t *data) {
4931 static int sound_id = -2;
4932 int count = 0;
4933 char message[255];
4934
4935 SKIP_HEADER(data, &count);
4936
4937 ddgr_color color = MultiGetInt(data, &count);
4938 uint8_t len = MultiGetByte(data, &count);
4939
4940 memcpy(message, &data[count], len);
4941 count += len;
4942
4943 // Play the player hud message sound
4944 if (sound_id == -2) {
4945 sound_id = FindSoundName("Hudmessage");
4946 }
4947
4948 if (sound_id > -1) {
4949 Sound_system.Play2dSound(sound_id);
4950 }
4951
4952 AddColoredHUDMessage(color, "%s", message); // added "%s" because message could have % signs, formatting issue.
4953}
4954
4955// Sends a message from the server to the client
4956void MultiSendMessageFromServer(int color, char *message, int to) {

Callers 2

MultiProcessDataFunction · 0.85

Calls 6

SKIP_HEADERFunction · 0.85
MultiGetIntFunction · 0.85
MultiGetByteFunction · 0.85
FindSoundNameFunction · 0.85
AddColoredHUDMessageFunction · 0.85
Play2dSoundMethod · 0.80

Tested by

no test coverage detected