Commit Graph

464 Commits

Author SHA1 Message Date
nmlgc 02b6129c51 [Build] [th02] Merge the 2nd and 3rd translation units of ZUN_RES.COM
The string literal placement issue mentioned in 942373e doesn't seem to
be an actual problem (anymore). This is also much simpler, as we get to
save tons of `extern` declarations at the cost of one additional
`#pragma option`.

Part of P0002, funded by GhostPhanom.
2024-06-24 00:21:28 +02:00
nmlgc 20bac82005 [Decompilation] [th02] Stage bonus calculation and rendering
For both regular and extra stages.

Completes P0279, funded by Yanga and Blue Bolt.
2024-04-12 00:31:24 +02:00
nmlgc 0935e84a83 [Decompilation] [th02] Stage bonus: Table row rendering
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.
2024-04-12 00:31:24 +02:00
nmlgc 40010a655b [Decompilation] [th02] Score: Skill value calculation
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.
2024-04-12 00:31:03 +02:00
nmlgc 4a7d4db25a [Reverse-engineering] [th02] Evil Eye Σ: Fight duration
Part of P0279, funded by Yanga and Blue Bolt.
2024-04-12 00:29:10 +02:00
nmlgc 0f66796fd4 [Reverse-engineering] [th02] Player performance ("rank")
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.
2024-04-12 00:29:10 +02:00
nmlgc 9bb2a3cd45 [Reverse-engineering] [th02] Total and stage-specific miss and bomb counters
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.
2024-04-12 00:29:10 +02:00
nmlgc 610df17856 [Maintenance] [th02] Start a new header for player performance metrics
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.
2024-04-12 00:29:10 +02:00
nmlgc 50afb0afa6 [Decompilation] [th02] Staff roll and verdict sequences
Part of P0279, funded by Yanga and Blue Bolt.
2024-04-12 00:29:10 +02:00
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 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 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 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 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 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
nmlgc 062aa7ae1d [Maintenance] Purge the C-style `typedef struct` syntax
I might change this convention again in the future, particularly once
someone wants to fund C89 conformance, but let's stay consistent for
now.

Part of P0264, funded by [Anonymous] and Blue Bolt.
2024-02-02 23:59:34 +01:00
nmlgc 26926080bc [Maintenance] Remove `extern "C"` from more areas of code
This commit covers
• TH02/TH03/TH04/TH05's frame_delay() and frame_delay_2() (finally!)
• TH02/TH03/TH04/TH05's game_init_main()
• TH02's graph_copy_rect_1_to_0_16()
• TH03/TH04/TH05's cfg_load_resident_ptr()
• TH05's piano_setup_and_put_initial() and piano_render()

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