Commit Graph

1776 Commits

Author SHA1 Message Date
nmlgc c04ca8da91 [Reverse-engineering] [th03] Collision bitmap: Drawing slopes (undecompilable)
Reason: Self-modifying. -.-

Only used in Chiyuri's EX Attack (the one with the diagonal lasers).

Part of P0182, funded by Lmocinemod and [Anonymous].
2022-02-18 09:36:34 +01:00
nmlgc 3072208336 [Reverse-engineering] [th03] Collision bitmap: Variables and constants
Oh wow, it's exactly how I always naively imagined collision detection
to be implemented in a fixed-resolution 2D bullet hell game with small
hitboxes.

Part of P0182, funded by Lmocinemod and [Anonymous].
2022-02-18 09:36:34 +01:00
nmlgc 31b9338824 [Naming] [th03] Player: Rendering function
Just needing this one for a mod…

Part of P0182, funded by Lmocinemod and [Anonymous].
2022-02-18 09:36:34 +01:00
nmlgc 1fd9b6a0c1 [Maintenance] Introduce factor and bit count constants for subpixels
Providing that tiny bit of additional readability.

Part of P0182, funded by Lmocinemod and [Anonymous].
2022-02-18 09:36:28 +01:00
nmlgc 70cbf4bbe1 [Maintenance] [th03] Adopt the PlayfieldPoint subpixel type from TH02/TH04/TH05
Makes sense for this game as well, even if it can only serve
documentary purpose due to it not knowing which playfield it's on.

Part of P0182, funded by Lmocinemod and [Anonymous].
2022-02-14 07:03:34 +01:00
nmlgc 313450f00a [Decompilation] [th01] Sariel: Move all data to C land
Second PC-98 Touhou boss completely decompiled, 29 to go! But meh,
ZUN's original code did in fact force the three leaf pattern sprites
into separate 1-sprite sheets…

Completes P0181, funded by Ember2528.
2022-01-31 08:31:18 +01:00
nmlgc 8b24a07a09 [Decompilation] [th01] Sariel: Main function
Part of P0181, funded by Ember2528.
2022-01-31 08:31:18 +01:00
nmlgc e0454a41bb [Decompilation] [th01] Expanding 4-stack, 32-square boss entrance rings
The final part of Kikuri's and Sariel's entrance animation.

Part of P0181, funded by Ember2528.
2022-01-31 08:31:18 +01:00
nmlgc d9228e0320 [Decompilation] [th01] Shootout lasers: Broken reset function
Whoops, 4406c3d did not actually decompile it yet.

Part of P0181, funded by Ember2528.
2022-01-31 08:31:18 +01:00
nmlgc 091f19f69b [Decompilation] [th01] Sariel: Pattern 16/16
The one where Sariel's second form shoots sparks towards the top of the
playfield, which then turn into leaf-like sprites that sway towards the
bottom, killing Reimu on contact.

And wow, what a finish! A weird "decimal subpixel" type, hardcoded
sprites, and effectively unused non-hardcoded sprites. Too bad that it
also ruins the nice `dot_rect_t(w, h)` parameter abstraction for
grcg_put_8x8_mono()…

Completes P0180, funded by Yanga.
2022-01-31 08:31:18 +01:00
nmlgc 77858c1337 [Decompilation] [th01] Sariel: Pattern 15/16
The one where ZUN copy-pasted Pattern 12, removed the expanding dotted
circle, and made it twice as long.

Part of P0180, funded by Yanga.
2022-01-31 07:18:43 +01:00
nmlgc 0393af6f0f [Decompilation] [th01] Sariel: Pattern 14/16
The one where evenly spaced, randomly aimed pellets rain down from an
imaginary horizontal line at the seal's center Y coordinate. Featuring
an equally broken symmetric spawn ray variant.

