Would be ZUN bloat if it didn't actually have an effect, since way too
many things read from it 😩
Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
I am once again impressed at Turbo C++ 4.0J's optimizer for still
perfectly inlining two levels of nested conditional branches if they
only depend on compile-time constants.
Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
Together with `extern "C"` removal and another pass over constants that
the `x` parameter is calculated from.
Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
All but one of the writes to these globals follow the consistent scheme
of assigning hardcoded literals to first `w` and then `h`, so it makes
sense to encapsulate the conversion from display-space pixels to VRAM
words and heights in a method.
(On that note, we also need a new type to encode the notion of
VRAM-space heights as opposed to the display-space heights of
`pixel_t`.)
Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
We'd like t have a method to set the clipping coordinates from a player
ID, but such a method requires a dependency on `playfld.hpp` in `main`.
`SPF_DOWNWARDS_COLUMN` is kind of game-specific to begin with, too.
Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
Very unfortunate that this has to go into the overlay translation unit
due to the upcoming functions near-calling the `far overlay_wipe()`
function.
Part of P0279, funded by Yanga and Blue Bolt.
This will end up at the end of Mima's translation unit. Might as well
start a separate temporary one then, which will simplify the diff once
we eventually merge it into that future Mima TU which is very likely to
grow from top to bottom.
Part of P0279, funded by Yanga and Blue Bolt.
Many thanks to KirbyComment and Colin Douglas Howell for documenting
their research into rank on Touhou Wiki. Just like in TH01, rank also
only affects bullet speed in this game, but let's use the `playperf`
naming scheme from TH04 and TH05 to make it less confusing – at least
until we exactly know the unit of this variable.
Part of P0279, funded by Yanga and Blue Bolt.
The stage bonus functions require the stage-specific ones, which are
updated next to the total ones, which are required by the skill
calculation that we need to explain what we just saw in the verdict
screen… What a coincidence! (Yes, this actually wasn't planned.)
Part of P0279, funded by Yanga and Blue Bolt.
All of these are scalar values with at most a dependency on
`platform.h`. Since these item-related values are mainly read by
score/skill calculation code, it makes sense to declare them in a
dedicated header along with the upcoming metrics.
Part of P0279, funded by Yanga and Blue Bolt.
On the list of functions yet to be decompiled, these were at number 7
and 1, respectively, which corresponds to number 7 and 22 on the total
list of functions in PC-98 Touhou.
Completes P0278, funded by Yanga.
For once, I'm glad that ZUN copy-pasted this one-off function.
Otherwise, it probably wouldn't have been that easy to factor out.
Part of P0278, funded by Yanga.
In most cases, this discovery will mean that we have to bite the bullet
and remove `const` from pointer parameters if the generated ASM
wouldn't match otherwise. That by itself doesn't really simplify the
code, but at least we get to remove a single bloated `reinterpret_cast`
from one function call already.
Part of P0278, funded by Yanga.
Matching TH04 and TH05 functions, which differentiate between raw
sensing and resetting+sensing. In that light, the previous name for
TH02's function was rather misleading for leaving out that crucial
detail…
Part of P0278, funded by Yanga.
Needed for a constness overloading hack later. A certain single place
in TH02 will need the `str` parameter to not be `const` for code
generation reasons, but we don't want to force every call site into
passing non-`const` pointers for such a silly reason.
Part of P0278, funded by Yanga.
Also dropping the `_8` as it's irrelevant to a fullscreen image.
And yes, we'll see a version without palette mutation.
Part of P0278, funded by Yanga.
Another issue related to `public` that causes TASM32 version 5.0 to
crash. Better staying on that version from now on…
Thanks to spaztron64 for reporting this one!