Gleb Mazovetskiy
d94bc424df
`sgOptions` -> `GetOptions()`
...
In C++, globals initialization order accross translation units is not
defined. Accessing a global via a function ensures that it is initialized.
This will be needed for #7638 , which will statically initialize change
handlers after the Options object has been initialized.
1 year ago
Gleb Mazovetskiy
651c70f54b
A few more dependency cleanup
...
We still have some issues preventing even data_file_test from depending
on the world:
1. `options` transitively depends on everything because of the change
handlers.
2. `sound` depends on `monster` via `sgbSaveSoundOn` and
`monster` depends on `sound` via `gbSoundOn`.
1 year ago
Gleb Mazovetskiy
7d4332c78c
Split more things into libraries
...
This does not fully address the issue of most everything
being a giant library but it's a start.
Note that the libraries are OBJECT libraries, so they
may (and currently do) contain references to missing
symbols.
Also fixes the implementation of transitive dependency
support for OBJECT libraries.
1 year ago
Gleb Mazovetskiy
d7647d6c63
More dependency untangling
...
1. Moves more assets-related stuff from `init` to `engine/assets`.
2. Removes `SDL_audiolib` dependency from `soundsample.h`.
3. Cleans up some unused/missing includes.
1 year ago
Gleb Mazovetskiy
a7651f15d9
Extract `HeadlessMode` from `diablo.h`
...
Untangles some dependencies.
Many places that use `HeadlessMode` do not need all of `diablo.h`.
1 year ago
Gleb Mazovetskiy
b76feb2be3
Extract game mode out of init.cpp
...
Untangles some dependencies
1 year ago
Gleb Mazovetskiy
c31836eab8
Split up `engine.{h,cpp}`
...
Untangles dependencies by splitting up `engine.{h,cpp}` into 3 files:
1. `primitive_render`
2. `ticks` -- only contains `GetAnimationFrame` for now.
3. `GetWidth2` renamed to `CalculateSpriteTileCenterX` and moved to `levels/dun_tile.hpp`.
1 year ago
Gleb Mazovetskiy
a49b1f2d58
Extract Is{Any,None}Of out of engine.hpp
...
Untangles some of the dependencies
1 year ago
Gleb Mazovetskiy
dff288a58e
path_test: Improve failure messages
1 year ago
Gleb Mazovetskiy
940ce3fb64
Test paths fixes
...
1. Load assets from the bundle on Mac.
2. In timedemo_test, load MPQs before overriding pref path,
so that they can also be loaded from the user/system location.
3. Fix various double directory separators ("build//assets" etc).
1 year ago
Gleb Mazovetskiy
cf759c208a
timedemo_test: SDL1.2 compat
1 year ago
Gleb Mazovetskiy
6ee38cb37d
items_test.cpp: add missing <climits> include
1 year ago
Eric Robinson
cfac786daf
Make invalid items unusable ( #7506 )
1 year ago
Andrew James
1412e25eff
Allow for item drop rates up to 255 ( #7533 )
1 year ago
Gleb Mazovetskiy
f15fbcf61a
Async loading
...
Does the loading on a separate thread, so we're
now loading while fading in and while updating
the progress bar.
1 year ago
Gleb Mazovetskiy
e692acb049
Pathfinding: Rename functions
...
Rename functions to better reflect what they do.
1 year ago
Gleb Mazovetskiy
1892f6aa4e
ini: Write \r\n instead of \n
1 year ago
Gleb Mazovetskiy
b8ab6d2faa
Migrate from SimpleIni to our own implementation
...
Our implementation has a more modern interface and only
supports the features that we care about.
It always outputs `\n` as newlines and does not output BOM.
The modern interface eliminates awkward `c_str()/data()` conversions.
This implementation preserves comments and the file order of sections
and keys. New keys are written in insertion order.
We now also support modifying and adding default comments,
which may be a useful thing to do for the especially tricky
ini options (this PR doesn't add any but adds the ability to do so).
Sadly, this increases the RG99 binary size by 24 KiB.
I'm guessing this is because the map implementation generates
quite a bit of code.
Note that while it might seem that using `std::string` for every key and
value would do a lot of allocations, most of these strings are
small and thus benefit from Small String Optimization (= no allocations).
1 year ago
Eric Robinson
9f197f5ebc
Rename Missile::_mirange to Missile::duration ( #7214 )
2 years ago
Eric Robinson
e90855b3c4
Rename stores.cpp global variables ( #7425 )
2 years ago
Eric Robinson
6396af1ff5
Cleanup panel code (Part 2) ( #7421 )
2 years ago
Eric Robinson
d8e58b2547
Fix Elemental Arrows vs Objects ( #6507 )
2 years ago
Stephen C. Wills
cfe9a8ccdd
Introduce xoshiro RNG to generate dungeon seeds ( #7030 )
2 years ago
Gleb Mazovetskiy
88cddb0ccd
dun_render_benchmark: Do not crash on foliage
...
When sampling the tiles to benchmark on, simply skip potential foliage
tiles.
2 years ago
obligaron
138f937519
Fix infinite loop in unique item randomization
2 years ago
Gleb Mazovetskiy
49f63c5885
dun_render_benchmark: `BM_RenderBlackTile`
...
```bash
tools/build_and_run_benchmark.py dun_render_benchmark -- \
--benchmark_filter='.*BlackTile.*' \
--benchmark_repetitions=10 \
--benchmark_display_aggregates_only
```
```
------------------------------------------------------------------------------------
Benchmark Time CPU Iterations UserCounters...
------------------------------------------------------------------------------------
BM_RenderBlackTile_mean 157 ns 157 ns 10 items_per_second=6.37889M/s
BM_RenderBlackTile_median 157 ns 157 ns 10 items_per_second=6.38348M/s
BM_RenderBlackTile_stddev 0.490 ns 0.487 ns 10 items_per_second=19.8345k/s
BM_RenderBlackTile_cv 0.31 % 0.31 % 10 items_per_second=0.31%
```
I have a very surprising finding in a follow-up PR...
2 years ago
Gleb Mazovetskiy
3d716f74d3
Add dun_render_benchmark
...
Results from a single run (a bit noisy) on my machine:
```
tools/build_and_run_benchmark.py dun_render_benchmark
```
```
------------------------------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations UserCounters...
------------------------------------------------------------------------------------------------------------------------
DunRenderBenchmark/LeftTriangle_Solid_FullyLit 98297 ns 98282 ns 8840 items_per_second=15.1096M/s
DunRenderBenchmark/LeftTriangle_Solid_FullyDark 124727 ns 124701 ns 6973 items_per_second=11.9085M/s
DunRenderBenchmark/LeftTriangle_Solid_PartiallyLit 514869 ns 514747 ns 1700 items_per_second=2.88491M/s
DunRenderBenchmark/LeftTriangle_Transparent_FullyLit 520312 ns 520216 ns 1682 items_per_second=2.85458M/s
DunRenderBenchmark/LeftTriangle_Transparent_FullyDark 524440 ns 524331 ns 1664 items_per_second=2.83218M/s
DunRenderBenchmark/LeftTriangle_Transparent_PartiallyLit 532300 ns 532162 ns 1647 items_per_second=2.7905M/s
DunRenderBenchmark/RightTriangle_Solid_FullyLit 92387 ns 92363 ns 8840 items_per_second=16.7275M/s
DunRenderBenchmark/RightTriangle_Solid_FullyDark 85680 ns 85662 ns 9884 items_per_second=18.0361M/s
DunRenderBenchmark/RightTriangle_Solid_PartiallyLit 538347 ns 538250 ns 1626 items_per_second=2.87041M/s
DunRenderBenchmark/RightTriangle_Transparent_FullyLit 548800 ns 548760 ns 1598 items_per_second=2.81544M/s
DunRenderBenchmark/RightTriangle_Transparent_FullyDark 540450 ns 540369 ns 1620 items_per_second=2.85916M/s
DunRenderBenchmark/RightTriangle_Transparent_PartiallyLit 555061 ns 555003 ns 1575 items_per_second=2.78377M/s
DunRenderBenchmark/TransparentSquare_Solid_FullyLit 700849 ns 700751 ns 1320 items_per_second=3.68176M/s
DunRenderBenchmark/TransparentSquare_Solid_FullyDark 664927 ns 664872 ns 1389 items_per_second=3.88045M/s
DunRenderBenchmark/TransparentSquare_Solid_PartiallyLit 1131702 ns 1131559 ns 822 items_per_second=2.28004M/s
DunRenderBenchmark/TransparentSquare_Transparent_FullyLit 1022384 ns 1022267 ns 916 items_per_second=2.5238M/s
DunRenderBenchmark/TransparentSquare_Transparent_FullyDark 1023193 ns 1023057 ns 900 items_per_second=2.52185M/s
DunRenderBenchmark/TransparentSquare_Transparent_PartiallyLit 1033573 ns 1033496 ns 895 items_per_second=2.49638M/s
DunRenderBenchmark/Square_Solid_FullyLit 53532 ns 53524 ns 10000 items_per_second=30.8272M/s
DunRenderBenchmark/Square_Solid_FullyDark 41993 ns 41987 ns 19794 items_per_second=47.1573M/s
DunRenderBenchmark/Square_Solid_PartiallyLit 842772 ns 842615 ns 1108 items_per_second=1.56655M/s
DunRenderBenchmark/Square_Transparent_FullyLit 834105 ns 834026 ns 1119 items_per_second=1.58269M/s
DunRenderBenchmark/Square_Transparent_FullyDark 831912 ns 831823 ns 1122 items_per_second=1.58688M/s
DunRenderBenchmark/Square_Transparent_PartiallyLit 924638 ns 924536 ns 1010 items_per_second=1.42774M/s
DunRenderBenchmark/LeftTrapezoid_Solid_FullyLit 33728 ns 33725 ns 24962 items_per_second=18.8583M/s
DunRenderBenchmark/LeftTrapezoid_Solid_FullyDark 31088 ns 31085 ns 27444 items_per_second=20.4601M/s
DunRenderBenchmark/LeftTrapezoid_Solid_PartiallyLit 268792 ns 268768 ns 3254 items_per_second=1.97196M/s
DunRenderBenchmark/LeftTrapezoid_Transparent_FullyLit 277990 ns 277965 ns 3140 items_per_second=1.90672M/s
DunRenderBenchmark/LeftTrapezoid_Transparent_FullyDark 268952 ns 268912 ns 3250 items_per_second=1.9709M/s
DunRenderBenchmark/LeftTrapezoid_Transparent_PartiallyLit 288869 ns 288826 ns 3056 items_per_second=1.83501M/s
DunRenderBenchmark/RightTrapezoid_Solid_FullyLit 29581 ns 29576 ns 28347 items_per_second=21.0984M/s
DunRenderBenchmark/RightTrapezoid_Solid_FullyDark 25315 ns 25312 ns 32250 items_per_second=24.6523M/s
DunRenderBenchmark/RightTrapezoid_Solid_PartiallyLit 259977 ns 259960 ns 3312 items_per_second=2.0003M/s
DunRenderBenchmark/RightTrapezoid_Transparent_FullyLit 263079 ns 263056 ns 3322 items_per_second=1.97677M/s
DunRenderBenchmark/RightTrapezoid_Transparent_FullyDark 259849 ns 259824 ns 3364 items_per_second=2.00136M/s
DunRenderBenchmark/RightTrapezoid_Transparent_PartiallyLit 279623 ns 279594 ns 3127 items_per_second=1.85984M/s
```
2 years ago
Gleb Mazovetskiy
cfa6529357
animationinfo_test.cpp: Add missing include
...
for std::setprecision
2 years ago
qndel
24f108f193
fix many typos ( #7322 )
2 years ago
Gleb Mazovetskiy
112e113201
Optimize `DoCrawl`
...
Benchmark:
```
cmake -S. -Bbuild-reld -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TESTING=ON
cmake --build build-reld --target crawl_benchmark && build-reld/crawl_benchmark
```
Before:
```
------------------------------------------------------
Benchmark Time CPU Iterations
------------------------------------------------------
BM_Crawl/1 3.53 ns 3.53 ns 198384032
BM_Crawl/4 54.3 ns 54.2 ns 12907171
BM_Crawl/16 733 ns 732 ns 955101
BM_Crawl/20 1142 ns 1141 ns 613766
```
After:
```
------------------------------------------------------
Benchmark Time CPU Iterations
------------------------------------------------------
BM_Crawl/1 1.36 ns 1.36 ns 453018506
BM_Crawl/4 5.59 ns 5.59 ns 124244505
BM_Crawl/16 102 ns 101 ns 6577269
BM_Crawl/20 147 ns 147 ns 4684004
```
2 years ago
Gleb Mazovetskiy
c5788e5b08
Add a CLX rendering benchmark
...
```
----------------------------------------------------------------------------
Benchmark Time CPU Iterations UserCounters...
----------------------------------------------------------------------------
BM_RenderSmallClx 868 ns 866 ns 802315 bytes_per_second=2.04538Gi/s items_per_second=6.92446M/s
BM_RenderLargeClx 128208 ns 128032 ns 5434 bytes_per_second=716.703Mi/s items_per_second=7.81057k/s
```
2 years ago
Gleb Mazovetskiy
624afafe58
Extract Crawl to a library
...
Also adds a test and a benchmark
2 years ago
Gleb Mazovetskiy
e5c628db78
Add a test for Crawl order
2 years ago
Gleb Mazovetskiy
90732aa7be
Migrate objdat.cpp data to TSV
2 years ago
Gleb Mazovetskiy
e9c29fa806
Switch to ankerl::unordered_dense
2 years ago
Gleb Mazovetskiy
09e7cfea0e
Turn codec into a standalone library
2 years ago
Gleb Mazovetskiy
3b0cde6704
Turn utils/format_int into a standalone library
2 years ago
Gleb Mazovetskiy
495e583e64
Turn utils/file_util into a standalone library
2 years ago
Gleb Mazovetskiy
164dc9dc87
Turn util/parse_int into a standalone library
2 years ago
Gleb Mazovetskiy
3e22e8065b
Turn util/str_* into a standalone library
2 years ago
Gleb Mazovetskiy
713c04838c
Turn utils/utf8 into a standalone library
2 years ago
Gleb Mazovetskiy
e078b46fec
Remove static_bit_vector
2 years ago
Gleb Mazovetskiy
ee8ca1c005
Greatly simplify outline rendering
...
The new algorithm is a lot less code, slightly faster, and results
in a smaller binary (-40 KiB on rg99).
The previous algorithm filled all the pixels around every solid pixel.
The new algorithm only fills pixels that will be visible.
We first collect the outline pixels into an array (which may contain a
small amount of duplicates). Then, we render the entire array in a
single loop. This turns out to be slightly faster than rendering inline,
at the cost of ~4 KiB of stack (basically free).
To collect the pixels, we go through the CLX sprite, keeping track
of the solid runs in the current row, and the filled pixels on the line
above and the line below.
To be able to quickly test the pixels above and below, we introduce a
new data structure, `StaticBitVector`. It is similar to a bitset,
except the size is determined at runtime (capacity is fixed),
and it supports quick updates of entire subspans.
2 years ago
Anders Jenbo
d36347f162
Record new timedemo with updated south walk behaviour
2 years ago
KPhoenix
fc6f9edad3
Update pack_test.cpp
2 years ago
Andrew James
6b2a0c4b7a
Remove conditionals for OOB reads that aren't hit in normal gameplay
...
Reworded and added comments explaining what would've happened and calling out the case that is still technically possible.
2 years ago
staphen
9e682afe13
Rename glSeedTbl
2 years ago
staphen
bc4f43490f
Load objcurs when creating starting items
2 years ago
Gleb Mazovetskiy
dc59cdaee4
Extract objcurs widths into a file
...
Read from the widths file when using the original CEL.
When using CLX, use width in CLX.
2 years ago
obligaron
95205294e8
Fix MSVC x86 warnings
2 years ago