Commit Graph

1981 Commits

Author SHA1 Message Date
nmlgc 9342665312 [Readme] Update branch overview 2022-06-17 19:02:59 +02:00
nmlgc 67e46b5e33 [Research] [th01] Find out why the ドカーン ending image is even visible at all
No frame delay after its blitting call, immediately overwritten on the
next iteration… but if EGC "acceleration" leads to 8000 VRAM page
switches, you don't need additional delay for parts of the image to
remain visible after all.

Part of P0200, funded by Yanga.
2022-06-17 15:30:30 +02:00
nmlgc bfdb1e33f4 [Decompilation] [th01] Endings: Bad
Part of P0200, funded by Yanga.
2022-06-17 15:30:30 +02:00
nmlgc cfb0b5f21b [Decompilation] [th01] Endings: Good
100 functions remaining in all of TH01!

Part of P0200, funded by Yanga.
2022-06-17 15:30:30 +02:00
nmlgc f1dbf5f13f [Decompilation] [th01] Endings: Boss slideshow
Alignment hacks! Alignment hacks everywhere.
(The translation unit layout workarounds are temporary, at least.)

Part of P0200, funded by Yanga.
2022-06-17 15:30:30 +02:00
nmlgc 0724d972de [Decompilation] [th01] Kikuri: Move all data to C land
5th PC-98 Touhou boss completely decompiled, 26 to go!

Part of P0200, funded by Yanga.
2022-06-17 15:30:30 +02:00
nmlgc dfd52513de [Decompilation] [th01] Kikuri: Main function
Part of P0200, funded by Yanga.
2022-06-17 15:30:30 +02:00
nmlgc 5af2048057 [Decompilation] [th01] Kikuri: Pattern 10/10
The one where Kikuri fires 10 vertical lasers from the top along the
entire width of the playfield.

Completes P0199, funded by Lmocinemod.
2022-06-17 15:30:30 +02:00
nmlgc f047079139 [Decompilation] [th01] Kikuri: Pattern 9/10
The one where Kikuri' souls fire symmetric 3-line rain pellets at a
much longer interval than ZUN intended, thanks to him once again
confusing > and >=.

Part of P0199, funded by Lmocinemod.
2022-06-17 15:30:30 +02:00
nmlgc a8191f029a [Decompilation] [th01] Kikuri: Pattern 8/10
The one where Kikuri fires 6 lasers from her left eye, 30 frames apart,
and randomly aimed within a 120-pixel range around the player.

Part of P0199, funded by Lmocinemod.
2022-06-17 15:30:30 +02:00
nmlgc 46bc4fbe64 [Decompilation] [th01] Kikuri: Pattern 7/10
The one where Kikuri fires a 4-spiral along the edge of the disc… or
something to that effect. Not that much code, but still quite a chaotic
pattern, especially on higher difficulties.

Part of P0199, funded by Lmocinemod.
2022-06-17 15:30:30 +02:00
nmlgc 023d75f93b [Decompilation] [th01] Kikuri: Pattern 6/10
The one where Kikuri's souls fire single aimed pellets every 200
frames. Barely even noticeable as a distinct pattern due to the 4
other, much more complex patterns in phase 6 that run simultaneously.

Part of P0199, funded by Lmocinemod.
2022-06-17 15:30:30 +02:00
nmlgc 9dc05082a7 [Decompilation] [th01] Kikuri: Pattern 5/10
The one where Kikuri fires two red lasers from her eyes every 200
frames. They're aimed to the respective opposite direction around the
player, crossing each other on the way there.

Part of P0199, funded by Lmocinemod.
2022-06-17 15:30:30 +02:00
nmlgc b6d65cab76 [Decompilation] [th01] Kikuri: Pattern 4/10
The one where Kikuri's souls move on a diagonal line and drop tears.
Almost wouldn't have called this one a pattern, but the ripples can
kill the player, after all.

Part of P0199, funded by Lmocinemod.
2022-06-17 15:30:30 +02:00
nmlgc 662b53dd1f [Decompilation] [th01] Kikuri: Pattern 3/10
The one where Kikuri's souls fire spread pellet groups every 80 frames.
Pretty much Kikuri's counterpart to Elis' pattern_bat_slow_spreads(),
as it's also aimed on every difficulty except Lunatic.

Part of P0199, funded by Lmocinemod.
2022-06-17 15:30:30 +02:00
nmlgc 6a710cd7a0 [Decompilation] [th01] Kikuri: Soul activation
Part of P0199, funded by Lmocinemod.
2022-06-17 15:30:30 +02:00
nmlgc 2cae284a05 [Decompilation] [th01] Kikuri: Pattern 2/10
The one where Kikuri fires small spinning 8-pellet circles from her
ball of light, aimed to the player. The only pattern in the entire game
that uses the "spin pellet" type, forcing two additional parameters
onto every other single-pellet spawn call. (Luckily, C++ has default
arguments!)

