⚡ Set the light mode once per run of tiles

The render loop reissued the light state calls for every tile even
when the mode was unchanged.
This commit is contained in:
2026-11-15 22:08:32 +01:00
parent fbfd8e627f
commit 75220f3dc4
+12 -2
View File
@@ -2728,6 +2728,7 @@ var
intensity, red, green, blue: GLfloat; intensity, red, green, blue: GLfloat;
blockInfo: PBlockInfo; blockInfo: PBlockInfo;
item: TWorldItem; item: TWorldItem;
lightMode: Integer;
begin begin
if not (sbsValid in FScreenBufferState) then if not (sbsValid in FScreenBufferState) then
RebuildScreenBuffer; RebuildScreenBuffer;
@@ -2742,6 +2743,7 @@ begin
UpdateFilter; UpdateFilter;
blockInfo := nil; blockInfo := nil;
lightMode := -1;
while FScreenBuffer.Iterate(blockInfo) do while FScreenBuffer.Iterate(blockInfo) do
begin begin
if blockInfo^.State = ssFiltered then if blockInfo^.State = ssFiltered then
@@ -2752,11 +2754,19 @@ begin
if acSelect.Checked or item.CanBeEdited or (item is TVirtualTile) then if acSelect.Checked or item.CanBeEdited or (item is TVirtualTile) then
begin begin
intensity := 1.0; intensity := 1.0;
SetNormalLights; if lightMode <> 0 then
begin
SetNormalLights;
lightMode := 0;
end;
end else end else
begin begin
intensity := 0.5; intensity := 0.5;
SetDarkLights; if lightMode <> 1 then
begin
SetDarkLights;
lightMode := 1;
end;
end; end;
case blockInfo^.WalkRestriction of case blockInfo^.WalkRestriction of