Commit Graph

2548 Commits

Author SHA1 Message Date
nmlgc c88a259568 [Decompilation] [th02] Staff roll: Rectangle animation + picture blitting
Both sub-functions could have been inlined here, and then I wouldn't
have had to comment the former.

Part of P0279, funded by Yanga and Blue Bolt.
2024-04-12 00:29:10 +02:00
nmlgc 9ce80c0c1c [Decompilation] [th02] Staff roll: Clearing text from VRAM
Part of P0279, funded by Yanga and Blue Bolt.
2024-04-12 00:29:10 +02:00
nmlgc bfeb661f69 [Decompilation] [th02] Staff roll: ENDFT.BFT sprite blitting
Part of P0279, funded by Yanga and Blue Bolt.
2024-04-12 00:29:10 +02:00
nmlgc f0fbaf667c [Decompilation] [th02] Endings: Script code for Bad and Good endings
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.
2024-04-12 00:29:10 +02:00
nmlgc 16ddd0cc2d [Decompilation] [th02] Ending → Staff roll transition
And it has a bug 🎺

Part of P0278, funded by Yanga.
2024-04-12 00:29:10 +02:00
nmlgc f623a70929 [Decompilation] [th02] Endings: Clearing the text line
Part of P0278, funded by Yanga.
2024-04-12 00:29:10 +02:00
nmlgc ddaf8c9495 [Decompilation] [th02] Endings / Staff roll: Picture blitting
Part of P0278, funded by Yanga.
2024-04-12 00:29:10 +02:00
nmlgc 8a149db5c4 [Decompilation] [th02] Verdict: 3-digit number → gaiji string conversion
Part of P0278, funded by Yanga.
2024-04-12 00:29:10 +02:00
nmlgc 7ac1db34f0 [Decompilation] [th02] Verdict: Masked VRAM row copies from page 1→0
Part of P0278, funded by Yanga.
2024-04-12 00:29:10 +02:00
nmlgc 35f320ef80 [Decompilation] [th02] Endings / Staff roll: Text typing
Part of P0278, funded by Yanga.
2024-04-12 00:29:10 +02:00
nmlgc 31411d7743 [Decompilation] [th02] Verdict screen: Score rendering
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.
2024-04-12 00:29:10 +02:00
nmlgc 962564db49 [Decompilation] [th02] Endings: Text file loading
Part of P0278, funded by Yanga.
2024-04-12 00:29:10 +02:00
nmlgc c96952f47b [Research] Discover how pointer constness affects pointer parameter codegen
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.
2024-04-12 00:29:09 +02:00
nmlgc 5359bff77b [Naming] [th02] Add a `_reset` infix to `input_sense()`
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.
2024-04-12 00:29:09 +02:00
nmlgc 5659f6fa34 [Code review] [th02] Staff roll: Rectangle rotation
Part of P0278, funded by Yanga.
2024-04-12 00:29:09 +02:00
nmlgc e4ff9dae97 [Maintenance] Cutscenes: Centrally define picture coordinates
Part of P0278, funded by Yanga.
2024-04-12 00:29:09 +02:00
nmlgc 536ededecd [Maintenance] [th02] Declare rectangle rotation using current conventions
Including a move to the `th02/end/` directory, and a `staffroll_`
prefix because of those hardcoded positions.

Part of P0278, funded by Yanga.
2024-04-12 00:29:09 +02:00
nmlgc 459cdd6fe0 [Maintenance] [th02] Score: Consolidate rendering functions
Part of P0278, funded by Yanga.
2024-04-12 00:29:09 +02:00
nmlgc 57211ac4d9 [Naming] [th02] Text overlay: Emphasize unsignedness for 8-digit number display
The declaration already used `uint`.

Part of P0278, funded by Yanga.
2024-04-12 00:29:09 +02:00
nmlgc 61cd04c103 [Maintenance] [th02] Score: Define a single type for score values
No unsigned score values in this game. Yet…