Part of P0199, funded by Lmocinemod.
2022-06-17 15:30:30 +02:00
nmlgc 985c4af2ff [Decompilation] [th01] Kikuri: Pattern 1/10
The infamous first pattern of the fight, where Kikuri fires an
uninterrupted symmetric spiral of pellets for 800 frames.

(Coincidentally, TH01 has also reached the 80% RE mark with this one!)

Part of P0199, funded by Lmocinemod.
2022-06-17 15:30:30 +02:00
nmlgc 440637ed8e [Decompilation] [th01] Kikuri: Masked line copies from VRAM page 1 to 0
Could have also been EGC-accelerated, but who cares, it's only used for
the blocking entrance animation.

Completes P0198, funded by Lmocinemod and Ember2528.
2022-06-17 15:30:30 +02:00
nmlgc a1895cc7b3 [Decompilation] [th01] Kikuri: Tear and ripple effect rendering
The worst case of an `else if` chain so far. Perfectly regular if you
abstract away the per-sprite calculations, yet still hopelessly
hardcoded… and broken anyway, especially together with the collision
detection from the previous commit.

Part of P0198, funded by Lmocinemod and Ember2528.
2022-06-17 15:30:30 +02:00
nmlgc ca5aef394a [Decompilation] [th01] Kikuri: Player↔ripple collision detection
What's with all these useful helper functions all of a sudden?

Part of P0198, funded by Lmocinemod and Ember2528.
2022-06-16 22:52:23 +02:00
nmlgc 38dd331734 [Decompilation] [th01] Kikuri: Tear spawning
Part of P0198, funded by Lmocinemod and Ember2528.
2022-06-16 22:52:18 +02:00
nmlgc 53abecd7d4 [Decompilation] [th01] Kikuri: Soul movement and rendering calls
Part of P0198, funded by Lmocinemod and Ember2528.
2022-06-16 22:52:13 +02:00
nmlgc d0d36b5840 [Decompilation] [th01] Kikuri: Orb hitbox
ZUN *did* want a hitbox in the disc's horizontally centered upper half,
but then confused < and >, accidentally ending up with a hitbox from
the top of the playfield to the upper part of Kikuri's face instead… 🎺

Part of P0198, funded by Lmocinemod and Ember2528.
2022-06-16 22:52:06 +02:00
nmlgc 0b3077a0c7 [Decompilation] [th01] Kikuri: Sprite freeing
Part of P0198, funded by Lmocinemod and Ember2528.
2022-06-16 22:52:00 +02:00
nmlgc 01b3b271f6 [Decompilation] [th01] Kikuri: Sprite loading and initial variables
And yes, that's indeed a custom copy constructor, as we're going to see
later.

Part of P0198, funded by Lmocinemod and Ember2528.
2022-06-16 22:51:55 +02:00
nmlgc 0e08db76c9 [Reverse-engineering] [th01] Kikuri: Tear animation frame
Not even *that* much of a generic name to indicate the three different
semantics of this value!

Part of P0198, funded by Lmocinemod and Ember2528.
2022-06-16 22:51:49 +02:00
nmlgc 8199a87700 [Naming] [th01] Kikuri: Generic pattern state variable
Only two different semantics in this fight.

Part of P0198, funded by Lmocinemod and Ember2528.
2022-06-16 22:51:44 +02:00
nmlgc dd8461e0bc [Maintenance] [th01] Boss entrance rings: Move main code into a macro
Part of P0198, funded by Lmocinemod and Ember2528.
2022-06-16 22:51:38 +02:00
nmlgc c3572c62a9 [Maintenance] [th01] Boss entities: Add a static sprite size wrapper template
Not too useful for Elis since she's already got the form system, but
it will save a bit of boilerplate code for Kikuri.

Part of P0198, funded by Lmocinemod and Ember2528.
2022-06-16 22:51:28 +02:00
nmlgc 7bdf35a22b [Maintenance] [th01] Remove `extern "C"` from more areas of code
The .BOS freeing funtions, others that are close to them in the typical
#include order, and the ending picture functions.

Part of P0198, funded by Lmocinemod and Ember2528.
2022-06-16 22:51:07 +02:00
nmlgc 00d4b4ab30 [Maintenance] Define a VRAM byte mask constant
Less visual noise.

Part of P0198, funded by Lmocinemod and Ember2528.
2022-06-16 22:50:43 +02:00
nmlgc 8fce97ea1c [Maintenance] Add a static_assert() polyfill to platform.h
Part of P0198, funded by Lmocinemod and Ember2528.
2022-06-16 22:50:31 +02:00
nmlgc 16aba1bc9a [Readme] Update branch overview
Adding `th01_critical_fixes`, which has also become a part of
`community_choice_fixes`.
2022-06-01 02:27:52 +02:00
nmlgc 48db0b7a72 [Decompilation] [th01] Verdict screen: Title calculation
You can definitely make an argument that these if/else if branches are
easier to read than their implied formula, especially with all
variables being signed here.

