mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Node highlighting.
This commit is contained in:
parent
206f076422
commit
58e6d25e03
10 changed files with 168 additions and 49 deletions
28
src/game.cpp
28
src/game.cpp
|
@ -407,14 +407,16 @@ PointedThing getPointedThing(Client *client, v3f player_position,
|
|||
mindistance = distance;
|
||||
|
||||
hilightboxes.clear();
|
||||
for(std::vector<aabb3f>::const_iterator
|
||||
i2 = boxes.begin();
|
||||
i2 != boxes.end(); i2++)
|
||||
{
|
||||
aabb3f box = *i2;
|
||||
box.MinEdge += npf + v3f(-d,-d,-d) - intToFloat(camera_offset, BS);
|
||||
box.MaxEdge += npf + v3f(d,d,d) - intToFloat(camera_offset, BS);
|
||||
hilightboxes.push_back(box);
|
||||
if (!g_settings->getBool("enable_node_highlighting")) {
|
||||
for(std::vector<aabb3f>::const_iterator
|
||||
i2 = boxes.begin();
|
||||
i2 != boxes.end(); i2++)
|
||||
{
|
||||
aabb3f box = *i2;
|
||||
box.MinEdge += npf + v3f(-d,-d,-d) - intToFloat(camera_offset, BS);
|
||||
box.MaxEdge += npf + v3f(d,d,d) - intToFloat(camera_offset, BS);
|
||||
hilightboxes.push_back(box);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2096,10 +2098,13 @@ void the_game(bool &kill, bool random_input, InputHandler *input,
|
|||
else if(input->wasKeyDown(getKeySetting("keymap_toggle_hud")))
|
||||
{
|
||||
show_hud = !show_hud;
|
||||
if(show_hud)
|
||||
if(show_hud) {
|
||||
statustext = L"HUD shown";
|
||||
else
|
||||
client.setHighlighted(client.getHighlighted(), true);
|
||||
} else {
|
||||
statustext = L"HUD hidden";
|
||||
client.setHighlighted(client.getHighlighted(), false);
|
||||
}
|
||||
statustext_time = 0;
|
||||
}
|
||||
else if(input->wasKeyDown(getKeySetting("keymap_toggle_chat")))
|
||||
|
@ -2796,7 +2801,8 @@ void the_game(bool &kill, bool random_input, InputHandler *input,
|
|||
if(pointed != pointed_old)
|
||||
{
|
||||
infostream<<"Pointing at "<<pointed.dump()<<std::endl;
|
||||
//dstream<<"Pointing at "<<pointed.dump()<<std::endl;
|
||||
if (g_settings->getBool("enable_node_highlighting"))
|
||||
client.setHighlighted(pointed.node_undersurface, show_hud);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue