mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 07:56:40 +00:00 
			
		
		
		
	Clean up controller logic to match item transfer logic
This commit is contained in:
		
							parent
							
								
									6a02e6a4bc
								
							
						
					
					
						commit
						a894481fd7
					
				
					 2 changed files with 10 additions and 2 deletions
				
			
		| 
						 | 
					@ -336,7 +336,8 @@ namespace MWGui
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Show a dialog to select a count of items, but not when using an item from the inventory
 | 
					        // Show a dialog to select a count of items, but not when using an item from the inventory
 | 
				
			||||||
        // in controller mode. In that case, we skip the dialog and just use one item immediately.
 | 
					        // in controller mode. In that case, we skip the dialog and just use one item immediately.
 | 
				
			||||||
        if (count > 1 && !shift && mPendingControllerAction != ControllerAction::Use)
 | 
					        if (count > 1 && !shift && mPendingControllerAction != ControllerAction::Use
 | 
				
			||||||
 | 
					            && mPendingControllerAction != ControllerAction::Unequip)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            CountDialog* dialog = MWBase::Environment::get().getWindowManager()->getCountDialog();
 | 
					            CountDialog* dialog = MWBase::Environment::get().getWindowManager()->getCountDialog();
 | 
				
			||||||
            std::string message = "#{sTake}";
 | 
					            std::string message = "#{sTake}";
 | 
				
			||||||
| 
						 | 
					@ -373,6 +374,12 @@ namespace MWGui
 | 
				
			||||||
                // stack of items; we only want to use the first item.
 | 
					                // stack of items; we only want to use the first item.
 | 
				
			||||||
                onBackgroundSelected();
 | 
					                onBackgroundSelected();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            else if (mPendingControllerAction == ControllerAction::Unequip)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                // Drop on inventory background to unequip
 | 
				
			||||||
 | 
					                dragItem(nullptr, count);
 | 
				
			||||||
 | 
					                onBackgroundSelected();
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
            else if (mPendingControllerAction == ControllerAction::Drop)
 | 
					            else if (mPendingControllerAction == ControllerAction::Drop)
 | 
				
			||||||
                dropItem(nullptr, count);
 | 
					                dropItem(nullptr, count);
 | 
				
			||||||
            else if (mTrading || mPendingControllerAction == ControllerAction::Sell)
 | 
					            else if (mTrading || mPendingControllerAction == ControllerAction::Sell)
 | 
				
			||||||
| 
						 | 
					@ -1059,8 +1066,8 @@ namespace MWGui
 | 
				
			||||||
            if (mGuiMode == MWGui::GM_Inventory)
 | 
					            if (mGuiMode == MWGui::GM_Inventory)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                // Unequip an item.
 | 
					                // Unequip an item.
 | 
				
			||||||
 | 
					                mPendingControllerAction = ControllerAction::Unequip;
 | 
				
			||||||
                mItemView->onControllerButton(SDL_CONTROLLER_BUTTON_A);
 | 
					                mItemView->onControllerButton(SDL_CONTROLLER_BUTTON_A);
 | 
				
			||||||
                onBackgroundSelected(); // Drop on inventory background to unequip
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else if (arg.button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER)
 | 
					        else if (arg.button == SDL_CONTROLLER_BUTTON_LEFTSHOULDER)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -138,6 +138,7 @@ namespace MWGui
 | 
				
			||||||
            Transfer,
 | 
					            Transfer,
 | 
				
			||||||
            Sell,
 | 
					            Sell,
 | 
				
			||||||
            Drop,
 | 
					            Drop,
 | 
				
			||||||
 | 
					            Unequip,
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
        ControllerAction mPendingControllerAction;
 | 
					        ControllerAction mPendingControllerAction;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue