static void cheat_one(const void *arg) { int pwinv = pw_totalinvis; int pwsil = pw_silencer; if(!(players[consoleplayer].cheats & CF_GODMODE)) C_RunTextCmd("god"); if(!(players[consoleplayer].cheats & CF_INFAMMO)) C_RunTextCmd("infammo"); cheat_fa(arg); if(!players[consoleplayer].powers[pw_totalinvis]) cheat_pw(&pwinv); if(!players[consoleplayer].powers[pw_silencer]) cheat_pw(&pwsil); }
// Pusher cheat // phares 3/10/98 static void cheat_pushers(const void *arg) { C_RunTextCmd("pushers /"); // FIXME: externalize strings doom_printf(allow_pushers ? "pushers enabled" : "pushers disabled"); }
// variable friction cheat static void cheat_friction(const void *arg) { C_RunTextCmd("varfriction /"); //sf // FIXME: externalize strings doom_printf(variable_friction ? "Variable Friction enabled" : "Variable Friction disabled" ); }
// // G_KeyResponder // // The main driver function for the entire key binding system // int G_KeyResponder(const event_t *ev, int bclass, bool *allreleased) { int ret = ka_nothing; keyaction_t *action = NULL; if(allreleased) *allreleased = false; // do not index out of bounds if(ev->data1 >= NUMKEYS) return ret; if(ev->type == ev_keydown) { int key = ectype::toLower(ev->data1); bool wasdown = keybindings[key].keydown[bclass]; keybindings[key].keydown[bclass] = true; if((action = keybindings[key].bindings[bclass])) { switch(keybindings[key].bindings[bclass]->type) { case at_conscmd: if(!consoleactive) // haleyjd: not in console. C_RunTextCmd(keybindings[key].bindings[bclass]->name); break; default: break; } ret = action->num; if(!wasdown) ++gGameKeyCount[bclass][ret]; } } else if(ev->type == ev_keyup) { int key = ectype::toLower(ev->data1); bool wasdown = keybindings[key].keydown[bclass]; keybindings[key].keydown[bclass] = false; if((action = keybindings[key].bindings[bclass])) { ret = action->num; if(wasdown) --gGameKeyCount[bclass][ret]; if(allreleased && !gGameKeyCount[bclass][ret]) *allreleased = true; } } return ret; }
boolean MN_PopupResponder(event_t *ev) { if(ev->type != ev_keydown) return false; switch(popup_message_type) { case popup_alert: { // kill message redrawsbar = redrawborder = true; // need redraw current_menuwidget = NULL; S_StartSound(NULL, sfx_swtchx); } break; case popup_question: if(tolower(ev->data1) == 'y') // yes! { // run command and kill message menuactive = false; // kill menu cmdtype = c_menu; C_RunTextCmd(popup_message_command); S_StartSound(NULL, sfx_pistol); redrawsbar = redrawborder = true; // need redraw current_menuwidget = NULL; // kill message } if(tolower(ev->data1) == 'n' || ev->data1 == KEYD_ESCAPE || ev->data1 == KEYD_BACKSPACE) // no! { // kill message menuactive = false; // kill menu S_StartSound(NULL, sfx_swtchx); redrawsbar = redrawborder = true; // need redraw current_menuwidget = NULL; // kill message } break; default: break; } return true; // always eatkey }
// // HU_ChatRespond // // Responds to chat-related events. // static bool HU_ChatRespond(const event_t *ev) { char ch = 0; static bool shiftdown; static bool discardinput = false; // haleyjd 06/11/08: get HUD actions int action = G_KeyResponder(ev, kac_hud); if(ev->data1 == KEYD_RSHIFT) shiftdown = (ev->type == ev_keydown); (void)shiftdown; if(action == ka_frags) hu_showfrags = (ev->type == ev_keydown); if(ev->type != ev_keydown && ev->type != ev_text) return false; if(!chat_active) { if(ev->data1 == key_chat && netgame) { chat_active = true; // activate chat chatinput[0] = 0; // empty input string if(ectype::isPrint(ev->data1)) discardinput = true; // avoid activation key also appearing in input string return true; } return false; } if(ev->type == ev_text && discardinput) { discardinput = false; return true; } if(altdown && ev->type == ev_keydown && ev->data1 >= '0' && ev->data1 <= '9') { // chat macro char tempstr[100]; psnprintf(tempstr, sizeof(tempstr), "say \"%s\"", chat_macros[ev->data1-'0']); C_RunTextCmd(tempstr); chat_active = false; return true; } if(ev->data1 == KEYD_ESCAPE) // kill chat { chat_active = false; return true; } if(ev->data1 == KEYD_BACKSPACE && chatinput[0]) { chatinput[strlen(chatinput)-1] = 0; // remove last char return true; } if(ev->data1 == KEYD_ENTER) { char tempstr[100]; psnprintf(tempstr, sizeof(tempstr), "say \"%s\"", chatinput); C_RunTextCmd(tempstr); chat_active = false; return true; } if(ev->type == ev_keydown && ectype::isPrint(ev->data1)) return true; // eat keydown inputs that have text equivalent if(ev->type == ev_text) ch = ev->data1; if(ectype::isPrint(ch)) { psnprintf(chatinput, sizeof(chatinput), "%s%c", chatinput, ch); return true; } return false; }
bool MN_PopupResponder(event_t *ev) { int *menuSounds = GameModeInfo->menuSounds; char ch; if(ev->type != ev_keydown) return false; if(ev->character) ch = tolower(ev->character); else ch = ev->data1; switch(popup_message_type) { case popup_alert: { // haleyjd 02/24/02: restore saved menuactive state menuactive = popupMenuActive; // kill message MN_PopWidget(); S_StartSound(NULL, menuSounds[MN_SND_DEACTIVATE]); } break; case popup_question: if(ch == 'y') // yes! { // run command and kill message // haleyjd 02/24/02: restore saved menuactive state menuactive = popupMenuActive; if(popup_callback) { popup_callback(); popup_callback = NULL; } else { Console.cmdtype = c_menu; C_RunTextCmd(popup_message_command); } S_StartSound(NULL, menuSounds[MN_SND_COMMAND]); MN_PopWidget(); // kill message } if(ch == 'n' || action_menu_toggle || action_menu_previous) // no! { // kill message // haleyjd 02/24/02: restore saved menuactive state action_menu_toggle = action_menu_previous = false; menuactive = popupMenuActive; S_StartSound(NULL, menuSounds[MN_SND_DEACTIVATE]); MN_PopWidget(); // kill message } break; default: break; } return true; // always eat key }
// // G_KeyResponder // // The main driver function for the entire key binding system // bool G_KeyResponder(event_t *ev, int bclass) { static bool ctrldown; bool ret = false; // do not index out of bounds if(ev->data1 >= NUM_KEYS) return ret; if(ev->data1 == KEYD_RCTRL) // ctrl ctrldown = (ev->type == ev_keydown); if(ev->type == ev_keydown) { int key = tolower(ev->data1); if(opensocket && // netgame disconnect binding ctrldown && ev->data1 == 'd') { char buffer[128]; psnprintf(buffer, sizeof(buffer), "disconnect from server?\n\n%s", DEH_String("PRESSYN")); MN_Question(buffer, "disconnect leaving"); // dont get stuck thinking ctrl is down ctrldown = false; return true; } //if(!keybindings[key].keydown[bclass]) { keybindings[key].keydown[bclass] = true; if(keybindings[key].bindings[bclass]) { switch(keybindings[key].bindings[bclass]->type) { case at_variable: *(keybindings[key].bindings[bclass]->value.variable) = 1; break; case at_function: keybindings[key].bindings[bclass]->value.Handler(ev); break; case at_conscmd: if(!consoleactive) // haleyjd: not in console. C_RunTextCmd(keybindings[key].bindings[bclass]->name); break; default: break; } ret = true; } } } else if(ev->type == ev_keyup) { int key = tolower(ev->data1); keybindings[key].keydown[bclass] = false; if(keybindings[key].bindings[bclass]) { switch(keybindings[key].bindings[bclass]->type) { case at_variable: *(keybindings[key].bindings[bclass]->value.variable) = 0; break; case at_function: keybindings[key].bindings[bclass]->value.Handler(ev); break; default: break; } ret = true; } } return ret; }
// // HU_ChatRespond // // Responds to chat-related events. // static bool HU_ChatRespond(event_t *ev) { char ch = 0; static bool shiftdown; // haleyjd 06/11/08: get HUD actions int action = G_KeyResponder(ev, kac_hud); if(ev->data1 == KEYD_RSHIFT) shiftdown = (ev->type == ev_keydown); if(action == ka_frags) hu_showfrags = (ev->type == ev_keydown); if(ev->type != ev_keydown) return false; if(!chat_active) { if(ev->data1 == key_chat && netgame) { chat_active = true; // activate chat chatinput[0] = 0; // empty input string return true; } return false; } if(altdown && ev->type == ev_keydown && ev->data1 >= '0' && ev->data1 <= '9') { // chat macro char tempstr[100]; psnprintf(tempstr, sizeof(tempstr), "say \"%s\"", chat_macros[ev->data1-'0']); C_RunTextCmd(tempstr); chat_active = false; return true; } if(ev->data1 == KEYD_ESCAPE) // kill chat { chat_active = false; return true; } if(ev->data1 == KEYD_BACKSPACE && chatinput[0]) { chatinput[strlen(chatinput)-1] = 0; // remove last char return true; } if(ev->data1 == KEYD_ENTER) { char tempstr[100]; psnprintf(tempstr, sizeof(tempstr), "say \"%s\"", chatinput); C_RunTextCmd(tempstr); chat_active = false; return true; } if(ev->character) ch = ev->character; else if(ev->data1 > 31 && ev->data1 < 127) ch = shiftdown ? shiftxform[ev->data1] : ev->data1; // shifted? if(ch > 31 && ch < 127) { psnprintf(chatinput, sizeof(chatinput), "%s%c", chatinput, ch); return true; } return false; }
// killough 2/7/98: HOM autodetection static void cheat_hom(const void *arg) { C_RunTextCmd("r_showhom /"); //sf }
// jff 2/01/98 kill all monsters static void cheat_massacre(const void *arg) { C_RunTextCmd("nuke"); //sf }
// translucency cheat static void cheat_tran(const void *arg) { C_RunTextCmd("r_trans /"); // sf }
static void cheat_noclip(const void *arg) { // Simplified, accepting both "noclip" and "idspispopd". C_RunTextCmd("noclip"); }
static void cheat_infammo(const void *arg) { C_RunTextCmd("infammo"); }
static void cheat_god(const void *arg) { // 'dqd' cheat for toggleable god mode C_RunTextCmd("god"); }