| 56 | -------------------------------------------------------------------------------*/ |
| 57 | |
| 58 | Entity* entityClicked(bool* clickedOnGUI, bool clickCheckOverride, int player, EntityClickType clicktype) |
| 59 | { |
| 60 | Uint32 uidnum; |
| 61 | GLubyte pixel[4]; |
| 62 | |
| 63 | Input& input = Input::inputs[player]; |
| 64 | |
| 65 | Entity* playerEntity = Player::getPlayerInteractEntity(player); |
| 66 | |
| 67 | if ( gamePaused || movie || !players[player] || !playerEntity |
| 68 | || playerEntity->ticks < (TICKS_PER_SECOND / 2) |
| 69 | || fadeout |
| 70 | || (players[player]->usingCommand() && input.input("Use").type == Input::binding_t::KEYBOARD) ) |
| 71 | { |
| 72 | input.consumeBinaryToggle("Use"); |
| 73 | return nullptr; |
| 74 | } |
| 75 | if ( clicktype == ENTITY_CLICK_HELD_USE_TOOLTIPS_ONLY ) |
| 76 | { |
| 77 | if ( !clickCheckOverride && !input.binaryToggle("Use") ) |
| 78 | { |
| 79 | return NULL; |
| 80 | } |
| 81 | } |
| 82 | else |
| 83 | { |
| 84 | if ( !clickCheckOverride && !input.binaryToggle("Use") ) |
| 85 | { |
| 86 | return NULL; |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | Sint32 mx = inputs.getMouse(player, Inputs::OX); |
| 91 | Sint32 my = inputs.getMouse(player, Inputs::OY); |
| 92 | auto& inventoryUI = players[player]->inventoryUI; |
| 93 | |
| 94 | auto& camera = cameras[player]; |
| 95 | |
| 96 | if ( !players[player]->shootmode ) |
| 97 | { |
| 98 | if ( !framesProcResult.usable && *framesEatMouse ) |
| 99 | { |
| 100 | if ( clickedOnGUI ) |
| 101 | { |
| 102 | *clickedOnGUI = true; |
| 103 | } |
| 104 | return NULL; |
| 105 | } |
| 106 | |
| 107 | if ( inputs.getUIInteraction(player)->itemMenuOpen ) |
| 108 | { |
| 109 | if ( clickedOnGUI ) |
| 110 | { |
| 111 | *clickedOnGUI = true; |
| 112 | } |
| 113 | return NULL; |
| 114 | } |
| 115 | if ( mx < camera.winx || mx >= camera.winx + camera.winw || my < camera.winy || my >= camera.winy + camera.winh ) |
no test coverage detected