Also renames lua/lua.hpp to lua/lua_global.hpp.
The previous name broke version auto-detection in sol2, which involves
calling `__has_include(<lua/lua.hpp>)`.
1. There is no need to store the light table width as it is always 256.
2. Use a fixed-extent `std::span` rather than a pointer for readability.
This should optimize to the exact same code.
1. Extracts duplicate expressions into functions.
2. Addds `const` throughout to make it more obvious what's being modified
in the loop.
3. Add early return on out of bounds.
4. Extract `minx +` out of the `std::min({...})`.
3+4 lead to a nice perf increase
Before:
```
---------------------------------------------------------------------------
Benchmark Time CPU Iterations UserCounters...
---------------------------------------------------------------------------
BM_BuildLightmap 77181 ns 77152 ns 9092 bytes_per_second=2.7194Gi/s items_per_second=3.24034M/s
```
After:
```
---------------------------------------------------------------------------
Benchmark Time CPU Iterations UserCounters...
---------------------------------------------------------------------------
BM_BuildLightmap 65134 ns 65114 ns 10773 bytes_per_second=3.22218Gi/s items_per_second=3.83943M/s
```
Gets rid of `orig_palette`, we now always have only 2 palettes:
1. `logical_palette`
This palette has color cycling / swapping applied but no global
effects such as brightness / fade-in.
2. `system_palette`
This palette is the actual palette used for rendering.
It is usually `logical_palette` with the global brightness setting
and fade-in/out applied.
Additionally, we now keep the k-d tree around and use it to
update single colors.
The colors that are color-cycled / swapped are never included
in the k-d tree, so the tree does not need updating on color
cycles/swaps.
PR #8027 exposed a bug in `palette_update`.
The `first` argument in SDL palette functions always refers to the first
target index (the first source index is always 0).
1. Fixes DrawStringwithColors kerning fit handling and newline handling.
2. Splits tests into one file per function call, making it easier to compare diffs and add new tests.
Also adds `--update_expected` argument to update the expected files with actual results.
When using KerningFitSpacing with centered or right-aligned text,
adjust the horizontal start position after changing the spacing.
Co-authored-by: Gleb Mazovetskiy <glex.spb@gmail.com>
The previous implementation didn't behave quite like A-* is supposed to.
After trying to figure out what's causing it and giving up,
I've reimplemented it in a straightforward manner.
Now it seems to work a lot better.
Also increases maximum player path length to 100 steps.
We still only store the first 25 steps in the save file for vanilla
compatibility.