Commit Graph

2104 Commits

Author SHA1 Message Date
nmlgc 998721e6c1 [Decompilation] [th01] Stage bonus: 4-digit value → fullwidth string conversion
Seriously? Not even covering the whole range of an integer?

Part of P0212, funded by GhostRiderCog, Lmocinemod, and LeyDud.
2022-08-11 23:18:29 +02:00
nmlgc d6e7dbe387 [Decompilation] [th01] Stage bonus: Digit → fullwidth numeral conversion
Part of P0212, funded by GhostRiderCog, Lmocinemod, and LeyDud.
2022-08-11 23:18:29 +02:00
nmlgc 06379be894 [Decompilation] [th01] Stage bonus: Background box opening animation
40 functions left in TH01!

Part of P0212, funded by GhostRiderCog, Lmocinemod, and LeyDud.
2022-08-11 23:18:29 +02:00
nmlgc 4dc26ecc8f [Decompilation] [th01] TOTLE screen: Transition animation
Combining the previous effect with gradual activation of all lines and
ZUN's first correct interpolation between two palettes.

Part of P0212, funded by GhostRiderCog, Lmocinemod, and LeyDud.
2022-08-11 23:18:29 +02:00
nmlgc bd8e9ffa2e [Decompilation] [th01] Alternating left/right-shift VRAM row page transition
Is that a correct word order? The main effect behind the transition to
the TOTLE screen, and all its fanciness comes from alternating shift
directions on every row. No wave code anywhere.

Part of P0212, funded by GhostRiderCog, Lmocinemod, and LeyDud.
2022-08-11 23:18:29 +02:00
nmlgc 613f340b33 [Decompilation] [th01] TOTLE screen: Metric digit animation
First function, already found a ZUN quirk.

Part of P0212, funded by GhostRiderCog, Lmocinemod, and LeyDud.
2022-08-11 23:18:29 +02:00
nmlgc b93f216982 [Maintenance] Correctly declare unsigned VRAM byte amount types -.-
Part of P0212, funded by GhostRiderCog, Lmocinemod, and LeyDud.
2022-08-11 18:34:34 +02:00
nmlgc 79e9ab77dc [Maintenance] Simplify EGC macros and hardcode the chip's register size
No reason to continue pretending it supports anything else.

Part of P0212, funded by GhostRiderCog, Lmocinemod, and LeyDud.
2022-08-11 18:03:44 +02:00
nmlgc 60a7e44b53 [Maintenance] Introduce proper Shift-JIS and JIS X 0208 types
Much more semantic than that twobyte_t abomination.

Part of P0212, funded by GhostRiderCog, Lmocinemod, and LeyDud.
2022-08-11 15:53:13 +02:00
nmlgc e4124ca004 [Maintenance] [th01] Move REYHI*.DAT declarations to the formats/ subdirectory
Part of P0212, funded by GhostRiderCog, Lmocinemod, and LeyDud.
2022-08-11 15:52:41 +02:00
nmlgc 3e3aded807 [Maintenance] [th01] Pellets: Avoid the header's dependency on sprite sizes
Leads to mildly uglier code in exchange for not having to burden a
handful of translation units with a needless header.

Part of P0212, funded by GhostRiderCog, Lmocinemod, and LeyDud.
2022-08-11 15:52:07 +02:00
nmlgc 96510b3cba [Maintenance] [th01] Don't #include grppsafx.h inside graph.h
That file is about to gain a dependency on a Shift-JIS type header.

Part of P0212, funded by GhostRiderCog, Lmocinemod, and LeyDud.
2022-08-11 15:50:46 +02:00
nmlgc e97a869e90 [Maintenance] [th01] Compile all remaining C code as C++
And all that it needed was a few ellipses.

Part of P0212, funded by GhostRiderCog, Lmocinemod, and LeyDud.
2022-08-11 15:50:19 +02:00
nmlgc d398a949fc [Decompilation] High score menu: Move all data to C land
Completes P0211, funded by Lmocinemod and Arandui.
2022-08-08 20:16:29 +02:00
nmlgc 6e36dfd93b [Decompilation] [th01] Verdict screen: Move all data to C land
Part of P0211, funded by Lmocinemod and Arandui.
2022-08-08 20:16:25 +02:00
nmlgc 64fe9bbff9 [Decompilation] [th01] Endings: Common beginning
Part of P0211, funded by Lmocinemod and Arandui.
2022-08-08 20:16:21 +02:00
nmlgc 54653a33c3 [Decompilation] [th01] Boss entities and animations: Move all data to C land
Part of P0211, funded by Lmocinemod and Arandui.
2022-08-08 20:16:16 +02:00
nmlgc 00f3cacc5e [Translation unit catch-up] [th01] Archive functions
That was the one piece of technical debt in TH01 we've been carrying
around since March 2015! (0fd7f14)

