The headers don't actually work with C as they're now.
A better long-term solution should be able to use idiomatic C++ throughout
and expose things to other languages via a separate C API layer.
Fixes#1178
`CelOutputBuffer` now contains an `SDL_Surface` and an `SDL_Rect`.
We now have access to SDL surface manipulation functions.
`gpBuffer` and `gpBufEnd` are completely gone 🧹
This results in some FPS loss (250 -> 195) recovered in a subsequent
commit.
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.