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

Function DoHUDInputMessageKey

Descent3/hudmessage.cpp:948–1018  ·  view source on GitHub ↗

Handles all incoming keys for an inputted hud message

Source from the content-addressed store, hash-verified

946
947// Handles all incoming keys for an inputted hud message
948void DoHUDInputMessageKey(int key) {
949 if (key == KEY_F8) {
950 StartHUDInputMessage();
951 return;
952 }
953
954 if (Doing_input_message == HUD_MESSAGE_NONE)
955 return;
956
957 // ddio_KeyFlush(); // took this out. screwed up shift-keys. don't need it anyway.
958
959 if (key == KEY_ESC) {
960 Doing_input_message = HUD_MESSAGE_NONE;
961 MultiSendRequestTypeIcon(false);
962 Marker_message = 0;
963 HudInputMessage[0] = 0;
964 HudInputMessageLen = 0;
965 ResumeControls();
966 } else if (key == KEY_BACKSP || key == KEY_DELETE) {
967 if (HudInputMessageLen > 0)
968 HudInputMessageLen--;
969
970 HudInputMessage[HudInputMessageLen] = 0;
971 } else if (key == KEY_ENTER) {
972 if (Marker_message) {
973 DropMarker(HudInputMessage);
974 Doing_input_message = HUD_MESSAGE_NONE;
975 MultiSendRequestTypeIcon(false);
976 Marker_message = 0;
977 HudInputMessage[0] = 0;
978 HudInputMessageLen = 0;
979 ResumeControls();
980 } else
981 SendOffHUDInputMessage();
982 } else {
983 int ascii = ddio_KeyToAscii(key);
984 if (isdigit(ascii) || isalpha(ascii) || ispunct(ascii) || isspace(ascii)) {
985 if (Marker_message) {
986 if (HudInputMessageLen >= (MAX_MARKER_MESSAGE_LENGTH - 2))
987 return;
988 }
989
990 HudInputMessage[HudInputMessageLen++] = ascii;
991 HudInputMessage[HudInputMessageLen] = 0;
992
993 if (!Marker_message && HudInputMessageLen >= (MAX_HUD_INPUT_LEN - 1)) {
994 // Break up our outgoing message onto the next line if need be
995 char str[MAX_HUD_INPUT_LEN];
996 int str_len;
997 int old_style = Doing_input_message;
998
999 str_len = BreakupHUDInputMessage(str);
1000 SendOffHUDInputMessage();
1001
1002 switch (old_style) {
1003 case HUD_MESSAGE_TEAM:
1004 StartTeamHUDInputMessage();
1005 break;

Callers 1

ProcessKeysFunction · 0.85

Calls 8

StartHUDInputMessageFunction · 0.85
MultiSendRequestTypeIconFunction · 0.85
ResumeControlsFunction · 0.85
DropMarkerFunction · 0.85
SendOffHUDInputMessageFunction · 0.85
ddio_KeyToAsciiFunction · 0.85
BreakupHUDInputMessageFunction · 0.85
StartTeamHUDInputMessageFunction · 0.85

Tested by

no test coverage detected