Part of P0180, funded by Yanga.
2022-01-31 07:18:43 +01:00
nmlgc 9e5b344af1 [Decompilation] [th01] Sariel: Pattern 13/16
The one where decelerating pellets form a curve shape, by being fired
from the center and aimed along the bottom left and right edges of the
playfield.

First pattern of Sariel's second form… which is where ZUN apparently
learned to pass the frame count as a parameter. Would have been even
nicer if the return value indicated when the pattern is done instead of
mutating a reference to the frame count.

Completes P0179, funded by Ember2528.
2022-01-31 07:18:43 +01:00
nmlgc 28e2780050 [Decompilation] [th01] Sariel: 2×2 particle system (horizontal)
Part of P0179, funded by Ember2528.
2022-01-31 07:18:43 +01:00
nmlgc 43a18beafe [Decompilation] [th01] Sariel: Dotted circle unblit/update/render function
Part of P0179, funded by Ember2528.
2022-01-31 07:18:43 +01:00
nmlgc cceb09fc3e [Decompilation] [th01] Sariel: Pattern 12/16
The one where Sariel fires vertical 3-stacks with two spawners moving
from between the two bottom edges of the playfield, followed by
randomly raining bullets from two spawners moving between the two top
edges of the playfield. Final pattern of Sariel's first form, and
surprisingly fair by never spawning pellets on top of Reimu.

Also, about time I found a way of bypassing the -Z -3 function
parameter optimization in order to keep using nice structures like
these.

Part of P0179, funded by Ember2528.
2022-01-31 07:18:43 +01:00
nmlgc 60621f8aa8 [Decompilation] [th01] Sariel: Pattern 11/16
The one where Sariel fires four semicircle spreads from their shield,
10 frames apart.

So nice and simple that it warrants trying out a more compact coding
style for these `for` loops with two loop variables. The more I look at
it, the more I like it? I do think it's good.

Completes P0178, funded by Ember2528.
2022-01-31 07:18:43 +01:00
nmlgc d2170cff51 [Decompilation] [th01] Sariel: Pattern 10/16
The one where symmetric birds spawn from the bottom of the playfield,
then fly to the top while shooting bullets at random angles.

Part of P0178, funded by Ember2528.
2022-01-31 07:18:43 +01:00
nmlgc 5f0cabcc78 [Decompilation] [th01] Sariel: Pattern 9/16
The one with a single spawn ray spinning from Sariel's shield across
the seal, followed by radial pellet stacks and lasers being fired from
the same position.

Completes P0177, funded by Yanga.
2022-01-31 07:18:43 +01:00
nmlgc c557757e79 [Decompilation] [th01] Sariel: Pattern 8/16
The one where pellets rain from the top of the playfield every 8
frames, at random angles on Lunatic and straight down on every other
difficulty.

Part of P0177, funded by Yanga.
2022-01-31 07:18:43 +01:00
nmlgc 7250fe6e0f [Decompilation] [th01] Sariel: 50-frame screen shake
Could technically be interpreted as a subpattern as well.

Part of P0177, funded by Yanga.
2022-01-31 07:18:43 +01:00
nmlgc e4a304febe [Decompilation] [th01] Sariel: Pattern 7/16
The one with four aimed lasers spawned from fixed positions on Sariel's
face (?) and shield.

Part of P0177, funded by Yanga.
2022-01-31 07:18:43 +01:00
nmlgc 3a751d59d4 [Decompilation] [th01] Sariel: 2×2 particle system (wavy)
> use 64-bit floating-point for particles that move on strictly
  one-dimensional lines
> use integer pixels for particles with a sine wave motion

Part of P0177, funded by Yanga.
2022-01-31 07:18:43 +01:00
nmlgc abda8fbda5 [Decompilation] [th01] Sariel: Pattern 6/16
The one consisting of a dense, aimed cluster of sling pellets.