Completes P0197, funded by Yanga and Ember2528.
2022-06-01 02:27:52 +02:00
nmlgc 2863a69836 [Decompilation] [th01] Verdict screen: Main function
Part of P0197, funded by Yanga and Ember2528.
2022-06-01 02:27:52 +02:00
nmlgc cde1199485 [Maintenance] [th01/th03] Don't declare an Extra rank
AKA a reaction commit to the unfounded theory from Asprey's "Unused
Content in Touhou Project" video. (Seriously though, it does help with
the code for these games.)

Part of P0197, funded by Yanga and Ember2528.
2022-05-31 23:39:34 +02:00
nmlgc e98fa0b78e [Maintenance] [th01] High score menu: Publically declare text colors
Part of P0197, funded by Yanga and Ember2528.
2022-05-31 23:39:34 +02:00
nmlgc e15942bb7c [Maintenance] [th01] Add string length calculation wrappers for VRAM typing
Part of P0197, funded by Yanga and Ember2528.
2022-05-31 23:39:34 +02:00
nmlgc 94372d2e27 [Maintenance] [th01] Move data of FUUIN.EXE segments ≥4 to a new assembly unit
Turns out that the "new idea" for handling these data slices won't work
out in reality. At least the amount of necessary manual `extern`
declarations isn't soul-crushingly large, so this way isn't bad either,
after all!

Part of P0197, funded by Yanga and Ember2528.
2022-05-31 23:39:34 +02:00
nmlgc 9cd1b04894 [Research] [th01] Find out why defeating bosses with lasers can crash the game
Brought to you by diagonal movement and the combined effect of 4 ZUN
bugs. Most commonly reported for Elis and Mima.

Part of P0197, funded by Yanga and Ember2528.
2022-05-31 23:39:34 +02:00
nmlgc b165871ece [Maintenance] [th01] graph_r_line(): Make slope calculations more explicit
The previous macros suggested optimizations that could easily lead to
crashes.

Part of P0197, funded by Yanga and Ember2528.
2022-05-31 23:39:34 +02:00
nmlgc b4033b5fe4 [Research] [th01] Document potential HP bar heap corruption in debug mode
Turns out that Konngara is also affected.

Part of P0197, funded by Yanga and Ember2528.
2022-05-31 23:29:26 +02:00
nmlgc 57c9ac5da7 [Decompilation] [th01] Elis: Move all data to C land
4th PC-98 Touhou boss completely decompiled, 27 to go!

Completes P0196, funded by Yanga.
2022-05-31 23:15:14 +02:00
nmlgc e2f7a7afc4 [Decompilation] [th01] Elis: Main function
Part of P0196, funded by Yanga.
2022-05-31 23:15:14 +02:00
nmlgc 0062826327 [Separating translation units] [th01] Additional hardware effect functions
These could have been nicely separated into per-device translations
(one for GDC, one for EGC, one for regular VRAM accesses)… if their
original order followed that classification.

OK, so let's make it one full `graph_ex.cpp` translation unit… nope,
FUUIN.EXE needs graph_2xscale_byterect_1_to_0_slow() with different
compilation flags. 🤦

Whatever, fuck it, let's go for individual translation units, with
individual headers, so that we at least get predictably organized
source code out of this.

Part of P0196, funded by Yanga.
2022-05-31 23:15:14 +02:00
nmlgc e18c53d7ac [Decompilation] [th01] Elis: Phase 5 transformation / bat pattern selection
Completes P0195, funded by Yanga.
2022-05-31 23:15:14 +02:00
nmlgc 9299df2f53 [Decompilation] [th01] Elis: Phase 5 girl pattern selection
The phase 3 selection logic was fine! No need to reinvent it with even
more convoluted logic, in a function that should not exist to begin
with. (Phase 4 is another one that only consists of a teleport and a
bat transformation.)

Part of P0195, funded by Yanga.
2022-05-31 23:15:14 +02:00
nmlgc be7e88ceaf [Decompilation] [th01] Elis: Pattern 13/13
The one where Elis fires aimed 5-spreads from her left and right wings,
togther with an aimed laser every second time, and finishes with a
32-ring of static bullets along, yet again, not quite the center
position of the big circle around her.

Part of P0195, funded by Yanga.
2022-05-31 23:15:14 +02:00
nmlgc 387431ed15 [Decompilation] [th01] Elis: Pattern 12/13
The one where Elis creates a safety zone of 256 pixels around the
initial position of the player, indicated by a circle, and then fires
pellets from random positions at the top edge of the playfield for a
while.

Followed by 5 aimed pellets from her center position.

Followed by… 7 aimed pellets from the bat entity's center position?!
Except that those aren't even correctly centered relative to the bat,
and still use the center offset of the girl sprite.

Part of P0195, funded by Yanga.
2022-05-31 23:15:14 +02:00