Part of P0278, funded by Yanga.
2024-04-12 00:29:09 +02:00
nmlgc 2181fa22ba [Maintenance] [th02] graph_putsa_fx(): Explicitly declare as `extern "C"`
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.
2024-04-12 00:29:09 +02:00
nmlgc 4c8324bc82 [Maintenance] [th02] Remove an illegal Shift-JIS codepoint from `th02_main.asm`
Part of P0278, funded by Yanga.
2024-04-12 00:27:18 +02:00
nmlgc 6d702988af [Maintenance] Remove `extern "C"` from more areas of code
Covering every input function across all games.

Part of P0278, funded by Yanga.
2024-04-11 23:17:45 +02:00
nmlgc 311138a2d9 [Naming] .PI: Mention palette mutation and 640×400 in the load→put→free macro
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.
2024-04-11 23:16:21 +02:00
nmlgc b6a7285847 [Bug] Remove symbol-less `public` directives in the pre-commit hook
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!
2024-04-02 03:14:15 +02:00
nmlgc ff19bedc18 [Reverse-engineering] [th02] Five Magic Stones: Coordinates
Completes P0265, funded by [Anonymous] and iruleatgames.
2024-02-03 08:59:48 +01:00
nmlgc 7639c7eeb8 [Reverse-engineering] [th02] Bosses and midbosses: Position
Marisa is doing her own thing though… Figuring that out whenever we get
there.

Part of P0265, funded by [Anonymous] and iruleatgames.
2024-02-03 08:59:48 +01:00
nmlgc 0d527425af [Reverse-engineering] [th02] Boss and midbosses: Total amount of damage dealt
The opposite of an HP bar in this game.

Part of P0265, funded by [Anonymous] and iruleatgames.
2024-02-03 08:59:48 +01:00
nmlgc c9c3b621ec [Maintenance] Remove the SHARED_ segment and all related workarounds
Part of P0265, funded by [Anonymous] and iruleatgames.
2024-02-03 08:59:48 +01:00
nmlgc 66d83aa183 [Separating translation units] [th04/th05] graph_putsa_fx()
Almost three years after the big SHARED segment separation got
unfortunately stuck thanks to this function, it's finally done!

Part of P0265, funded by [Anonymous] and iruleatgames.
2024-02-03 08:59:48 +01:00
nmlgc 5a65324625 [Maintenance] [th04/th05] Split OP and MAINE data before graph_putsa_fx()
Part of P0265, funded by [Anonymous] and iruleatgames.
2024-02-03 08:59:48 +01:00
nmlgc fd0c95dcd1 [Decompilation] [th04/th05] MAINE.EXE: main()
So anticlimactic, again…
Also, note how renaming the `end_sequence_t` constants to better match
their usage also simplifies the explanatory comment for TH04's
not-quirk.

Part of P0265, funded by [Anonymous] and iruleatgames.
2024-02-03 08:59:48 +01:00
nmlgc 1de8585136 [Decompilation] [th04/th05] MAINE.EXE: Top-level ending function
Part of P0265, funded by [Anonymous] and iruleatgames.
2024-02-03 08:59:48 +01:00
nmlgc 1350a60e3f [Decompilation] [th04/th05] MAINE.EXE: Binary switching
Part of P0265, funded by [Anonymous] and iruleatgames.
2024-02-03 08:59:48 +01:00
nmlgc 09c324fbed [Maintenance] [th04/th05] MAINE.EXE: Duplicate resident pointer loading
With the implementation moved to the header, it makes sense to
duplicate the function in the unfortunate place where the filename is
supposed to be.

Part of P0265, funded by [Anonymous] and iruleatgames.
2024-02-03 08:59:48 +01:00
nmlgc c57992caa9 [Maintenance] [th03/th04/th05] Move resident pointer loading to its own header
Which also highlights that TH05 uses both a master.lib and raw DOS
implementation.

