Commit Graph

24 Commits

Author SHA1 Message Date
nmlgc 034a7db98c [Decompilation] [th05] Lasers: Update function
In which the shrink types """conveniently""" use a signed comparison
that effectively limits their width to 127 pixels, which forces a
shrink/nonshrink distinction upon the entire rest of the code. 🙄

Part of P0228, funded by [Anonymous] and nrook.
2023-01-17 12:16:49 +01:00
nmlgc 539b3ec20b [Maintenance] [th05] Bullets: Split off low-level stack/spread set optimization
Easier to get the bit shifts right if you focus on them in a separate
helper function that is decoupled from any semantics – and Sara is
about to add two more variants of these setters. By interleaving the
per-difficulty count/delta values instead of listing them separately,
it also turns out that I originally mixed them up in Shinki's 4th
pattern. Reads much better now.

Part of P0227, funded by nrook.
2023-01-17 10:34:15 +01:00
nmlgc 990588a4ea [Research] Finally figure out relativity of near references
Biggest decompilation breakthrough of the year already? Completely
removes the need for the "set near pointer to far function" hack, and
solves quite a few upcoming issues.
The TASM manuals did have a few pages on the topic of segments and
groups, but there's absolutely nothing about it in the TCC ones beyond
the three-sentence description of `#pragma codeseg` and that completely
unhelpful "🤷" of an explanation for the `Fixup overflow` error…

Part of P0227, funded by nrook.
2023-01-16 12:05:29 +01:00
nmlgc f070ee2858 [Naming] [th05] Bosses: Phase functions with externally selected patterns
As soon as we get to Sara, these will do more than just show the gather
animation. If we could change the code, we'd include the pattern
selection in the same function, but the second-best refactor would pass
the pattern function as a parameter, and therefore arrive at this
naming scheme as well.
The function pointer names are fine the way they are – since a boss can
have multiple of these externally selected patterns in more than one
phase and select them based on different rules, it makes little sense
to streamline their names.

Part of P0227, funded by nrook.
2023-01-16 10:39:02 +01:00
nmlgc eb8a4506dc [Naming] Change the _HP suffix to a prefix
Auto-completes much better.

Part of P0227, funded by nrook.
2023-01-16 10:20:28 +01:00
nmlgc d9427b0761 [Maintenance] [th02/th04/th05] Remove `extern "C"` from more areas of code
The TH04/TH05 gather functions, as well as the TH02 vector functions.

Part of P0227, funded by nrook.
2023-01-16 10:16:12 +01:00
nmlgc 944a66cf77 [Maintenance] [th04/th05] Bosses: Single-file, multi-segment code structure
As implied in adffa1c, a single segment-switching translation unit for
both rendering functions and game logic is the most straightforward
solution for those two games. Especially once you look at TH04, and
realize that the wildly chaotic order of the *_fg_render() functions in
the first code segment exactly matches the order of the *_update()
functions in the third.

Part of P0225, funded by Enderwolf, Blue Bolt, 32th System, and Yanga.
2022-11-30 22:46:22 +01: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 bcf19490f0 [Decompilation] [th05] Stage 1 midboss: Main function
Part of P0192, funded by [Anonymous], nrook, and -Tom-.
2022-05-01 00:22:03 +02:00
nmlgc 71cb7b5e93 [Decompilation] [th05] Shinki: Main function
3rd PC-98 Touhou boss completely decompiled, 28 to go… and the code
quality is taking a nosedive again, especially with that unnecessary
"relative phase" variable that collides with the laser activation flag
in the Devil pattern.
(The nearfunc_t_near workarounds are our fault, though!)

Completes P0191, funded by nrook.
2022-05-01 00:22:03 +02:00
nmlgc 9ef178431a [Maintenance] [th05] Shinki: #include 32×32 ball code from the boss script
We won't get that one padding byte in front of the shinki_update()
switch table otherwise.

Part of P0191, funded by nrook.
2022-05-01 00:22:03 +02:00
nmlgc 2fa7cc1a4f [Decompilation] [th05] Shinki: Floating movement
As seen during her winged phases.

