]> git.localhorst.tv Git - blank.git/blobdiff - src/ui/ui.cpp
use player's inventory slot directly in interface
[blank.git] / src / ui / ui.cpp
index 8768095559cdf6335cf24be4043984c6cd0a7632..263245cd79bfe61ccdeb57e710bc1f5951c67fd0 100644 (file)
@@ -433,6 +433,8 @@ void HUD::Render(Viewport &viewport) noexcept {
                if (block_visible) {
                        DirectionalLighting &world_prog = viewport.HUDProgram();
                        world_prog.SetLightDirection({ 1.0f, 3.0f, 5.0f });
+                       world_prog.SetLightColor({ 1.0f, 1.0f, 1.0f });
+                       world_prog.SetAmbientColor({ 0.1f, 0.1f, 0.1f });
                        // disable distance fog
                        world_prog.SetFogDensity(0.0f);
 
@@ -509,7 +511,6 @@ Interface::Interface(
 , client_ctrl(cc)
 , fwd(0)
 , rev(0)
-, slot(0)
 , num_slots(10)
 , locked(false) {
 
@@ -709,7 +710,7 @@ void Interface::UpdateMovement() {
 }
 
 void Interface::InvAbs(int s) {
-       slot = s % num_slots;
+       int slot = s % num_slots;
        while (slot < 0) {
                slot += num_slots;
        }
@@ -717,7 +718,7 @@ void Interface::InvAbs(int s) {
 }
 
 void Interface::InvRel(int delta) {
-       InvAbs(slot + delta);
+       InvAbs(player_ctrl.GetPlayer().GetInventorySlot() + delta);
 }