static void StartChatInput(int dest) { chat_on = true; HUlib_resetIText(&w_chat); HU_queueChatChar(HU_BROADCAST); I_StartTextInput(0, 8, SCREENWIDTH, 16); }
boolean HU_Responder(event_t *ev) { static char lastmessage[HU_MAXLINELENGTH+1]; char* macromessage; boolean eatkey = false; static boolean shiftdown = false; static boolean altdown = false; unsigned char c; int i; int numplayers; static int num_nobrainers = 0; numplayers = 0; for (i=0 ; i<MAXPLAYERS ; i++) numplayers += playeringame[i]; if (ev->data1 == KEY_RSHIFT) { shiftdown = ev->type == ev_keydown; return false; } else if (ev->data1 == KEY_RALT || ev->data1 == KEY_LALT) { altdown = ev->type == ev_keydown; return false; } if (ev->type != ev_keydown) return false; if (!chat_on) { if (ev->data1 == key_message_refresh) { message_on = true; message_counter = HU_MSGTIMEOUT; eatkey = true; } else if (netgame && ev->data2 == key_multi_msg) { eatkey = chat_on = true; HUlib_resetIText(&w_chat); HU_queueChatChar(HU_BROADCAST); } else if (netgame && numplayers > 2) { for (i=0; i<MAXPLAYERS ; i++) { if (ev->data2 == key_multi_msgplayer[i]) { if (playeringame[i] && i!=consoleplayer) { eatkey = chat_on = true; HUlib_resetIText(&w_chat); HU_queueChatChar(i+1); break; } else if (i == consoleplayer) { num_nobrainers++; if (num_nobrainers < 3) plr->message = DEH_String(HUSTR_TALKTOSELF1); else if (num_nobrainers < 6) plr->message = DEH_String(HUSTR_TALKTOSELF2); else if (num_nobrainers < 9) plr->message = DEH_String(HUSTR_TALKTOSELF3); else if (num_nobrainers < 32) plr->message = DEH_String(HUSTR_TALKTOSELF4); else plr->message = DEH_String(HUSTR_TALKTOSELF5); } } } } } else { c = ev->data2; // send a macro if (altdown) { c = c - '0'; if (c > 9) return false; // fprintf(stderr, "got here\n"); macromessage = chat_macros[c]; // kill last message with a '\n' HU_queueChatChar(KEY_ENTER); // DEBUG!!! // send the macro message while (*macromessage) HU_queueChatChar(*macromessage++); HU_queueChatChar(KEY_ENTER); // leave chat mode and notify that it was sent chat_on = false; strcpy(lastmessage, chat_macros[c]); plr->message = lastmessage; eatkey = true; } else { if (vanilla_keyboard_mapping) { if (shiftdown || (c >= 'a' && c <= 'z')) { c = shiftxform[c]; } } eatkey = HUlib_keyInIText(&w_chat, c); if (eatkey) { // static unsigned char buf[20]; // DEBUG HU_queueChatChar(c); // sprintf(buf, "KEY: %d => %d", ev->data1, c); // plr->message = buf; } if (c == KEY_ENTER) { chat_on = false; if (w_chat.l.len) { strcpy(lastmessage, w_chat.l.l); plr->message = lastmessage; } } else if (c == KEY_ESCAPE) chat_on = false; } } return eatkey; }
dboolean HU_Responder(event_t *ev) { static char lastmessage[HU_MAXLINELENGTH+1]; char* macromessage; dboolean eatkey = false; static dboolean shiftdown = false; static dboolean altdown = false; unsigned char c; int i; int numplayers; static char destination_keys[MAXPLAYERS] = { HUSTR_KEYGREEN, HUSTR_KEYINDIGO, HUSTR_KEYBROWN, HUSTR_KEYRED }; static int num_nobrainers = 0; numplayers = 0; for (i=0 ; i<MAXPLAYERS ; i++) numplayers += playeringame[i]; if (ev->data1 == KEY_RSHIFT) { shiftdown = ev->type == ev_keydown; return false; } else if (ev->data1 == KEY_RALT || ev->data1 == KEY_LALT) { altdown = ev->type == ev_keydown; return false; } if (ev->type != ev_keydown) return false; if (!chat_on) { if (ev->data1 == HU_MSGREFRESH) { message_on = true; message_counter = HU_MSGTIMEOUT; eatkey = true; } else if (netgame && ev->data1 == HU_INPUTTOGGLE) { eatkey = chat_on = true; HUlib_resetIText(&w_chat); HU_queueChatChar(HU_BROADCAST); } else if (netgame && numplayers > 2) { for (i=0; i<MAXPLAYERS ; i++) { if (ev->data1 == destination_keys[i]) { if (playeringame[i] && i!=consoleplayer) { eatkey = chat_on = true; HUlib_resetIText(&w_chat); HU_queueChatChar(i+1); break; } else if (i == consoleplayer) { num_nobrainers++; if (num_nobrainers < 3) plr->message = HUSTR_TALKTOSELF1; else if (num_nobrainers < 6) plr->message = HUSTR_TALKTOSELF2; else if (num_nobrainers < 9) plr->message = HUSTR_TALKTOSELF3; else if (num_nobrainers < 32) plr->message = HUSTR_TALKTOSELF4; else plr->message = HUSTR_TALKTOSELF5; } } } } } else { c = ev->data1; // send a macro if (altdown) { c = c - '0'; if (c > 9) return false; // fprintf(stderr, "got here\n"); macromessage = chat_macros[c]; // kill last message with a '\n' HU_queueChatChar(KEY_ENTER); // DEBUG!!! // send the macro message while (*macromessage) HU_queueChatChar(*macromessage++); HU_queueChatChar(KEY_ENTER); // leave chat mode and notify that it was sent chat_on = false; strcpy(lastmessage, chat_macros[c]); plr->message = lastmessage; eatkey = true; } else { if (french) c = ForeignTranslation(c); if (shiftdown || (c >= 'a' && c <= 'z')) c = shiftxform[c]; eatkey = HUlib_keyInIText(&w_chat, c); if (eatkey) { // static unsigned char buf[20]; // DEBUG HU_queueChatChar(c); // sprintf(buf, "KEY: %d => %d", ev->data1, c); // plr->message = buf; } if (c == KEY_ENTER) { chat_on = false; if (w_chat.l.len) { strcpy(lastmessage, w_chat.l.l); plr->message = lastmessage; } } else if (c == KEY_ESCAPE) chat_on = false; } } return eatkey; }
// // HU_Responder() // // Responds to input events that affect the heads up displays // // Passed the event to respond to, returns true if the event was handled // boolean HU_Responder(event_t* ev) { static char lastmessage[HU_MAXLINELENGTH + 1]; char* macromessage; boolean eatkey = false; static boolean shiftdown = false; static boolean altdown = false; unsigned char c; int i; int numplayers; static int num_nobrainers = 0; numplayers = 0; for (i = 0 ; i < MAXPLAYERS ; i++) numplayers += playeringame[i]; if (ev->data1 == key_shift) { shiftdown = ev->type == ev_keydown; return false; } if (ev->data1 == key_alt) { altdown = ev->type == ev_keydown; return false; } if (ev->type != ev_keydown) return false; if (!chat_on) { if (ev->data1 == key_enter) // phares { //jff 2/26/98 toggle list of messages // killough 11/98: // Toggle message list only if a message is actively being reviewed. if (has_message) { if (message_list ? message_list_on && (reviewing_message || !hud_msg_timed) : message_on && reviewing_message) if (!(message_list = !message_list)) { extern boolean setsizeneeded; // killough 12/98: // fix crash at startup if key_enter held down if (gametic && gamestate == GS_LEVEL) HU_Erase(); //jff 4/28/98 erase behind messages message_list_on = false; // killough 11/98: fix background for smaller screens: if (hud_list_bgon && scaledviewheight < 200) setsizeneeded = true; } // killough 11/98: Support timed or continuous message lists if (!message_list) // if not message list, refresh message { message_counter = message_count; reviewing_message = message_on = true; } else { // message list, possibly timed if (hud_msg_timed) message_list_counter = hud_msg_count; reviewing_message = message_list_on = true; } } eatkey = true; } //jff 2/26/98 no chat if message review is displayed else // killough 10/02/98: no chat if demo playback if (!demoplayback) if (!message_list) if (netgame && ev->data1 == key_chat) { eatkey = chat_on = true; HUlib_resetIText(&w_chat); HU_queueChatChar(HU_BROADCAST); }//jff 2/26/98 else // killough 11/98: simplify if (!message_list && netgame && numplayers > 2) for (i = 0; i < MAXPLAYERS ; i++) if (ev->data1 == destination_keys[i]) if (i == consoleplayer) plr->message = ++num_nobrainers < 3 ? HUSTR_TALKTOSELF1 : num_nobrainers < 6 ? HUSTR_TALKTOSELF2 : num_nobrainers < 9 ? HUSTR_TALKTOSELF3 : num_nobrainers < 32 ? HUSTR_TALKTOSELF4 : HUSTR_TALKTOSELF5 ; else if (playeringame[i]) { eatkey = chat_on = true; HUlib_resetIText(&w_chat); HU_queueChatChar((char)(i + 1)); break; } }//jff 2/26/98 no chat functions if message review is displayed else if (!message_list) { c = ev->data1; // send a macro if (altdown) { c = c - '0'; if (c > 9) return false; // fprintf(stderr, "got here\n"); macromessage = chat_macros[c]; // kill last message with a '\n' HU_queueChatChar((char)key_enter); // DEBUG!!! // phares // send the macro message while (*macromessage) HU_queueChatChar(*macromessage++); HU_queueChatChar((char)key_enter); // phares // leave chat mode and notify that it was sent chat_on = false; strcpy(lastmessage, chat_macros[c]); plr->message = lastmessage; eatkey = true; } else { if (shiftdown || (c >= 'a' && c <= 'z')) c = shiftxform[c]; eatkey = HUlib_keyInIText(&w_chat, c); if (eatkey) HU_queueChatChar(c); if (c == key_enter) // phares { chat_on = false; if (w_chat.l.len) { strcpy(lastmessage, w_chat.l.l); plr->message = lastmessage; } } else if (c == key_escape) // phares chat_on = false; } } return eatkey; }
qboolean HU_Responder(event_t *ev) { const char* macromessage; qboolean eatkey = false; unsigned char c; int i; int numplayers; const static char destination_keys[MAXPLAYERS] = { HUSTR_KEYGREEN, HUSTR_KEYINDIGO, HUSTR_KEYBROWN, HUSTR_KEYRED }; numplayers = 0; for (i=0 ; i<MAXPLAYERS ; i++) numplayers += ::g->playeringame[i]; if (ev->data1 == KEY_RSHIFT) { ::g->shiftdown = ev->type == ev_keydown; return false; } else if (ev->data1 == KEY_RALT || ev->data1 == KEY_LALT) { ::g->altdown = ev->type == ev_keydown; return false; } if (ev->type != ev_keydown) return false; if (!::g->chat_on) { if (ev->data1 == HU_MSGREFRESH) { ::g->message_on = true; ::g->message_counter = HU_MSGTIMEOUT; eatkey = true; } else if (::g->netgame && ev->data1 == HU_INPUTTOGGLE) { eatkey = ::g->chat_on = true; HUlib_resetIText(&::g->w_chat); HU_queueChatChar(HU_BROADCAST); } else if (::g->netgame && numplayers > 2) { for (i=0; i<MAXPLAYERS ; i++) { if (ev->data1 == destination_keys[i]) { if (::g->playeringame[i] && i!=::g->consoleplayer) { eatkey = ::g->chat_on = true; HUlib_resetIText(&::g->w_chat); HU_queueChatChar(i+1); break; } else if (i == ::g->consoleplayer) { ::g->num_nobrainers++; if (::g->num_nobrainers < 3) ::g->plr->message = HUSTR_TALKTOSELF1; else if (::g->num_nobrainers < 6) ::g->plr->message = HUSTR_TALKTOSELF2; else if (::g->num_nobrainers < 9) ::g->plr->message = HUSTR_TALKTOSELF3; else if (::g->num_nobrainers < 32) ::g->plr->message = HUSTR_TALKTOSELF4; else ::g->plr->message = HUSTR_TALKTOSELF5; } } } } } else { c = ev->data1; // send a macro if (::g->altdown) { c = c - '0'; if (c > 9) return false; // I_PrintfE( "got here\n"); macromessage = temp_chat_macros[c]; // kill last message with a '\n' HU_queueChatChar(KEY_ENTER); // DEBUG!!! // send the macro message while (*macromessage) HU_queueChatChar(*macromessage++); HU_queueChatChar(KEY_ENTER); // leave chat mode and notify that it was sent ::g->chat_on = false; strcpy(::g->lastmessage, temp_chat_macros[c]); ::g->plr->message = ::g->lastmessage; eatkey = true; } else { if (::g->shiftdown || (c >= 'a' && c <= 'z')) c = shiftxform[c]; eatkey = HUlib_keyInIText(&::g->w_chat, c); if (eatkey) { // static unsigned char buf[20]; // DEBUG HU_queueChatChar(c); // sprintf(buf, "KEY: %d => %d", ev->data1, c); // ::g->plr->message = buf; } if (c == KEY_ENTER) { ::g->chat_on = false; if (::g->w_chat.l.len) { strcpy(::g->lastmessage, ::g->w_chat.l.l); ::g->plr->message = ::g->lastmessage; } } else if (c == KEY_ESCAPE) ::g->chat_on = false; } } return eatkey; }