//------------------------------------------------------------ // rvMonsterBossBuddy::CheckActions //------------------------------------------------------------ bool rvMonsterBossBuddy::CheckActions( void ) { // If not moving, try turning in place /* if ( !move.fl.moving && gameLocal.time > combat.investigateTime ) { float turnYaw = idMath::AngleNormalize180( move.ideal_yaw - move.current_yaw ); if ( turnYaw > lookMax[YAW] * 0.75f ) { PerformAction( "Torso_TurnRight90", 4, true ); return true; } else if ( turnYaw < -lookMax[YAW] * 0.75f ) { PerformAction( "Torso_TurnLeft90", 4, true ); return true; } } */ if ( PerformAction( &mActionMeleeMoveAttack, (checkAction_t)&idAI::CheckAction_MeleeAttack, NULL ) || PerformAction( &mActionSlashMoveAttack, (checkAction_t)&idAI::CheckAction_MeleeAttack, &actionTimerSpecialAttack )) { return true; } if ( PerformAction( &mActionDarkMatterAttack, (checkAction_t)&idAI::CheckAction_RangedAttack, &actionTimerRangedAttack ) || PerformAction( &mActionRocketAttack, (checkAction_t)&idAI::CheckAction_RangedAttack, &actionTimerRangedAttack ) || PerformAction( &mActionLightningAttack, (checkAction_t)&idAI::CheckAction_RangedAttack, &actionTimerRangedAttack )) { return true; } return idAI::CheckActions( ); }
void UserCastSpell(void) { spell *sp = NULL, *temp; list_type sel_list, l; if (GetPlayer()->viewID && (GetPlayer()->viewID != GetPlayer()->id)) { if (!(GetPlayer()->viewFlags & REMOTE_VIEW_CAST)) return; } sel_list = DisplayLookList(cinfo->hMain, GetString(hInst, IDS_CAST), spells, LD_SORT); if (sel_list == NULL) return; /* Find spell in our private list */ temp = (spell *) sel_list->data; for (l = spells; l != NULL; l = l->next) { sp = (spell *) l->data; if (sp->obj.id == temp->obj.id) break; } if (sp == NULL) { debug(("Couldn't find selected spell in spell list!\n")); return; } list_delete(sel_list); PerformAction(A_CASTSPELL, sp); }
/* * ToolbarButtonPressed: Toolbar button with given Button structure was pressed. */ void ToolbarButtonPressed(Button *b) { int action; void *data; /* See if module wants to handle this event */ if (ModuleEvent(EVENT_TOOLBUTTON, b) == False) return; action = b->action; data = b->action_data; // If button is a toggle, set state to toggled if pressing in; perform up action if pushing out if (b->action2 != A_NOACTION) { // b->pressed = !b->pressed; if (b->pressed) Button_SetState(b->hwnd, TRUE); else { action = b->action2; data = b->action_data2; } } PerformAction(action, data); }
// TerminalMenuManager // Control routine for operating the menu. // // Parameters: None // Generate menu // output menu // prompt for valid selection // do action of selection // until done. int Menu::TerminalMenuManager() { char* pMenuBuffer = NULL; boolean bDone = false; int iMenuResponse, iActionID; while (!bDone) { pMenuBuffer = (char*) malloc(150); GenerateMenu(pMenuBuffer, 150,true); Serial << endl << pMenuBuffer; free(pMenuBuffer); gBuffer[0] = GetMenuResponse( GetBuffer_P(STI_MENU_PROMPT_1000, gBuffer, ENTRY_FIELD_SIZE) ,9); gBuffer[1] = '\0'; iMenuResponse = atoi(gBuffer); iActionID = paMenuActions[iMenuResponse]; PerformAction(iActionID); if (iCurrentMenu < MENU_MAIN ) { bDone = true; } } }
//------------------------------------------------------------ // rvMonsterBossBuddy::Damage //------------------------------------------------------------ void rvMonsterBossBuddy::Think() { if ( !fl.hidden && !fl.isDormant && (thinkFlags & TH_THINK ) && !aifl.dead ) { // run simple shielding logic when we have them active if ( mIsShielded ) { ReduceShields( 1 ); // if they are on but we haven't taken damage in x seconds, turn them off to conserve on shields if ( (mLastDamageTime + mShieldsLastFor) < gameLocal.time ) { AdjustShieldState( false ); } } // update shield bar idUserInterface *hud = gameLocal.GetLocalPlayer()->hud; if ( hud ) { float percent = ((float)mShields/mMaxShields); hud->SetStateFloat( "boss_shield_percent", percent ); hud->HandleNamedEvent( "updateBossShield" ); } } if ( move.obstacle.GetEntity() ) { PerformAction( &mActionSlashMoveAttack, (checkAction_t)&idAI::CheckAction_MeleeAttack, &actionTimerSpecialAttack ); } idAI::Think(); }
BOOL CPowerMateThread::InitInstance() { //mixerOpen(&m_mixer, 0, NULL, 0, MIXER_OBJECTF_WAVEOUT); char reportBuffer[8]; DWORD txdBytes; BOOL result; m_OldButtonState = 0; //m_pDlgWnd->m_AxisDataEditCtrl.SetWindowText("0"); //m_pDlgWnd->m_ButtonDataEditCtrl.SetWindowText("Up"); m_Running = TRUE; while (m_Running == TRUE) { result = ReadFile(m_hPowerMate, reportBuffer, sizeof(reportBuffer), &txdBytes, NULL); if (result) { if( txdBytes == 7) PerformAction(m_hPowerMate, reportBuffer); } else break; } AfxEndThread(0); // avoid entering standard message loop by returning FALSE return FALSE; }
/* * UserEndDrag: User has ended drag of an object. */ void UserEndDrag(void) { if (!GraphicsReleaseCapture()) return; PerformAction(A_ENDDRAG, (void *) drag_object); }
/* ================ rvMonsterTurret::CheckActions ================ */ bool rvMonsterTurret::CheckActions ( void ) { // Attacks if ( PerformAction ( &actionBlasterAttack, (checkAction_t)&idAI::CheckAction_RangedAttack, &actionTimerRangedAttack ) ) { return true; } return idAI::CheckActions ( ); }
//----------------------------------------------------------------------// // blueprint interface //----------------------------------------------------------------------// bool UPawnActionsComponent::K2_PerformAction(APawn* Pawn, UPawnAction* Action, TEnumAsByte<EAIRequestPriority::Type> Priority) { if (Pawn && Action) { PerformAction(*Pawn, *Action, Priority); } return false; }
void Player::Update(const DataForController& /* data */, double dt) { m_position = GetNextPosition(dt); // (1) PerformAction(GetController()->GetNextAction()); // (2) GetController()->ResetNextAction(); // (1) & (2) must be in that order. Otherwise it is possible to walk // through the walls by pressing keys quickly }
void PerformAction (T action, IProxyObject *azothProxy, ICLEntry *entry, const QString& text) { PerformAction (action, [azothProxy, entry] (const QString& name) { InjectMessage (azothProxy, entry, QObject::tr ("Unable to resolve %1.").arg ("<em>" + name + "</em>")); }, entry, text); }
bool wxScrollBar::OnArrow(wxScrollArrows::Arrow arrow) { int oldThumbPos = GetThumbPosition(); PerformAction(arrow == wxScrollArrows::Arrow_First ? wxACTION_SCROLL_LINE_UP : wxACTION_SCROLL_LINE_DOWN); // did we scroll till the end? return GetThumbPosition() != oldThumbPos; }
UEdGraphNode* FDecoratorSchemaAction_NewNode::PerformAction(class UEdGraph* ParentGraph, TArray<UEdGraphPin*>& FromPins, const FVector2D Location, bool bSelectNewNode) { UEdGraphNode* ResultNode = NULL; if (FromPins.Num() > 0) { ResultNode = PerformAction(ParentGraph, FromPins[0], Location); // Try autowiring the rest of the pins for (int32 Index = 1; Index < FromPins.Num(); ++Index) { ResultNode->AutowireNewNode(FromPins[Index]); } } else { ResultNode = PerformAction(ParentGraph, NULL, Location, bSelectNewNode); } return ResultNode; }
/* * TextInputKey: User pressed a key on text input box. * Return True iff key should NOT be passed on to Windows for default processing. */ Bool TextInputKey(HWND hwnd, UINT key, Bool fDown, int cRepeat, UINT flags) { Bool held_down = (flags & 0x4000) ? True : False; /* Is key being held down? */ char string[MAXSAY + 1]; int action; BOOL bValid; void *action_data; if (key == VK_RETURN && !held_down) { UserDidSomething(); ComboBox_GetText(hwndInput, string, MAXSAY + 1); if (string[0] == 0) return True; SetFocus(hMain); bValid = ParseGotText(string); // Add it to the history. if (*string && bValid) { BOOL bAdd = TRUE; int iCount; char achHead[MAXSAY+1]; iCount = ComboBox_GetCount(hwndInput); if (iCount > 0) { ComboBox_GetLBText(hwndInput, 0, achHead); if (0 == strcmp(achHead, string)) bAdd = FALSE; } if (bAdd) { ComboBox_InsertString(hwndInput, 0, string); if (iCount > EDITBOX_HISTORY) ComboBox_DeleteString(hwndInput, iCount); } } return True; } // Check for special keys action = TranslateKey(key, textin_key_table, &action_data); if (action == A_NOACTION) return False; PerformAction(action, action_data); return True; }
/* ================ rvMonsterGrunt::CheckActions ================ */ bool rvMonsterGrunt::CheckActions ( void ) { // If our health is below the rage threshold then enrage if ( health < rageThreshold ) { PerformAction ( "Torso_Enrage", 4, true ); return true; } // Moving melee attack? if ( PerformAction ( &actionMeleeMoveAttack, (checkAction_t)&idAI::CheckAction_MeleeAttack, NULL ) ) { return true; } // Default actions if ( CheckPainActions ( ) ) { return true; } if ( PerformAction ( &actionEvadeLeft, (checkAction_t)&idAI::CheckAction_EvadeLeft, &actionTimerEvade ) || PerformAction ( &actionEvadeRight, (checkAction_t)&idAI::CheckAction_EvadeRight, &actionTimerEvade ) || PerformAction ( &actionJumpBack, (checkAction_t)&idAI::CheckAction_JumpBack, &actionTimerEvade ) || PerformAction ( &actionLeapAttack, (checkAction_t)&idAI::CheckAction_LeapAttack ) ) { return true; } else if ( PerformAction ( &actionMeleeAttack, (checkAction_t)&idAI::CheckAction_MeleeAttack ) ) { standingMeleeNoAttackTime = 0; return true; } else { if ( actionMeleeAttack.status != rvAIAction::STATUS_FAIL_TIMER && actionMeleeAttack.status != rvAIAction::STATUS_FAIL_EXTERNALTIMER && actionMeleeAttack.status != rvAIAction::STATUS_FAIL_CHANCE ) {//melee attack fail for any reason other than timer? if ( combat.tacticalCurrent == AITACTICAL_MELEE && !move.fl.moving ) {//special case: we're in tactical melee and we're close enough to think we've reached the enemy, but he's just out of melee range! if ( !standingMeleeNoAttackTime ) { standingMeleeNoAttackTime = gameLocal.GetTime(); } else if ( standingMeleeNoAttackTime + 2500 < gameLocal.GetTime() ) {//we've been standing still and not attacking for at least 2.5 seconds, fall back to ranged attack //allow ranged attack actionRangedAttack.fl.disabled = false; } } } if ( PerformAction ( &actionRangedAttack,(checkAction_t)&idAI::CheckAction_RangedAttack, &actionTimerRangedAttack ) ) { return true; } } return false; }
void GraphMapper::OnMouseClick(Vec pos) { PathNode *node = GetNodeAtPixel(pos.x, pos.y); if (!node) return; /* Attempt to treat the current state as a single-PathNode-state. * If ACTION_FAILURE is returned, the state requires two PathNodes. */ if (PerformAction(node) == ACTION_FAILURE) { /* The current state requires two PathNodes. _lastNode and * the currently pressed PathNode are the two nodes in * question. */ if (_lastNode) { if (PerformAction(_lastNode, node) == ACTION_SUCCESS) { _lastNode = NULL; } } else { _lastNode = node; } } }
/* * StatsListLButtonDblClk: User double-clicked left button on stats list. ajw */ void StatsListLButtonDblClk(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags) { char pszLabel[256]; char pszCommand[256]; int iLabelLen; int index = y / ListBox_GetItemHeight(hwnd, 0) + ListBox_GetTopIndex(hwnd); if (index >= ListBox_GetCount(hwnd)) return; if ((GetPlayerInfo()->viewID != 0) && (GetPlayerInfo()->viewID != GetPlayerInfo()->id)) { if (!(GetPlayerInfo()->viewFlags & REMOTE_VIEW_CAST)) return; } ListBox_SetCurSel(hwnd, index); iLabelLen = ListBox_GetTextLen( hwnd, index ); if( ListBox_GetText( hwnd, index, pszLabel ) != LB_ERR ) { if( StatsGetCurrentGroup() == STATS_SPELLS ) { strcpy( pszCommand, "zaubern " ); } else if (StatsGetCurrentGroup() == STATS_SKILLS) { strcpy( pszCommand, "perform " ); return; // not implimented yet } else { return; // not going to do anything for non skills/stats } strcat( pszCommand, pszLabel ); PerformAction( A_GOTOMAIN, NULL ); // For targeting icon to appear, focus must be on main view window. PerformAction( A_TEXTCOMMAND, pszCommand ); } }
/* * MenuSpellChosen: The spell with the given command id in the spell menu was chosen. */ void MenuSpellChosen(int id) { int len, num=0, index=0, i; char item_name[MAXRSCSTRING + 1]; spell *sp; HMENU submenu = NULL; if (spell_menu == NULL) return; for (i=0; i < num_schools; i++) { submenu = submenus[i]; if (submenu) { num = GetMenuItemCount(submenu); // Look for menu item matching command id for (index = 0; index < num; index++) { if (GetMenuItemID(submenu, index) == (UINT) id) break; } if (index != num) break; } } if (index == num) { debug(("MenuSpellChosen couldn't find menu id #%d\n", id)); return; } len = GetMenuString(submenu, index, item_name, MAXRSCSTRING, MF_BYPOSITION); if (len == 0) { debug(("MenuSpellChosen get spell #%d from menu\n", index)); return; } sp = FindSpellByName(item_name); if (sp == SPELL_NOMATCH || sp == SPELL_AMBIGUOUS) { debug(("MenuSpellChosen couldn't find spell %s\n", item_name)); return; } PerformAction(A_CASTSPELL, sp); }
/* ================ rvMonsterBerserker::CheckActions ================ */ bool rvMonsterBerserker::CheckActions ( void ) { // Pop-up attack is a forward moving melee attack that throws the enemy up in the air if ( PerformAction ( &actionPopupAttack, (checkAction_t)&idAI::CheckAction_LeapAttack, &actionTimerSpecialAttack ) ) { return true; } // Charge attack is where the berserker will charge up his spike and slam it in to the ground if ( PerformAction ( &actionChargeAttack, (checkAction_t)&rvMonsterBerserker::CheckAction_ChargeAttack, &actionTimerSpecialAttack ) ) { return true; } if ( CheckPainActions ( ) ) { return true; } if ( PerformAction ( &actionEvadeLeft, (checkAction_t)&idAI::CheckAction_EvadeLeft, &actionTimerEvade ) || PerformAction ( &actionEvadeRight, (checkAction_t)&idAI::CheckAction_EvadeRight, &actionTimerEvade ) || PerformAction ( &actionJumpBack, (checkAction_t)&idAI::CheckAction_JumpBack, &actionTimerEvade ) || PerformAction ( &actionLeapAttack, (checkAction_t)&idAI::CheckAction_LeapAttack ) ) { return true; } else if ( PerformAction ( &actionMeleeAttack, (checkAction_t)&idAI::CheckAction_MeleeAttack ) ) { standingMeleeNoAttackTime = 0; return true; } else { if ( actionMeleeAttack.status != rvAIAction::STATUS_FAIL_TIMER && actionMeleeAttack.status != rvAIAction::STATUS_FAIL_EXTERNALTIMER && actionMeleeAttack.status != rvAIAction::STATUS_FAIL_CHANCE ) {//melee attack fail for any reason other than timer? if ( combat.tacticalCurrent == AITACTICAL_MELEE && !move.fl.moving ) {//special case: we're in tactical melee and we're close enough to think we've reached the enemy, but he's just out of melee range! //allow ranged attack if ( !standingMeleeNoAttackTime ) { standingMeleeNoAttackTime = gameLocal.GetTime(); } else if ( standingMeleeNoAttackTime + 2500 < gameLocal.GetTime() ) {//we've been standing still and not attacking for at least 2.5 seconds, fall back to ranged attack actionRangedAttack.fl.disabled = false; } } } if ( PerformAction ( &actionRangedAttack,(checkAction_t)&rvMonsterBerserker::CheckAction_RangedAttack, &actionTimerRangedAttack ) ) { return true; } } return false; }
/* ================ rvMonsterStroggHover::Spawn ================ */ bool rvMonsterStroggHover::CheckActions ( void ) { if ( PerformAction ( &actionCircleStrafe, (checkAction_t)&rvMonsterStroggHover::CheckAction_CircleStrafe ) ) { return true; } /* if ( PerformAction ( &actionRocketAttack, (checkAction_t)&idAI::CheckAction_RangedAttack, &actionTimerSpecialAttack ) ) { return true; } if ( PerformAction ( &actionBlasterAttack, (checkAction_t)&idAI::CheckAction_RangedAttack, &actionTimerRangedAttack ) ) { return true; } */ if ( PerformAction ( &actionBombAttack, (checkAction_t)&rvMonsterStroggHover::CheckAction_BombAttack ) ) { return true; } if ( PerformAction ( &actionMissileAttack, (checkAction_t)&idAI::CheckAction_RangedAttack, &actionTimerRangedAttack ) ) { return true; } if ( PerformAction ( &actionMGunAttack, (checkAction_t)&idAI::CheckAction_RangedAttack, &actionTimerRangedAttack ) ) { return true; } if ( idAI::CheckActions ( ) ) { return true; } if ( PerformAction ( &actionStrafe, (checkAction_t)&rvMonsterStroggHover::CheckAction_Strafe ) ) { return true; } return false; }
bool wxSpinButton::OnArrow(wxScrollArrows::Arrow arrow) { int valueOld = GetValue(); wxControlAction action; if ( arrow == wxScrollArrows::Arrow_First ) action = IsVertical() ? wxACTION_SPIN_INC : wxACTION_SPIN_DEC; else action = IsVertical() ? wxACTION_SPIN_DEC : wxACTION_SPIN_INC; PerformAction(action); // did we scroll to the end? return GetValue() != valueOld; }
void RPG_ActionHandler::EndAction(RPG_ActionType_e const& action /*= AT_None*/, RPG_ActionType_e const& nextAction /*= AT_None*/) { if (IsPerformingAction()) { // if the move we've been ordered to end matches the pending move, clear it if (action != AT_None && m_pendingAction.m_Action == action) { m_pendingAction.Clear(); } // if no action has been specified, or the specified action is the current action, end it if (action == AT_None || IsPerformingAction(action)) { PerformAction(AT_None, true); } } }
//------------------------------------------------------------------------------ UEdGraphNode* FBlueprintDragDropMenuItem::PerformAction(UEdGraph* ParentGraph, TArray<UEdGraphPin*>& FromPins, FVector2D const Location, bool bSelectNewNode/* = true*/) { UEdGraphPin* FromPin = nullptr; if (FromPins.Num() > 0) { FromPin = FromPins[0]; } UEdGraphNode* SpawnedNode = PerformAction(ParentGraph, FromPin, Location, bSelectNewNode); // try auto-wiring the rest of the pins (if there are any) for (int32 PinIndex = 1; PinIndex < FromPins.Num(); ++PinIndex) { SpawnedNode->AutowireNewNode(FromPins[PinIndex]); } return SpawnedNode; }
/* ================ rvMonsterStreamProtector::CheckPainActions ================ */ bool rvMonsterStreamProtector::CheckPainActions ( void ) { if ( !pain.takenThisFrame || !actionTimerPain.IsDone ( actionTime ) ) { return false; } if ( !pain.threshold || pain.takenThisFrame < pain.threshold ) { if ( painConsecutive < 10 ) { return false; } else { painConsecutive = 0; } } PerformAction ( "Torso_Pain", 2, true ); actionTimerPain.Reset ( actionTime ); return true; }
/* ================ rvMonsterStroggMarine::CheckActions ================ */ bool rvMonsterStroggMarine::CheckActions ( void ) { if ( idAI::CheckActions ( ) ) { return true; } if ( PerformAction ( &actionCrouchRangedAttack, (checkAction_t)&rvMonsterStroggMarine::CheckAction_CrouchRangedAttack, &actionTimerRangedAttack ) || PerformAction ( &actionRollAttack, (checkAction_t)&rvMonsterStroggMarine::CheckAction_RollAttack, &actionTimerRangedAttack ) || PerformAction ( &actionSprayAttack, (checkAction_t)&rvMonsterStroggMarine::CheckAction_SprayAttack, &actionTimerRangedAttack ) || PerformAction ( &actionStrafe, (checkAction_t)&rvMonsterStroggMarine::CheckAction_Strafe ) || PerformAction ( &actionAngry, (checkAction_t)&rvMonsterStroggMarine::CheckAction_Angry ) || PerformAction ( &actionReload, (checkAction_t)&rvMonsterStroggMarine::CheckAction_Reload ) ) { return true; } return false; }
/* * UserMouseMove: User wants to use mouse to move; check position of mouse * and move user accordingly. */ void UserMouseMove(void) { int x, y, xunit, yunit, i; int stretchfactor = config.large_area ? 2 : 1; if (!MouseToRoom(&x, &y) || view.cx == 0 || view.cy == 0) return; // Find action that corresponds to this part of the graphics area xunit = x * SCREEN_UNIT * stretchfactor / view.cx; yunit = y * SCREEN_UNIT * stretchfactor / view.cy; for (i=0; i < num_move_areas; i++) { if (xunit >= move_areas[i].left && xunit < move_areas[i].right && yunit >= move_areas[i].top && yunit < move_areas[i].bottom) { PerformAction(move_areas[i].action, NULL); break; } } }
/* ================ rvMonsterStreamProtector::CheckActions ================ */ bool rvMonsterStreamProtector::CheckActions ( void ) { // If not moving, try turning in place if ( !move.fl.moving && gameLocal.time > combat.investigateTime ) { float turnYaw = idMath::AngleNormalize180 ( move.ideal_yaw - move.current_yaw ) ; if ( turnYaw > lookMax[YAW] * 0.75f ) { PerformAction ( "Torso_TurnRight90", 4, true ); return true; } else if ( turnYaw < -lookMax[YAW] * 0.75f ) { PerformAction ( "Torso_TurnLeft90", 4, true ); return true; } } if ( PerformAction ( &actionPlasmaAttack, (checkAction_t)&idAI::CheckAction_RangedAttack, &actionTimerRangedAttack ) || PerformAction ( &actionRocketAttack, (checkAction_t)&idAI::CheckAction_RangedAttack, &actionTimerRangedAttack ) || PerformAction ( &actionLightningActtack, (checkAction_t)&idAI::CheckAction_RangedAttack, &actionTimerRangedAttack ) || PerformAction ( &actionHeavyBlasterAttack, (checkAction_t)&idAI::CheckAction_RangedAttack, &actionTimerRangedAttack ) || PerformAction ( &actionBlasterAttack, (checkAction_t)&idAI::CheckAction_RangedAttack, &actionTimerRangedAttack ) ) { return true; } return idAI::CheckActions ( ); }
/* * StatInputKey: User pressed a key on stat group button or list box. * Return True iff key should NOT be passed on to Windows for default processing. */ Bool StatInputKey(HWND hwnd, UINT key, Bool fDown, int cRepeat, UINT flags) { Bool held_down = (flags & 0x4000) ? True : False; /* Is key being held down? */ int action; void *action_data; UserDidSomething(); /* See if stat button handles this key */ action = TranslateKey(key, stats_key_table, &action_data); if (action == A_NOACTION) return False; switch(action) { case A_TABFWD: TextInputSetFocus(True); break; case A_TABBACK: SetFocus(cinfo->hMain); // ajw //InventorySetFocus(False); break; case A_NEXT: StatsMoveButtonFocus(hwnd, True); break; case A_PREV: StatsMoveButtonFocus(hwnd, False); break; default: if (!held_down) PerformAction(action, action_data); break; } return True; }
void Trigger::OnCollision(const Collision& collision) { if (!m_collisionRegistered) { switch (m_player.GetPass()) { case PlayerPassRegular: SetAction(TriggerActionUseBlock); break; case PlayerPassSuper: if (m_type == TriggerTypeSlow || m_type == TriggerTypeAngle || m_type == TriggerTypeStop) { SetAction(TriggerActionUseBlock); } break; case PlayerPassNone: break; } m_comboController.TryActivateCombo(this); if (!m_comboController.IsComboActivated()) { PerformAction(); } m_player.TriggerCollision(); m_sound.PlayOnce(); } m_collisionRegistered = true; }
/* * InventoryKey: User pressed a key on the inventory list. * Return True iff key should NOT be passed on to Windows for default processing. */ Bool InventoryKey(HWND hwnd, UINT key, Bool fDown, int cRepeat, UINT flags) { ID id; Bool held_down = (flags & 0x4000) ? True : False; /* Is key being held down? */ int action, params; InvItem *item; void *action_data; Bool inform; UserDidSomething(); /* See if inventory handles this key specially */ action = TranslateKey(key, inventory_key_table, &action_data); if (action == A_NOACTION) return False; // Skip held-down keys, except for moving cursor around if (held_down && !IsCursorAction(action)) return True; item = InventoryGetCurrentItem(); if (item == NULL) id = INVALID_ID; else id = item->obj->id; // See if we should inform modules about event inform = True; switch (action) { case A_TABFWD: case A_TABBACK: case A_TOGGLEUSE: case A_USE: case A_UNUSE: case A_DROP: case A_APPLY: case A_LOOKINVENTORY: case A_SELECT: action_data = (void *) id; break; default: inform = False; // Modules will be informed in PerformAction call below } // See if a module wants to handle this action if (inform) if (ModuleEvent(EVENT_USERACTION, action, action_data) == False) return True; if (IsCursorAction(action)) { InventoryCursorMove(action); return True; } switch (action) { case A_TABFWD: TextInputSetFocus(True); // ajw //StatsSetFocus(True); break; case A_TABBACK: SetFocus(cinfo->hMain); break; case A_TOGGLEUSE: if (id != INVALID_ID) { if (item->obj->flags & OF_APPLYABLE) StartApply(id); else ToggleUse(id); } break; case A_USE: if (id != INVALID_ID) RequestUse(id); break; case A_UNUSE: if (id != INVALID_ID) RequestUnuse(id); break; case A_DROP: if (id != INVALID_ID) InventoryDropCurrentItem(NULL); break; case A_APPLY: if (id != INVALID_ID) StartApply(id); break; case A_LOOKINVENTORY: if (id == INVALID_ID) break; params = DESC_DROP; if (item->is_using) params |= DESC_UNUSE; else if (item->obj->flags & OF_APPLYABLE) params |= DESC_APPLY; else params |= DESC_USE; SetDescParams(cinfo->hMain, params); RequestLook(id); break; case A_SELECT: if (id != INVALID_ID) SelectedObject(id); break; default: PerformAction(action, action_data); break; } return True; }