Part of P0211, funded by Lmocinemod and Arandui.
2022-08-08 20:16:11 +02:00
nmlgc 5fa0cd5a86 [Decompilation] [th01] .GRC / 8×8 shapes: Move all data to C land
Part of P0211, funded by Lmocinemod and Arandui.
2022-08-08 20:16:05 +02:00
nmlgc 624799bff2 [Decompilation] [th01] Items: Move all data to C land
Part of P0211, funded by Lmocinemod and Arandui.
2022-08-08 20:16:01 +02:00
nmlgc 459f3db4bd [Decompilation] [th01] HUD: Move all data to C land
Part of P0211, funded by Lmocinemod and Arandui.
2022-08-08 20:15:57 +02:00
nmlgc a2200fef28 [Decompilation] [th01] Stage timer: Move all data to C land
Part of P0211, funded by Lmocinemod and Arandui.
2022-08-08 20:15:53 +02:00
nmlgc d29b128915 [Decompilation] [th01] Player / REIIDEN.EXE .PTN: Move most data to C land
Part of P0211, funded by Lmocinemod and Arandui.
2022-08-08 20:15:45 +02:00
nmlgc 515b4c6315 [Decompilation] [th01] YuugenMagan: Move all data to C land
And that's it! All TH01 bosses fully decompiled, which makes 8 PC-98
Touhou bosses in total with 23 to go! And now, time to move a whole lot
of other data…

Completes P0210, funded by Arandui and Yanga.
2022-08-08 20:15:10 +02:00
nmlgc 149fbca7bd [Decompilation] [th01] YuugenMagan: Eye open/close + 邪 recoloring function
Where ZUN manages to sneak in an integer overflow that, whether
intended or not, ends up defining the on-screen 邪 color in every phase
starting from the 6th one. What a great final piece of TH01 boss code…

Completes of P0210, funded by Arandui and Yanga.
2022-08-08 20:15:04 +02:00
nmlgc 5030867f75 [Decompilation] [th01] YuugenMagan: Main function
Whew, here we go, the beast. 1 function in ZUN's binary that really
should have been at least 49 functions.

Completes of P0209, funded by Yanga.
2022-08-08 20:14:55 +02:00
nmlgc 239a3ecd86 [Naming] [th01] YuugenMagan: Eye open/close + 邪 recoloring function
But of course, we still have to name this one, because ZUN just had to
put its definition after the main function. Speaking of which though,
now it's time for the big one…

Completes P0208, funded by GhostPhanom and Yanga.
2022-08-08 20:14:08 +02:00
nmlgc 3770b0c403 [Decompilation] [th01] YuugenMagan: Regular pentagram unblit/render function
Second to last helper function in this fight. 50 functions remaining in
all of TH01!

Part of P0208, funded by GhostPhanom and Yanga.
2022-08-08 20:13:29 +02:00
nmlgc f186169e59 [Decompilation] [th01] YuugenMagan: Spawning missiles from the southern eyes
Part of P0208, funded by GhostPhanom and Yanga.
2022-08-08 20:13:23 +02:00
nmlgc 8ee20b1938 [Decompilation] [th01] YuugenMagan: Phase 1 pellet pattern
The one where the lateral eyes fire aimed 2-spread pellets with
increasing speeds at various intervals, ending with a single aimed
pellet.

Part of P0208, funded by GhostPhanom and Yanga.
2022-08-08 20:13:17 +02:00
nmlgc 68562bb006 [Decompilation] [th01] YuugenMagan: Downwards 1-pixel lasers during phase 0
Fun fact: The laser from the rightmost eye has a hitbox that's 24
pixels larger than the other ones…
But yeah, nothing that resembles the pattern functions from the other
fights in this one, and even the functions that sort of do leave their
cleanup to the big main function. No sense in numbering them this time.

Part of P0208, funded by GhostPhanom and Yanga.
2022-08-08 20:13:10 +02:00
nmlgc b3921f34a6 [Decompilation] [th01] YuugenMagan: Sprite freeing
Part of P0208, funded by GhostPhanom and Yanga.
2022-08-08 20:13:04 +02:00
nmlgc 37968b9c4b [Decompilation] [th01] YuugenMagan: Unused formula
(((a - b) × √3) / 2)? Mysterious.

Part of P0208, funded by GhostPhanom and Yanga.
2022-08-08 20:12:59 +02:00
nmlgc 6f05a1bbf8 [Reverse-engineering] [th01] YuugenMagan: Eye distances
Turns out that we can define the magic numbers used in the pentagram
shrink effect in terms of the distances between the eyes and the
pentagram's target position in the center of the playfield. Therefore,
specifying the eye positions in raw pixel coordinates won't give the
full picture (who would have thought).

