Thanks to the required word alignment of the `switch` jump table in
TH05's dialog_op(), we do in fact have to slice dialog code into
exactly two* translation units. Three might have been better because we
would have only needed to compile this shared code once, but TH05 also
has one exclusive function in the area covered by this new shared
translation unit anyway. At least we can meaningfully share the actual
source files between games here.
* With an additional one at the end for now, because I absolutely had
to RE that EMS code in late 2021, but we'll catch up with that one in
the end.
Part of P0258, funded by [Anonymous] and Blue Bolt.
By now, it has become clear that this the norm rather than the
exception among these units. Thankfully!
Part of P0245, funded by [Anonymous], Blue Bolt, Ember2528, and Yanga.
And that's it…? All staff roll-related false positives removed, and we
didn't even have to decompile any of the staff roll blitting functions?
Part of P0244, funded by Blue Bolt and [Anonymous].
"1D polar vectors" are a weird concept to wrap your head around,
especially if their constructor function takes a sine or cosine ratio
instead of an angle. This function is way closer to the polar_*()
family, which has these convenient `_x` and _y` suffixes that we could
just remove for this generic function to fit into there.
Part of P0244, funded by Blue Bolt and [Anonymous].
Word alignment forces us to decompile these two barely related things
in a single commit. The former is at least much better and saner than
its TH02 counterpart.
Completes P0241, funded by [Anonymous] and Blue Bolt.
From the tile source area to the right of the HUD, obviously. So glad
that vram_offset_shift_fast() is possible without inline ASM, we're
definitely going to see that one more often.
Part of P0235, funded by Ember2528.
And dissolve the "vars" units, which would be too annoying to merge on
the `debloated` branch otherwise. This interpretation of these globals
further highlights the type differences between REIIDEN.EXE and
FUUIN.EXE.
Placing them in directly in `resident.hpp`; on the `debloated` branch,
we could neatly define each of these fields in a matching .cpp file,
but that file would need to be compiled twice due to the aforementioned
differences between binaries. Better to keep those in `op_01.cpp`,
`main_01.cpp`, or `fuuin_01.cpp`, respectively.
Part of P0229, funded by Ember2528.
Neatly dissolves two of the three game-specific preprocessor branches
in `th01/hardware/grppsafx.h`. Moving at least one function into a
corresponding .cpp file will also simplify the corresponding debloating
commit on the respective branch.
Part of P0229, funded by Ember2528.
As implied in adffa1c, a single segment-switching translation unit for
both rendering functions and game logic is the most straightforward
solution for those two games. Especially once you look at TH04, and
realize that the wildly chaotic order of the *_fg_render() functions in
the first code segment exactly matches the order of the *_update()
functions in the third.
Part of P0225, funded by Enderwolf, Blue Bolt, 32th System, and Yanga.
Oh look, a small TH02-only commit! Might as well decompile the small
function in front of TH02's overlay_wipe(), so that I can include it
in the next commit.
Part of P0225, funded by Enderwolf, Blue Bolt, 32th System, and Yanga.
With the script parsing and picture/box rendering functions being as
interleaved as they are, it makes little sense to keep the cutscene
code in more than one translation unit. How would those translation
units even be called? This time, having everything in one file should
beat the few hundred preprocessor-removed lines of code that we end up
adding to each one of the three affected games – and ultimately, you'd
want to merge those systems into one translation unit anyway.
Part of P0224, funded by Splashman and -Tom-.
Yeah, no, I'm not going to declare all of those as `extern` and then
"Move all data to C land" after decompiling the entire segment. Once
again (94372d2), it's not too bad – heck, in REIIDEN.EXE, it's less
than a screen worth of identifiers that are still being referenced.
Part of P0214, funded by Ember2528.
That was the one piece of technical debt in TH01 we've been carrying
around since March 2015! (0fd7f14)
Part of P0211, funded by Lmocinemod and Arandui.