// // G_BindResponder // // Responder for widget // bool G_BindResponder(event_t *ev) { keyaction_t *action; if(ev->type != ev_keydown) return false; // do not index out of bounds if(ev->data1 >= NUM_KEYS) return false; // got a key - close box MN_PopWidget(); if(action_menu_toggle) // cancel { action_menu_toggle = false; return true; } if(!(action = G_KeyActionForName(binding_action))) { C_Printf(FC_ERROR "unknown action '%s'\n", binding_action); return true; } // bind new key to action, if it is not already bound -- if it is, // remove it if(keybindings[ev->data1].bindings[action->bclass] != action) keybindings[ev->data1].bindings[action->bclass] = action; else keybindings[ev->data1].bindings[action->bclass] = NULL; // haleyjd 10/16/05: clear state of action involved keybindings[ev->data1].keydown[action->bclass] = false; if(action->type == at_variable) *(action->value.variable) = 0; return true; }
// // G_BindResponder // // Responder for widget // static bool G_BindResponder(event_t *ev, int mnaction) { keyaction_t *action; if(ev->type != ev_keydown) return false; // do not index out of bounds if(ev->data1 >= NUMKEYS) return false; // got a key - close box MN_PopWidget(); if(mnaction == ka_menu_toggle) // cancel return true; if(!(action = G_KeyActionForName(binding_action))) { C_Printf(FC_ERROR "unknown action '%s'\n", binding_action); return true; } // bind new key to action, if it is not already bound -- if it is, // remove it if(keybindings[ev->data1].bindings[action->bclass] != action) keybindings[ev->data1].bindings[action->bclass] = action; else keybindings[ev->data1].bindings[action->bclass] = NULL; // haleyjd 10/16/05: clear state of action involved bool wasdown = keybindings[ev->data1].keydown[action->bclass]; keybindings[ev->data1].keydown[action->bclass] = false; if(wasdown) --gGameKeyCount[action->bclass][action->num]; return true; }
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 }
// // MN_SkinResponder // // The skin viewer widget responder function. Sorta long and // hackish, but cool. // static bool MN_SkinResponder(event_t *ev, int action) { // only interested in keydown events if(ev->type != ev_keydown) return false; if(action == ka_menu_toggle || action == ka_menu_previous) { // kill the widget skview_metadeaths.clear(); S_StartInterfaceSound(GameModeInfo->menuSounds[MN_SND_DEACTIVATE]); MN_PopWidget(); return true; } if(action == ka_menu_left) { // rotate sprite left if(skview_rot == 7) skview_rot = 0; else skview_rot++; return true; } if(action == ka_menu_right) { // rotate sprite right if(skview_rot == 0) skview_rot = 7; else skview_rot--; return true; } if(action == ka_menu_up) { // increase light level if(skview_light != 0) --skview_light; return true; } if(action == ka_menu_down) { // decrease light level if(skview_light != 31) ++skview_light; return true; } switch(ev->data1) { case KEYD_RCTRL: // attack! if(skview_action == SKV_WALKING) { S_StartInterfaceSound(GameModeInfo->skvAtkSound); MN_SkinSetState(states[skview_atkstate2]); skview_action = SKV_FIRING; } break; case 'p': case 'P': // act hurt if(skview_action == SKV_WALKING) { MN_SkinSetState(states[mobjinfo[skview_typenum]->painstate]); skview_action = SKV_PAIN; } break; case 'd': case 'D': // die normally if(skview_action != SKV_DEAD) { MN_SkinSetState(states[mobjinfo[skview_typenum]->deathstate]); skview_action = SKV_DEAD; } break; case 'm': case 'M': // "meta" death (elemental death states) if(skview_action != SKV_DEAD && !skview_metadeaths.isEmpty()) { skview_metadeath = skview_metadeaths.wrapIterator(); MN_SkinSetState(skview_metadeath->state); skview_action = SKV_DEAD; } break; case 'x': case 'X': // gib if(skview_action != SKV_DEAD) { skview_gibbed = true; MN_SkinSetState(states[mobjinfo[skview_typenum]->xdeathstate]); skview_action = SKV_DEAD; } break; case 'h': case 'H': // toggle half-speed animation skview_halfspeed ^= true; break; case ' ': // "respawn" the player if dead if(skview_action == SKV_DEAD) { S_StartInterfaceSound(GameModeInfo->teleSound); MN_SkinSetState(states[mobjinfo[skview_typenum]->seestate]); skview_action = SKV_WALKING; } break; default: return false; } return true; }