Commit Graph

34 Commits

Author SHA1 Message Date
nmlgc 3c7371c2de [Decompilation] [th01] SinGyoku: Sprite loading and initial variables
Part of P0201, funded by Ember2528 and Yanga.
2022-06-24 23:28:19 +02:00
nmlgc 6f2881f056 [Maintenance] Remove `extern "C"` from more areas of code
The .PTN functions, vector functions, and egc_copy_rect_1_to_0_1()
(finally!) from TH01, as well as playfld.hpp from all games(finally!),
together with a bunch of other functions in their vicinity.

Part of P0201, funded by Ember2528 and Yanga.
2022-06-24 23:28:19 +02:00
nmlgc 124f68946a [Maintenance] [th01] Boss entities: Force `bos_image` through a getter method
Noooo, SinGyoku will in fact prove the existence of this getter method
via the given code generation detail. Might as well go fully consistent
then and exclusively use the methods, ending the previous party time.

Part of P0201, funded by Ember2528 and Yanga.
2022-06-24 22:50:24 +02:00
nmlgc 7cbe533784 [Maintenance] [th01] Add select_for_rank() subpixel and laser speed wrappers
Another one from the visual noise reduction department.

Part of P0201, funded by Ember2528 and Yanga.
2022-06-24 22:49:52 +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 e4343b2c95 [Maintenance] [th01] Better distinguish boss "entities" from "other sprites"
Part of P0174, funded by Ember2528.
2022-01-31 05:15:04 +01:00
nmlgc 7bf183621c [Reverse-engineering] [th01] Bosses: .PTN slot IDs
Common sense: Entity backgrounds always go into slot X, missile sprites
into slot Y, and wave sprites into slot Z
ZUN: "Nah, let's set aside two slots, and bosses can just freely use
them as they want 🎺"

Part of P0165, funded by Ember2528.
2021-11-07 22:50:28 +01:00
nmlgc a99eb4ed44 [Decompilation] [th01] select_for_rank: Don't redeclare the rank variable
Otherwise, it gets quite annoying to use that variable in the rest of
the translation unit.

Part of P0153, funded by Ember2528.
2021-08-22 15:07:17 +02:00
nmlgc dc9e3ee475 [Decompilation] [th01] Bosses: Collision handling
Functions with 12 parameters are hard to describe, y'know. Looking
forward to decompiling these giant expressions for the actual
boss↔orb collision parameter passed to this function…

Oh well, at least we're now totally ready for some boss code next
year. 😌

Completes P0131, funded by Yanga.
2020-12-18 01:38:52 +01:00
nmlgc d5fd70c458 [Decompilation] [th01] HUD: HP rendering
And we're right back to things not being nice. Because yeah, why
shouldn't these three distinct rendering functions be part of a single
function, selected by magic numbers?
Or why shouldn't the 16×16 wrapper around a 32×32 set of graphics
functions be used to handle backgrounds for 16×8 sprites, resulting in
needlessly complex parameter calculations that lead to sloppy code?

Part of P0131, funded by Yanga.
2020-12-18 01:38:48 +01:00
nmlgc 64f872e5c5 [Decompilation] [th01] Difficulty-based value selection
And with that, TH01 is pushed over the 50% completion mark! 🎉

This time, it's only YuugenMagan who gets no own copy. Giant RE% gains
from all these calls, but let's hope I don't regret already decompiling
this one for all bosses. It's not quite at the beginning of SinGyoku's,
Mima's, and Elis' code segment, after all…

Part of P0130, funded by Yanga.
2020-12-18 00:59:41 +01:00
nmlgc aaea18aa8f [Decompilation] [th01] Retrieving and setting the default boss palette
The placement at the beginning of Kikuri's code segment makes you think
this is only used for the barely noticeable white-in effect during
Kikuri's entrance animation. It's also used to periodically reset boss
sprite colors during the flashing effect after getting hit by the Orb,
though.

Part of P0130, funded by Yanga.
2020-12-18 00:55:21 +01:00