Commit Graph

2573 Commits

Author SHA1 Message Date
nmlgc 87eed57ade [Decompilation] [th03] Hit circles: Rendering
Completes P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
2024-04-23 05:52:53 +02:00
nmlgc 0c6e9e88d0 [Decompilation] [th03] Hit circles: Update function
Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
2024-04-23 05:52:53 +02:00
nmlgc 4005de4d58 [Decompilation] [th03] Hit circles: Spawning player circles
Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
2024-04-23 05:52:53 +02:00
nmlgc 179c5389a7 [Decompilation] [th03] Hit circles: Spawning enemy circles
Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
2024-04-23 05:52:50 +02:00
nmlgc 6f84eb612a [Reverse-engineering] [th03] Hit circles: Structure
Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
2024-04-23 05:52:27 +02:00
nmlgc 1cdf14ab83 [Reverse-engineering] [th03] Global shared hitbox
Featuring a semantically overloaded origin just for the hell of it, eh?

Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
2024-04-21 14:50:21 +02:00
nmlgc c8443b77fe [Reverse-engineering] [th03] Round-or-result frame counter
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.
2024-04-21 14:50:21 +02:00
nmlgc 09f5292c0a [Decompilation] [th03] Player: Position update and clamping
Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
2024-04-21 14:50:21 +02:00
nmlgc ead31bdfe0 [Decompilation] [th03] Player: Input → movement velocity
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.
2024-04-21 14:50:03 +02:00
nmlgc 30ddddb2d4 [Reverse-engineering] [th03] Player: Base speed of currently updated player
Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
2024-04-21 14:29:49 +02:00
nmlgc 93e5f3213d [Decompilation] [th03] Playfield: Playfield X → screen X coordinate conversion
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.
2024-04-21 14:29:49 +02:00
nmlgc 06ad372e16 [Decompilation] [th03] Playfield: Screen X → playfield X coordinate conversion
Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
2024-04-21 13:49:44 +02:00
nmlgc 59064548e4 [Decompilation] [th03] Playfield: Entity clipping
Why would you ever micro-optimize this 😩

Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
2024-04-21 13:49:44 +02:00
nmlgc cdc7e5929a [Decompilation] [th03] SPRITE16: Inline methods for playfield clipping
Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
2024-04-21 13:49:37 +02:00
nmlgc 51de5ec036 [Decompilation] [th03] SPRITE16: Inline method for sprite size assignments
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.
2024-04-21 13:41:58 +02:00
nmlgc 415bef1176 [Maintenance] [th03] SPRITE16: Move game-level code into `main/`
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.
2024-04-21 13:36:03 +02:00
nmlgc e93bd6d11c [Maintenance] [th03] Random number ring buffer: Declare the `_far` instance
Needs capital letters because of the `pascal` calling convention.

Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
2024-04-21 12:48:58 +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 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