Refactor the rendering functions to allow rendering to any output
buffer.
New functions that accept a buffer have the `To` suffix.
The functions that render to the global buffer now always accept
coordinates.
- Add file documentation to about 1/4 of the files in Source
- Copy over a lot of the documentation from the sanctuary/notes repo
- Standardise all the existing documentation
- Create a configuration for Doxygen
- Add more documentation (engine.cpp is now fully documented)
On some architectures it's illegal to do unaligned memory fetches. Just
don't load 4 bytes at once, instead load byte-by-byte. A smart compiler
is supposed to recognize the pattern as little-endian unaligned load.
This helps make the header files in `Source/*.h` parsable from both
C and C++.
Any headers in SourceX can easily be C++ only, but keeping
the core Devilution code parsable as both C and C++ is
useful for integration into mods.
runtime error: load of misaligned address 0x632000363773 for type 'WORD', which requires 2 byte alignment
0x632000363773: note: pointer points here
7f 7f 7f 3e 0a 00 02 01 50 04 00 00 00 00 7f 7f 7f 7f 7f 7f 7f 7f 7f 34 bc ac ff bc 5b f9 fc dc
It was actually out-of-bounds as well so I had to add a bounds check.
Rationale described in a479cc56b8
as included below:
Note, neither rand_increment nor rand_multiplier are
present in the PSX debug info. To keep the names for
these variables consistent with the naming convention
used for sglGameSeed, SeedCount, SetRndSeed and
GetRndSeed (which are part of the PSX debug info), we
rename them to RndInc and RndMult, respectively.