Commit Graph

402 Commits

Author SHA1 Message Date
nmlgc c6812766b6 [Decompilation] [th02] Dialog: Displaying full boxes of text
Part of P0260, funded by Yanga.
2023-11-01 23:17:51 +01:00
nmlgc d38f2a675d [Decompilation] [th02] Dialog: Displaying individual lines
And we're finally polyfilling std::array to avoid writing these hack
structures over and over.
Unfortunately, we can't ever polyfill it *exactly* because Turbo C++
4.0J neither supports namespaces nor template classes nested inside
non-template classes to simulate namespaces. Might as well go for a
PascalCased class name in accordance with the existing coding style
then – no need to add an exception just to have a class name like
`std_array` or something.

Part of P0260, funded by Yanga.
2023-11-01 23:17:51 +01:00
nmlgc c4622992b5 [Decompilation] [th02] Dialog: Face rendering
Part of P0260, funded by Yanga.
2023-11-01 23:17:51 +01:00
nmlgc be31caeba8 [Decompilation] [th02] Dialog: Box slide-in animation
Part of P0260, funded by Yanga.
2023-11-01 23:17:51 +01:00
nmlgc c468e2a113 [Decompilation] [th02] Dialog: Box rendering
Part of P0260, funded by Yanga.
2023-11-01 23:17:51 +01:00
nmlgc f2b7f78012 [Decompilation] [th02] Dialog: Player character blitting
Starting strong with 4 bugs right out of the gate! 🎺

Part of P0260, funded by Yanga.
2023-11-01 23:17:51 +01:00
nmlgc dfaa3c67c4 [Decompilation] [th02] Dialog: EGC initialization
Second-to-last one!

Completes P0259, funded by Splashman and Yanga.
2023-11-01 23:17:51 +01:00
nmlgc 8f28286349 [Decompilation] [th02] Dialog: Text loading
Part of P0259, funded by Splashman and Yanga.
2023-11-01 23:17:51 +01:00
nmlgc 981c7e2a7d [Reverse-engineering] [th02] Scrolling: Completion flag
Part of P0259, funded by Splashman and Yanga.
2023-11-01 23:17:51 +01:00
nmlgc 1bb6068d6a [Reverse-engineering] [th02] Player: Current master.lib sprite ID
And here we find a bunch of unconditional PAT_PLAYCHAR_STILL render
calls… 🤔

Part of P0259, funded by Splashman and Yanga.
2023-11-01 23:17:51 +01:00
nmlgc 42abdc3de4 [Reverse-engineering] [th02] Player: Option position
Exactly 4 years and 1 month after 881f2c6, TH02 finally received the
dedicated attention for this feature. But Why are the options rendered
with PAT_OPTION_A all the time? 🤔

Part of P0259, funded by Splashman and Yanga.
2023-11-01 23:17:51 +01:00
nmlgc bc552cac8e [Reverse-engineering] [th02] Player: Position references
Featuring one redundant reference and one redundant copy…

Part of P0259, funded by Splashman and Yanga.
2023-11-01 23:17:51 +01:00
nmlgc 0e96a8e578 [Research] Document why TH02 and TH03 must manually pause BGM before loading
And the fact that TH04 and TH05 do it automatically. This allows us to
share the 'm' command implementation between the cutscene system and
the upcoming decompilation of TH04's dialog system… after developing
another new piece of decompilation tech 👀

Part of P0258, funded by [Anonymous] and Blue Bolt.
2023-10-31 22:33:41 +01:00
nmlgc 367431a69a [Naming] [th04/th05] EGC: Reuse the egc_start_copy_noframe() function name
If only `th04/main/tile/render_a.asm` were at the same place in both
games, then it would have made sense to decompile it right away.

Part of P0258, funded by [Anonymous] and Blue Bolt.
2023-10-31 22:33:36 +01:00
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 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 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 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 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 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 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 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 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
nmlgc ef7162195a [Decompilation] [th02] Score: Initialization, reset, and consistency functions
Part of P0242, funded by Yanga.
2023-06-07 00:40:27 +02:00
nmlgc 617815b745 [Decompilation] [th02] Score: Regular update and render function
Part of P0242, funded by Yanga.
2023-06-07 00:40:27 +02:00
nmlgc 6763b44dd0 [Decompilation] [th02] Score: Turning the current delta into a bonus
By leaving out just the one `score_delta = 0;` assignment, ZUN created
a function with semantics so complex that it already required naming
all other score-related functions just to make sense of it.

Part of P0242, funded by Yanga.
2023-06-07 00:40:27 +02:00
nmlgc 7e64c1cc06 [Decompilation] [th02] HUD: Life and bomb display
Part of P0242, funded by Yanga.
2023-06-06 21:38:27 +02:00
nmlgc 0d28c116c0 [Decompilation] [th02] HUD: Power bar rendering
Which also commits power changes to the shot level…

Part of P0242, funded by Yanga.
2023-06-06 21:37:07 +02:00
nmlgc 7bd0ac3f17 [Reverse-engineering] [th02] Score deltas
Part of P0242, funded by Yanga.
2023-06-06 21:20:57 +02:00
nmlgc dcec17fb42 [Reverse-engineering] [th02] Score extend globals
First feature commit, and it already raises the big questions.

Part of P0242, funded by Yanga.
2023-06-06 21:20:16 +02:00
nmlgc 000bac9190 [Maintenance] Random number ring buffer: Fix inconsistencies between & and %
Bracketing is hard!

Part of P0242, funded by Yanga.
2023-06-06 21:11:58 +02:00