Part of P0208, funded by GhostPhanom and Yanga.
2022-08-08 20:12:51 +02:00
nmlgc c26ef4bdeb [Reverse-engineering] [th01] YuugenMagan: Eye sprite IDs
Completes P0207, funded by GhostPhanom.
2022-08-08 20:12:03 +02:00
nmlgc 813d54fd0d [Decompilation] [th01] Line bullets
Not really "lasers", as they're also what YuugenMagan's pentagram is
made out of.

Part of P0207, funded by GhostPhanom.
2022-08-08 20:11:57 +02:00
nmlgc abe7d4f1ba [Maintenance] [th01] Pellets: Clarify the bounce-from-top motion types
They really are no different from regular pellet motion until they
reach the top of the playfield. Also, part 2 of 5a8bbd2.

Part of P0207, funded by GhostPhanom.
2022-08-08 20:11:51 +02:00
nmlgc 11dd60e67e [Maintenance] [th01] Define select_for_rank() as `static`
Part of P0207, funded by GhostPhanom.
2022-08-08 20:11:45 +02:00
nmlgc 45a9463def [Maintenance] [th01] Elis: Move pattern data section before the *_load() call
That's the same place it is (and will be) declared for all other
bosses in this game.

Part of P0207, funded by GhostPhanom.
2022-08-08 20:11:38 +02:00
nmlgc 2db58cb3d9 [Maintenance] [th01] Boss entities: Rewrite the entity array as 5 variables
Nooooo, the static initialization code proves that `boss_entities`
couldn't have been an array in ZUN's code! 😢 Which in turn explains
why YuugenMagan's and Elis' code looks the way it does. We could go
into undefined behavior territory and just cast `boss_entity_0` to a
pointer, but let's better not annoy future port authors just for my
personal convenience. In turn, we need to get a bit clever with some of
Elis' code to replace the now wholly redundant `elis_entity_t` type,
but it's not all too bad.

Part of P0207, funded by GhostPhanom.
2022-08-08 20:11:33 +02:00
nmlgc 55ced3bada [Naming] [th01] Boss entities: Clarify that the lock also applies to rendering
You don't get the full picture of YuugenMagan's rendering calls
otherwise.
It's also really stupid in how it trades performance for flickering.

Part of P0207, funded by GhostPhanom.
2022-08-08 20:11:27 +02:00
nmlgc fb72ea5be6 [Maintenance] [th01] Boss entities: Move Orb hitbox setter to collision section
Part of P0207, funded by GhostPhanom.
2022-08-08 20:11:22 +02:00
nmlgc e5ca2928d2 [Maintenance] [th01] Text mode functions: ZUN's proprietary attribute bits
Again (2113031), very helpful for debugging.

Part of P0207, funded by GhostPhanom.
2022-08-08 20:11:16 +02:00
nmlgc cfea4971ee [Maintenance] [th01] Publicly define clock direction constants
Part of P0207, funded by GhostPhanom.
2022-08-08 20:11:11 +02:00
nmlgc 57835690e8 [Maintenance] [th01] Move BSS data of FUUIN.EXE segments ≥4 to the data unit
Part of P0207, funded by GhostPhanom.
2022-08-08 20:11:05 +02:00
nmlgc c99f824f97 [Maintenance] Introduce color component constants
YuugenMagan will need them.

Part of P0207, funded by GhostPhanom.
2022-08-08 20:10:59 +02:00
nmlgc a10fe95b31 [Maintenance] Fix comment↔code associations
• Comments that describe all lines of code until a blank one are placed
  into the lines immediately above
• Comments that describe an entire demarcated block are placed
  immediately below the dash row at the top
• In any case, there should be a blank line after the top comment of
  a demarcated block, to keep IntelliSense-style systems from applying
  the block comment to the first actual line of code…
• …but there shouldn't be one before the dash row at the bottom, where
  it'd be redundant.

Part of P0207, funded by GhostPhanom.
2022-08-08 20:10:53 +02:00
nmlgc 386d9cd4cb [Contributing] Establish a more greppable convention for space-saving `union`s
How did I end up with x86 registers of all things?

Part of P0207, funded by GhostPhanom.
2022-08-08 20:10:47 +02:00
nmlgc 456768a4ff [Contributing] Define `struct`, `class` and `template` naming conventions
Again, these are what I've been mostly following, apart from a few
inconsistencies which this commit also fixes.

Part of P0207, funded by GhostPhanom.
2022-08-08 20:10:38 +02:00
nmlgc 454c105483 [Research] [th01] Konngara: Discover the cause behind the green discoloration
Yup, if it weren't for that one boss function periodically resetting
the palette to the other global one, this discoloration would be
permanent.

Completes P0206, funded by Yanga and [Anonymous].
2022-07-17 20:46:02 +02:00