Part of P0191, funded by nrook.
2022-05-01 00:22:03 +02:00
nmlgc 7fc3208822 [Decompilation] [th05] Shinki: Pattern 11/11
The one where Shinki first fires two point-symmetric 32×32 bullets, and
later adds two alternating spirals of red vector bullets and pellets,
respectively. Final pattern of the boss fight.

Part of P0191, funded by nrook.
2022-05-01 00:22:03 +02:00
nmlgc 293e16a052 [Decompilation] [th05] Shinki: Pattern 10/11
There one where… nah, you all know The Devil Pattern™.

Completes P0190, funded by nrook.
2022-05-01 00:22:03 +02:00
nmlgc 2027639c81 [Decompilation] [th05] Shinki: Pattern 9/11
The one where Shinki fires aimed purple 32×32 ball bullets, together
with symmetric rotating spreads from the left and right edges of her
wings whose angles rotate along ¾ of a circle.

Part of P0190, funded by nrook.
2022-05-01 00:22:03 +02:00
nmlgc 8b79dd5371 [Decompilation] [th05] Shinki: Pattern 8/11
The one where Shinki's white wings turn purple, and fire 16 purple
32×32 bullets after the color change.

For some reason, OMAKE.TXT says that these wings are black?!?

Part of P0190, funded by nrook.
2022-05-01 00:22:03 +02:00
nmlgc 55cd74326c [Decompilation] [th05] Shinki: Pattern 7/11
The one where Shinki walls off both the left and right edges of the
playfield with triangular walls out of spread bullets, and fires
cheetos inside the corridor.

Part of P0190, funded by nrook.
2022-05-01 00:22:03 +02:00
nmlgc 4ea60d1155 [Decompilation] [th05] Shinki: Pattern 6/11
The one where random blue 32×32 bullets rain from near the top of the
playfield, together with aimed spreads from random positions on
Shinki's wings. First white-wing pattern.

Part of P0190, funded by nrook.
2022-05-01 00:22:02 +02:00
nmlgc 3b21a75cab [Decompilation] [th05] Shinki: Pattern 5/11
The one where Shinki spawns her wings, which fire 50 quick random
bullets as soon as they appear. Featuring the first reliance on a piece
of state set by an earlier boss, which technically affects gameplay!

Part of P0190, funded by nrook.
2022-05-01 00:22:02 +02:00
nmlgc d3819445ba [Decompilation] [th05] Shinki: Pattern 4/11
The one where Shinki fires dense, aimed stacks of blue bullets in quick
succession, while flying to a random point.

I really, *really* don't want to believe that ZUN manually wrote these
micro-optimized setter functions that abuse the bullet template
structure layout, but I don't really have any other idea how to get
those out of the compiler…

Part of P0190, funded by nrook.
2022-05-01 00:22:02 +02:00
nmlgc 390976c24d [Decompilation] [th05] Shinki: Pattern 3/11
The one where Shinki fires random blue directional and kunai bullets
from her left and right side, while flying to a random point.

Part of P0190, funded by nrook.
2022-05-01 00:22:02 +02:00
nmlgc 4bd8e01c3d [Decompilation] [th05] Shinki: Gather circle intro for patterns in phases 2/3
Featuring something that looks like part of an unused pattern, but was
actually just copy-pasted from Yumeko. Some evidence for Shinki having
been coded after Yumeko, at least.

Part of P0190, funded by nrook.
2022-05-01 00:22:02 +02:00
nmlgc 3fc58928ec [Decompilation] [th05] Shinki: Pattern 2/11
The one where Shinki fires two simultaneous rings of blue bullets, with
the second one moving twice as fast.

Part of P0190, funded by nrook.
2022-04-30 17:44:15 +02:00
nmlgc 4ca195b6cb [Decompilation] [th05] Shinki: Pattern 1/11
The one where Shinki fires bullets in a ring, with each new ring fired
at an increasing or decreasing angle, for a curved effect. The first
pattern you see in the fight.

At least the pattern functions are short and sweet for the most part.

Part of P0190, funded by nrook.
2022-04-30 17:44:12 +02:00