Third longest function in all of PC-98 Touhou, and it's even more of a
copy-pasta than the patterns we've seen earlier. Certainly didn't feel
that long.
Part of P0156, funded by Ember2528.
The one where Konngara swings their sword and fires fast aimed pellets
towards the player.
The third time we've seen the exact same basic function layout…
Part of P0155, funded by Ember2528.
The one with lasers fired from the sword across the whole playfield,
either from left to right or from right to left, together with aimed
3-way spreads, every 10 frames.
Part of P0155, funded by Ember2528.
Similarly to cb6367a, you also can't tell from a function's ASM whether
a parameter that's assigned to an 8-bit destination is actually an 8-bit
parameter, or a narrowed 16-bit parameter. That can really only be
gleaned from looking at all call sites…
Part of P0155, funded by Ember2528.
The one where Konngara swings their sword and spawns triangle-shaped
subpatterns along the slash path.
At least no randomness in that one.
Part of P0155, funded by Ember2528.
The one where Konngara swings their sword and lets pellets rain along
the (surprisingly triangular) slash path.
Yeah… not worth expressing these coordinates in playfield space when
they clearly correspond to specific locations in the background image.
Completes P0154, funded by Ember2528.
The one where Konngara shoots rays in a semicircle motion from their
sword to the edge of the playfield, with pellets raining down from the
ray's end point.
Insert "if… else if… else if…" joke. And hey, I've finally had the idea
to use function-local enums in place of #define!
Part of P0154, funded by Ember2528.
The one where a gray diamond first flies from Konngara's left sleeve to
the top of the playfield, and then moves downwards in rows from left to
right and back, shooting aimed pellets along the way.
Completes P0153, funded by Ember2528.
The one with two homing snakes, and pellets fired in a semicircle
spread. And yes, Reimu really has a 30×30-pixel hitbox against the
snakes.
Much simpler than its instruction count might suggest. Recalculating
array element addresses over and over is certainly a way to add bloat…
And yes, we're going to see all of this exact same code again in the
four-snake pattern.
Part of P0153, funded by Ember2528.
Also not worth decompiling, because:
• It would break return value semantics
• The algorithm is identical to TH04 (except for that one divisor)
• Small function
• Next to a bunch of more critical, undecompiled functions
• Decompilation would be messy anyway
Part of P0152, funded by -Tom- and [Anonymous].
And that's it! Finally RE'd every bullet spawning function in TH04 and
TH05! 🎉
These really aren't worth adding a translation unit for either, in the
end. Not least because they decide to keep bullet_template.speed from
being mutated via PUSH and POP, which we can only express via inline
assembly in C land.
Part of P0152, funded by -Tom- and [Anonymous].
Reason: That switch statement. How should we even?
Well, the code *is* fairly good. After looking very deep into it, and
spending 35% of that function on blank lines (for logical grouping) and
explanatory comments, that is…
Part of P0152, funded by -Tom- and [Anonymous].
Deciding whether to decompile this one or not seemed to be a tough
choice. Should we *really* introduce two more translation units just
for the sake of decompiling another function that's identical to its
TH04 counterpart anyway?
Well, turns out it actually isn't: TH05 does in fact *not* immediately
clip bullets that are spawned on top of the player. Which might sound
like it has a notably different effect on gameplay… except that it
doesn't.
So yeah, good we've decompiled it, and got to show that more clearly.
Part of P0152, funded by -Tom- and [Anonymous].
Reason: Self-modifying. -.- And saving SI and DI on the stack way too
late.
Luckily, it's mostly identical to TH04's version I decompiled earlier,
only (thankfully) combining regular and special bullets into one
function, and integrating TH05-specific improvements.
Part of P0152, funded by -Tom- and [Anonymous].
Only used for the revenge bullets fired from Stage 3 Alice's barrier.
Not worth creating a separate translation unit, especially since the
function above is undecompilable as well…
Part of P0152, funded by -Tom- and [Anonymous].
TH05's undecompilable bullet spawn code needs them, adding yet another
dumb file that we'll always have to drag along…
Part of P0152, funded by -Tom- and [Anonymous].
Spent 4 pushes on the basic types and constants in 2020, still ended up
up getting this wrong and documenting the opposite of what TH05 actually
does…
Part of P0152, funded by -Tom- and [Anonymous].
… (24 + (difficulty * 8) + rank) in TH04, and (42 + (difficulty * 8))
in TH05. Also, TH05 only doesn't have TH04's bullet zap animation
because ZUN didn't consistently use constants…
Completes P0151, funded by Blue Bolt and -Tom-.
Slow Mode only does one thing: It looks at how many 8×8 pellets or
16×16 bullets are alive, and reduces the frame rate by 33% (i.e., turns
every second frame into two frames) if that number is…
Part of P0151, funded by Blue Bolt and -Tom-.
First place to confirm the hitbox of both the 8×8 pellets and the 16×16
sprite bullets!
Well, "hitbox". It's really more of a kill delta of 8×8 pixels between
the center points of a bullet and the player. You can distribute these
pixels to any combination of bullet and player "hitboxes" that make up
8×8. 4×4 around both the player and bullets? 1×1 for bullets, and 8×8
for the player? All equally valid… or perhaps none of them, once you
keep in mind that other entity types might have different kill deltas,
which turns the concept of a "hitbox" into just a confusing abstraction.
Part of P0150, funded by Blue Bolt.
TH05's version, which we saw way back in ac7e6bc, is almost identical
and can be used for any speed, whereas this one is hardcoded to modify
only the speed in the bullet template.
Part of P0150, funded by Blue Bolt.
`switch` statements compiling to binary searches if the range of values
is nasty enough? That's so cool. Apart from a few places in TH02,
this is the only place in PC-98 Touhou to show off that Turbo C++
optimization.
That code's still unexpectedly janky for what you'd expect from the 4th
game in the series, though.
Part of P0150, funded by Blue Bolt.
Still way premature to say things like "the base speed of a bullet
aroup is not affected by difficulty, only by rank". (Which also would
be a way less meaningful statement than you might think it is.)
Part of P0150, funded by Blue Bolt.
Too bad that it would have made no sense to call them "goofy bullets".
"Regular" is also a better name than "normal" (which is a difficulty!).
Completes P0149, funded by Blue Bolt, Ember2528, and -Tom-.