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

Function AddFilteredHUDMessage

Descent3/hudmessage.cpp:577–609  ·  view source on GitHub ↗

Adds a HUD message (similar to AddHUDMessage), however can be filtered out by a "-playermessages" command line.

Source from the content-addressed store, hash-verified

575// Adds a HUD message (similar to AddHUDMessage), however can be filtered out by
576// a "-playermessages" command line.
577bool AddFilteredHUDMessage(const char *format, ...) {
578 static int8_t checked_command_line = -1;
579
580 if (checked_command_line == -1) {
581 if (FindArg("-playermessages") != 0) {
582 checked_command_line = 1;
583 } else {
584 checked_command_line = 0;
585 }
586 }
587
588 if (Game_mode & GM_MULTI && checked_command_line)
589 return false; // filter this message
590
591 std::va_list args;
592 char *message = NULL;
593 char *last_message = NULL;
594 char temp_message[HUD_MESSAGE_LENGTH * 2];
595
596 va_start(args, format);
597 std::vsnprintf(temp_message, HUD_MESSAGE_LENGTH * 2, format, args);
598 va_end(args);
599
600 if (Demo_flags == DF_RECORDING) {
601 DemoWriteHudMessage(0, false, temp_message);
602 }
603
604 if (Dedicated_server) {
605 return AddLineToHUDMessages(temp_message);
606 }
607
608 return AddMultipleLinesToHUDMessages(temp_message);
609}
610
611// Adds a message to the HUD message list. If the list is already full, punt the
612// top one and move the others up

Callers 6

ShowAmmoAddedMessageFunction · 0.85
CheckForWeaponSelectFunction · 0.85
HandleWeaponPowerupsFunction · 0.85
HandleCommonPowerupsFunction · 0.85
HandleInventoryPowerupsFunction · 0.85

Calls 4

DemoWriteHudMessageFunction · 0.85
AddLineToHUDMessagesFunction · 0.85
FindArgFunction · 0.70

Tested by

no test coverage detected