Commit Graph

2417 Commits

Author SHA1 Message Date
nmlgc 757ee718c4 [Maintenance] Remove `extern "C"` from more areas of code
This commit covers
• TH02's ZUNINIT errors,
• TH02's main menu,
• the init/exit functions in all 4 remaining games,
• TH03/TH04/TH05's configuration file functions, and
• TH04/TH05's tile rendering functions.

Part of P0258, funded by [Anonymous] and Blue Bolt.
2023-10-31 22:33:16 +01:00
nmlgc a4fb2cf067 [Maintenance] [th04/th05] Remove unnecessary segment splits
Reclaiming a few letters.

Part of P0258, funded by [Anonymous] and Blue Bolt.
2023-10-31 22:33:13 +01:00
nmlgc f5da2a50a5 [Maintenance] [th02/th04/th05] Stage tiles: Move metrics to a separate header
The vertical shmup counterpart to 841d8be. Cleans up the subsystem
hierarchy by ensuring that at least all tile /formats/ code does not
depend on /main/ code.

Part of P0258, funded by [Anonymous] and Blue Bolt.
2023-10-31 22:33:10 +01:00
nmlgc 0c39c6b239 [Maintenance] [th02] Stage tiles: Don't publicly declare the tile ring array
Luckily, it's not directly mutated from outside in this game.

Part of P0258, funded by [Anonymous] and Blue Bolt.
2023-10-31 22:33:07 +01:00
nmlgc 2c3bd9c16f [Maintenance] `tram_cell_amount_t` can also be used for heights
Part of P0258, funded by [Anonymous] and Blue Bolt.
2023-10-31 22:33:02 +01:00
nmlgc 5876755977 [Maintenance] [th01] YuugenMagan: Turn the Phase 12 pentagram values into a bug
Part of P0245, funded by [Anonymous], Blue Bolt, Ember2528, and Yanga.
2023-07-01 05:22:23 +02:00
nmlgc 6515661dc8 [Decompilation] [th04/th05] Boss explosions
Part of P0245, funded by [Anonymous], Blue Bolt, Ember2528, and Yanga.
2023-07-01 05:22:23 +02:00
nmlgc 48bdae5f01 [Maintenance] [th04/th05] Boss explosions: Remove the structure from the header
Not needed for the public API, thankfully.

Part of P0245, funded by [Anonymous], Blue Bolt, Ember2528, and Yanga.
2023-07-01 05:22:23 +02:00
nmlgc 31b535d678 [Decompilation] [th05] EX-Alice: 16×16 sprite overrides
Part of P0245, funded by [Anonymous], Blue Bolt, Ember2528, and Yanga.
2023-07-01 05:22:23 +02:00
nmlgc 71cd70e0dc [Naming] [th05] Bombs: Shape sprite file names
Part of P0245, funded by [Anonymous], Blue Bolt, Ember2528, and Yanga.
2023-07-01 05:22:23 +02:00
nmlgc 030908ebde [Decompilation] [th04] Stage 4 midboss: Rendering
Getting back one letter for the dummy segments within the first group.

Part of P0245, funded by [Anonymous], Blue Bolt, Ember2528, and Yanga.
2023-07-01 05:22:23 +02:00
nmlgc 25ba371a34 [Decompilation] [th04/th05] Gather circles: Spawn functions
No point in prettifying this dumb copy macro if we're going to throw it
out on the future `debloated` branch anyway. Avoiding compiler warnings
by removing seemingly superfluous `if` statements is much more
important.

Part of P0245, funded by [Anonymous], Blue Bolt, Ember2528, and Yanga.
2023-07-01 05:22:23 +02:00
nmlgc 0ab7359c88 [Decompilation] [th02] Text overlay: Stage transitions
That #pragma proves this to have been a separate translation unit… but
it at least sort of fits into `hud.cpp`. Could have gone either way.

Part of P0245, funded by [Anonymous], Blue Bolt, Ember2528, and Yanga.
2023-07-01 05:22:22 +02:00
nmlgc a5596d9265 [Research] Discover the reason for incorrect clipping of large sprites
It's going to show up again for TH04's Stage 4 midboss, as well as the
big explosion sprite, and this turns out to be the reason why ZUN did
it consistently. master.lib being lazy is enough of a reason to upgrade
each of these instances to a fixable bug.

