Skip to content

Commit

Permalink
Draw floor shadow underground
Browse files Browse the repository at this point in the history
  • Loading branch information
Oen44 authored and Luan Luciano committed Mar 11, 2024
1 parent d923c48 commit 4c888e9
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 1 deletion.
4 changes: 4 additions & 0 deletions modules/client_options/graphics.otui
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ OptionPanel
id: antialiasing
!text: tr('Antialiasing')

OptionCheckBox
id: floorShadow
!text: tr('Floor Shadow')

Label
margin-top: 12
id: optimizationLevelLabel
Expand Down
9 changes: 8 additions & 1 deletion modules/client_options/options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ local defaultOptions = {

profile = 1,

antialiasing = true
antialiasing = true,
floorShadow = true
}

local optionsWindow
Expand Down Expand Up @@ -350,6 +351,12 @@ function setOption(key, value, force)
generalPanel:getChildById('walkCtrlTurnDelayLabel'):setText(tr('Walk delay after ctrl turn: %s ms', value))
elseif key == "antialiasing" then
g_app.setSmooth(value)
elseif key == "floorShadow" then
if value then
g_game.enableFeature(GameDrawFloorShadow)
else
g_game.disableFeature(GameDrawFloorShadow)
end
end

-- change value for keybind updates
Expand Down
1 change: 1 addition & 0 deletions modules/gamelib/const.lua
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ GameDontMergeAnimatedText = 124
GameMissionId = 125
GameItemCustomAttributes = 126
GameAnimatedTextCustomFont = 127
GameDrawFloorShadow = 128

LastGameFeature = 130

Expand Down
1 change: 1 addition & 0 deletions src/client/const.h
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ namespace Otc
GameMissionId = 125,
GameItemCustomAttributes = 126,
GameAnimatedTextCustomFont = 127,
GameDrawFloorShadow = 128,

LastGameFeature = 130
};
Expand Down
5 changes: 5 additions & 0 deletions src/client/mapview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ void MapView::drawMapBackground(const Rect& rect, const TilePtr& crosshairTile)
if (fading == 0) break;
}

if (g_game.getFeature(Otc::GameDrawFloorShadow)) {
if (cameraPosition.z >= Otc::UNDERGROUND_FLOOR && cameraPosition.z == z) {
g_drawQueue->addFilledRect(srcRect, m_floorShadow);
}
}
size_t floorStart = g_drawQueue->size();
drawFloor(z, cameraPosition, crosshairTile);

Expand Down
2 changes: 2 additions & 0 deletions src/client/mapview.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ class MapView : public LuaObject
float m_minimumAmbientLight;
std::unique_ptr<LightView> m_lightView;
TexturePtr m_lightTexture;

Color m_floorShadow = Color(0.0f, 0.0f, 0.0f, 0.5f);
};

#endif

0 comments on commit 4c888e9

Please sign in to comment.