MCPcopy Create free account
hub / github.com/TurningWheel/Barony / entityClicked

Function entityClicked

src/collision.cpp:58–351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56-------------------------------------------------------------------------------*/
57
58Entity* 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 )

Callers 4

handleActionsMethod · 0.85
actPlayerFunction · 0.85
actHudWeaponFunction · 0.85
consolecommand.cppFile · 0.85

Calls 15

GO_GetPixelU32Function · 0.85
playSoundFunction · 0.85
sendPacketSafeFunction · 0.85
usingCommandMethod · 0.80
inputMethod · 0.80
getMouseMethod · 0.80
getUIInteractionMethod · 0.80
isEnabledMethod · 0.80
binaryHeldToggleMethod · 0.80
randMethod · 0.80
isLocalPlayerMethod · 0.80

Tested by

no test coverage detected