Part of P0245, funded by [Anonymous], Blue Bolt, Ember2528, and Yanga.
2023-07-01 05:22:22 +02:00
nmlgc 491f7b83d2 [Build] Compile shared translation units in 386 mode by default
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.
2023-06-30 19:59:11 +02:00
nmlgc 0ffa756cae [Contributing] Decide on `seg` and `off` for x86-segment-related identifiers
I could have equally argued the opposite way, and in favor of `sgm` and
`ofs`, but I've also been using `seg` and `off` more prevalently
throughout the years.

Part of P0245, funded by [Anonymous], Blue Bolt, Ember2528, and Yanga.
2023-06-30 19:59:11 +02:00
nmlgc 540174828b [Maintenance] [th05] Bullets: Explicitly use the blue and red ball patnums
PAT_BULLET16_N_BLUE and PAT_BULLET16_N_RED are just meant to be generic
color range indicators with no semantic meaning.

Part of P0245, funded by [Anonymous], Blue Bolt, Ember2528, and Yanga.
2023-06-30 19:59:11 +02:00
nmlgc 2f3e8c262e [Maintenance] [th02/th04/th05] Move stage bonus functions to a separate header
These functions are placed rather far away from other stage-related
code, which suggests a distinct translation unit.

Part of P0245, funded by [Anonymous], Blue Bolt, Ember2528, and Yanga.
2023-06-30 19:59:11 +02:00
nmlgc 8943b52167 [Maintenance] Introduce types for VRAM colors and their components
Finally differentiating between colors and columns at least at the type
level.

Part of P0245, funded by [Anonymous], Blue Bolt, Ember2528, and Yanga.
2023-06-30 19:59:11 +02:00
nmlgc 97f0c3b4f5 [Position independence] [th04] Congratulation picture file name
What a fitting memory reference to pick as the final one to be labeled
and made position-independent. That's 100% for TH04!

Completes P0244, funded by Blue Bolt and [Anonymous].
2023-06-13 04:26:26 +02:00
nmlgc 043cef3b38 [Position independence] [th04] Remaining false positives
Part of P0244, funded by [Anonymous] and Blue Bolt.
2023-06-13 04:26:26 +02:00
nmlgc 9125e9278c [Position independence] [th04] Stage 4 midboss: Sprite IDs
Part of P0244, funded by Blue Bolt and [Anonymous].
2023-06-13 04:26:26 +02:00
nmlgc 57cdb229aa [Reverse-engineering] [th04] Stage 6 Yuuka: Phase 2 fly angles
Part of P0244, funded by Blue Bolt and [Anonymous].
2023-06-13 04:26:26 +02:00
nmlgc 17b21f4ea9 [Reverse-engineering] [th04] Stage 3 midboss: Fly angles
Turns out that the convoluted control flow we've seen in TH05's boss
code was also present in TH04…

Part of P0244, funded by Blue Bolt and [Anonymous].
2023-06-13 04:26:26 +02:00
nmlgc 64495ca98a [Naming] [th04/th05] Verdict screen: Number rendering
One of which also has the convenient responsibility of adding or
subtracting a number from the skill metric…

Part of P0244, funded by Blue Bolt and [Anonymous].
2023-06-13 04:26:26 +02:00
nmlgc 8b338353f8 [Reverse-engineering] [th04/th05] Dialog: Cursor position
Part of P0244, funded by Blue Bolt and [Anonymous].
2023-06-13 04:26:26 +02:00
nmlgc 9a68b003ea [Reverse-engineering] [th04] Player shots: Laser state
Part of P0244, funded by Blue Bolt and [Anonymous].
2023-06-13 04:26:26 +02:00
nmlgc 2aae476a85 [Decompilation] [th04] Stage 4 corridor carpet lighting animation
Superficially fine, but unimaginably broken if you try to make sense
out of it.

Part of P0244, funded by Blue Bolt and [Anonymous].
2023-06-13 04:26:26 +02:00
nmlgc 68bc6f4db3 [Position independence] [th04] Player shots: Angle calculations
Part of P0244, funded by Blue Bolt and [Anonymous].
2023-06-12 03:18:32 +02:00
nmlgc 43c6c23814 [Position independence] [th04] Player shots: Structure accesses
Didn't have to do this for TH05 because we had the budget to decompile
most of them way back in P0037, but now we don't.