Part of P0265, funded by [Anonymous] and iruleatgames.
2024-02-03 08:59:48 +01:00
nmlgc 2480c76a56 [Naming] [th04/th05] MAINE.EXE: Top-level menu and scene functions
Also formalizing the `*_menu()` naming convention I've been following
for a while.

Part of P0265, funded by [Anonymous] and iruleatgames.
2024-02-03 08:59:48 +01:00
nmlgc 1bb0a92d2d [Research] [th02/th03/th04/th05] Music Room: Text color logic
Part of P0265, funded by [Anonymous] and iruleatgames.
2024-02-03 08:59:48 +01:00
nmlgc f30fa98be8 [Decompilation] [th03/th04/th05] Music Room: Move all remaining data to C land
Part of P0265, funded by [Anonymous] and iruleatgames.
2024-02-03 08:59:48 +01:00
nmlgc b7c8f13d19 [Decompilation] [th03/th04/th05] Music Room: Main function
Part of P0265, funded by [Anonymous] and iruleatgames.
2024-02-03 08:59:47 +01:00
nmlgc 78728f6780 [Decompilation] [th03/th04/th05] Music Room: Comment rendering
Last instance of VRAM-rendered font ROM glyphs in OP.EXE!

Completes P0264, funded by [Anonymous] and Blue Bolt.
2024-02-03 08:59:47 +01:00
nmlgc f1d6ce9a39 [Decompilation] [th03] Music Room: Comment background blitting and freeing
Part of P0264, funded by [Anonymous] and Blue Bolt.
2024-02-03 08:59:47 +01:00
nmlgc cbcb540c54 [Decompilation] [th03/th04/th05] Music Room: Comment loading
Part of P0264, funded by [Anonymous] and Blue Bolt.
2024-02-03 08:59:47 +01:00
nmlgc ee5c7c56d1 [Decompilation] [th03] Music Room: Comment background snapping
Also renaming to `cmt_bg`, because `back` means "back page", which this
is not related to at all.

Part of P0264, funded by [Anonymous] and Blue Bolt.
2024-02-03 08:59:47 +01:00
nmlgc 7ef318fcbc [Decompilation] [th03/th04/th05] Music Room: Page flipping
Part of P0264, funded by [Anonymous] and Blue Bolt.
2024-02-03 08:59:47 +01:00
nmlgc cb7fd94789 [Decompilation] [th03/th04/th05] Music Room: Falling polygon animation
Part of P0264, funded by [Anonymous] and Blue Bolt.
2024-02-03 08:59:47 +01:00
nmlgc 44598e0e9a [Decompilation] [th03/th04/th05] Music Room: B plane snapping and blitting
Might as well give a more descriptive name to the variable than
something involving the generic `screen` (which we've started using for
coordinates) and the inconsistent `back` (which always means "back page
of VRAM", which has nothing to do with this bitplane).
Also, turns out that this was in fact the only place that did a 32-wide
memcpy() of a full VRAM bitplane.

Part of P0264, funded by [Anonymous] and Blue Bolt.
2024-02-03 08:59:47 +01:00
nmlgc dce8ba3ea1 [Decompilation] [th03/th04/th05] Music Room: Rendering the full track list
Part of P0264, funded by [Anonymous] and Blue Bolt.
2024-02-03 08:59:47 +01:00
nmlgc a520b0c283 [Decompilation] [th03/th04/th05] Music Room: Rendering a single title
Part of P0264, funded by [Anonymous] and Blue Bolt.
2024-02-03 08:59:47 +01:00
nmlgc 5b4f24aa0c [Decompilation] [th03/th04/th05] Music Room: Move titles and files to C land
Featuring a return of the recently developed `$ -` tech, along with
some unfortunate PI breaks… But hey, at least it makes sense to start
out with this move!

Part of P0264, funded by [Anonymous] and Blue Bolt.
2024-02-03 08:59:47 +01:00