Part of P0177, funded by Yanga.
2022-01-31 07:18:43 +01:00
nmlgc 630e8a9017 [Decompilation] [th01] Sariel: Pattern 5/16
The one with the 2-rings firing from the two orbs on the left and right
side of the playfield.

4th pattern, and it took 4 pushes in this series to get there… Looks
like it's going to get easier from here on, though.

Part of P0177, funded by Yanga.
2022-01-31 07:18:43 +01:00
nmlgc 5d557a2437 [Decompilation] [th01] Sariel: Pattern 4/16
The one with the single snowflake, detonating into a 94-pixel hitbox…

Part of P0177, funded by Yanga.
2022-01-31 07:18:43 +01:00
nmlgc c5dc45b1c4 [Decompilation] [th01] Sariel: 2×2 particle system (vertical)
Maximum floating-point decadence yet again, for an effect that you
barely even notice (and your brain probably didn't, either).
Fun fact: They stop animating during the background transition
animation I've just decompiled previously.

Completes P0176, funded by Ember2528.
2022-01-31 07:18:42 +01:00
nmlgc a78c4ff0f3 [Decompilation] [th01] Sariel: Background transition animation
One of the hardest decompilations in a long while:
• Required new research into code generation for pointer arithmetic
• ZUN needlessly calculating intermediate results over and over again,
  making the function tedious to read
• GRCG reads in TCR mode, which I haven't seen so far either

Part of P0176, funded by Ember2528.
2022-01-31 07:18:42 +01:00
nmlgc 244136c42b [Naming] [th01] Rename grcg_setcolor_tdw() to grcg_setcolor_tcr()
TDW and TCR modes share the same bit in the GRCG mode register and are
thus indistinguishable when looking at a disassembly, but only apply to
writing (TDW) or reading (TCR), respectively. TH01 only performs read
operations in this mode, so it's unambiguously TCR.

Part of P0176, funded by Ember2528.
2022-01-31 07:18:42 +01:00
nmlgc 40ac9a7aa1 [Decompilation] [th01] Sariel: Pattern 3/16
The one where red birds hatch on an ellipse arc, then fly away while
shooting a randomly selected pellet group type. Containing Sariel's
first ZUN bug, resulting in unused sprite movement.

Completes P0175, funded by Ember2528.
2022-01-31 07:18:42 +01:00
nmlgc d1627c6f56 [Decompilation] [th01] Sariel: Pattern 1/16
The one with the 10 random purple lasers.

Part of P0175, funded by Ember2528.
2022-01-31 07:18:42 +01:00
nmlgc 0054b10480 [Decompilation] [th01] Sariel: Pattern 2/16
The one where two vortex sprites wall Reimu inside a continuously fired
static 3-spread stack.

Whose per-difficulty density is only controlled by the amount of
frames they have moved towards each other, interestingly.

(And yes, second pattern in the fight, first one in the code.)

Part of P0175, funded by Ember2528.
2022-01-31 07:18:42 +01:00
nmlgc 97e7a2ff6d [Decompilation] [th01] Sariel: Dress animation
Largely identical to the shield animation, except in all the details
where it isn't.

Part of P0175, funded by Ember2528.
2022-01-31 07:18:42 +01:00
nmlgc af76839067 [Decompilation] [th01] Sariel: Lowered / initial wand sprite blitting
Surprise, this .PTN sprite isn't actually just the background, but a
complete opaque copy of the 128×128 pixels in the .GRP image that
contain the initial position of the wand. This is what allows Sariel
to lower it again after blitting the raised sprites from BOSS6_2.BOS.

Part of P0175, funded by Ember2528.
2022-01-31 07:18:42 +01:00
nmlgc cfa5428dff [Decompilation] [th01] Sariel: Wand raise animation
In which the black part in BOSS6_2.BOS's second cel is indeed meant to
unblit the purple part in the first cel, leaving a hole in both the
seal and the red HUD border. Shouldn't it rather contain the original
pixels, including the part of the seal that is covered by the sphere on
top of the wand even in the .GRP?

Part of P0175, funded by Ember2528.
2022-01-31 07:18:42 +01:00
nmlgc 5db5df4da3 [Decompilation] [th01] Sariel: Shield animation
Part of P0175, funded by Ember2528.
2022-01-31 07:18:35 +01:00
nmlgc a0fe812216 [Decompilation] [th01] Sariel: Bird reset/fire/spawn/unblit/update/blit function
I appreciate that this design allows all bird state to be scoped to
this function, but *come on*, one function doing 6 different jobs?
Also, maximum floating-point decadence… but perhaps the worst part is
that the initial bird eggs are a *different* entity.

Completes P0174, funded by Ember2528.
2022-01-31 05:15:37 +01:00
nmlgc 76ea88c0bc [Decompilation] [th01] Sariel: Move already referenced literals to C land
After the previous commit, we can already do this now, and therefore
have to do less at once in the end.

Part of P0174, funded by Ember2528.
2022-01-31 05:15:33 +01:00
nmlgc 8b01702aa5 [Decompilation] [th01] Sariel: Move compiler-generated data to C land
Very helpful at this small scale, as it allows us to directly decompile
floating-point literals. These will be added to Sariel's regular
translation unit in the same order, so we merely have to remove them
from this temporary translation unit then.

Part of P0174, funded by Ember2528.
2022-01-31 05:15:29 +01:00
nmlgc b1ec7fce28 [Decompilation] [th01] Sariel: Spawn ray rendering
So if Sariel's version of this function is worse than Konngara's, can
we conclude that Sariel's code was written first?

(Edit, after having decompiled more of the fight: Sariel's functions
are predominantly `near` in contrast to Konngara's 100% `far` ones,
which is just as much of an indicator for the opposite.)

Part of P0174, funded by Ember2528.
2022-01-31 05:15:25 +01:00
nmlgc c8636aed9b [Decompilation] [th01] Sariel: Sprite freeing
Part of P0174, funded by Ember2528.
2022-01-31 05:15:21 +01:00
nmlgc 55fe56544b [Reverse-engineering] [th01] Sariel: .GRC slots
Part of P0174, funded by Ember2528.
2022-01-31 05:15:17 +01:00
nmlgc 9979a0fe83 [Naming] [th01] Sariel: Generic pattern state variable
Part of P0174, funded by Ember2528.
2022-01-31 05:15:13 +01:00
nmlgc 4f63210c8a [Maintenance] [th01] Move boss entity loading calls next to their freeing calls
With loading and freeing code physically close together, it almost
looks like C++ classes.

Part of P0174, funded by Ember2528.
2022-01-31 05:15:08 +01: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 e1de05288b [Maintenance] [th01] Move one-off GRCG macros to planar.h
We're going to see them again after all.

Part of P0174, funded by Ember2528.
2022-01-31 05:15:00 +01:00
nmlgc 210476f34d [Maintenance] [th01] Start a new header file for direction types
Copy-pasting `x_direction_t` once was OK, but since we're about to do
that again… not so much.

Part of P0174, funded by Ember2528.
2022-01-31 05:14:55 +01:00
nmlgc 07fa6cb4d3 [Maintenance] [th01] Set PM_NORMAL as the default pellet motion type parameter
Every other motion type requires the other parameters to make sense.
If none of those are given, PM_NORMAL is redundant as well.

Part of P0174, funded by Ember2528.
2022-01-31 05:14:28 +01:00
nmlgc 27f901c48d [Decompilation] [th03] High score menu: Name entering loop
Not jank-free by far, but thankfully much better than TH01's.

Completes P0173, funded by [Anonymous].
2021-12-27 18:38:32 +01:00
nmlgc 1465731780 [Decompilation] [th03] High score menu: High-level row rendering functions
Part of P0173, funded by [Anonymous].
2021-12-27 18:38:32 +01:00