Part of P0244, funded by Blue Bolt and [Anonymous].
2023-06-12 03:14:37 +02:00
nmlgc 68f4d5a038 [Reverse-engineering] [th04/th05] Player shots: Decay animation duration
TH04's shot flags are defined in terms of that duration… which is where
we also find out it runs 4 frames faster in TH05.

Part of P0244, funded by Blue Bolt and [Anonymous].
2023-06-12 03:13:54 +02:00
nmlgc 5de2186e57 [Reverse-engineering] [th04] Staff roll: State
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].
2023-06-12 02:09:21 +02:00
nmlgc 1e6d308593 [Maintenance] [th03/th04/th05] Add X/Y polar coordinate abstractions
Matching the sane ones we use for TH01 and TH02. Them being macros will
actually help with two cases in TH03 and TH04 that inconsistently use
inlined polar calculations rather than calling polar()…

Part of P0244, funded by Blue Bolt and [Anonymous].
2023-06-12 02:09:21 +02:00
nmlgc 53ac043833 [Naming] Drop the inconsistent `2` from vector translation unit names
Part of P0244, funded by Blue Bolt and [Anonymous].
2023-06-12 02:09:17 +02:00
nmlgc 0efe76ab77 [Naming] Rename vector1_at() to polar()
"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].
2023-06-12 02:08:41 +02:00
nmlgc f6757d90ea [Maintenance] Simplify vector-related header inclusions
Part of P0244, funded by Blue Bolt and [Anonymous].
2023-06-10 18:34:16 +02:00
nmlgc 51b2df231a [Maintenance] Remove `extern "C"` from vector header inclusions
Part of P0244, funded by Blue Bolt and [Anonymous].
2023-06-10 18:32:25 +02:00
nmlgc ac33bd292d [Decompilation] [th02] Items: Initialization/reset function
And that's it, items complete!

Completes P0243, funded by Yanga.
2023-06-07 18:53:22 +02:00
nmlgc f5313d14cb [Decompilation] [th02] Items: Semi-random spawn function
Featuring a 1-in-512 chance for a bomb drop… among every 4th call to
this function.

Part of P0243, funded by Yanga.
2023-06-07 18:32:38 +02:00
nmlgc 2a059e2206 [Decompilation] [th02] Items: Spawn function
Hitting exactly 30% RE for TH02.

Part of P0243, funded by Yanga.
2023-06-07 18:32:38 +02:00
nmlgc 310ff3d7df [Decompilation] [th02] Items: Spawning the 5 items when losing a life
Part of P0243, funded by Yanga.
2023-06-07 17:00:35 +02:00
nmlgc 1099383256 [Decompilation] [th02] Items: Tile invalidation
Part of P0243, funded by Yanga.
2023-06-07 16:58:10 +02:00
nmlgc 943da08767 [Decompilation] [th02] Items: Collision detection and collection
Part of P0243, funded by Yanga.
2023-06-07 16:57:41 +02:00
nmlgc 8f7478b108 [Decompilation] [th02] Items: Update and render function
Part of P0243, funded by Yanga.
2023-06-07 16:49:05 +02:00
nmlgc 916992e5d1 [Reverse-engineering] [th02] Items: Shared state
Part of P0243, funded by Yanga.
2023-06-07 15:38:32 +02:00
nmlgc 6ff396f96a [Reverse-engineering] [th02] Items: Structure
Part of P0243, funded by Yanga.
2023-06-07 15:34:49 +02:00
nmlgc 720fd575b1 [Reverse-engineering] [th02] Player: Current position
Part of P0243, funded by Yanga.
2023-06-07 15:34:44 +02:00
nmlgc dfa758da89 [Decompilation] [th02] Gaiji loading and freeing
Completes P0242, funded by Yanga.
2023-06-07 15:34:37 +02:00
nmlgc fefeb1859d [Decompilation] [th02] HUD: Full rendering
Part of P0242, funded by Yanga.
2023-06-07 01:32:45 +02:00
nmlgc b38db78441 [Decompilation] [th02] HUD: Score rendering
Part of P0242, funded by Yanga.
2023-06-07 01:18:32 +02:00