Commit Graph

2072 Commits

Author SHA1 Message Date
nmlgc 37968b9c4b [Decompilation] [th01] YuugenMagan: Unused formula
(((a - b) × √3) / 2)? Mysterious.

Part of P0208, funded by GhostPhanom and Yanga.
2022-08-08 20:12:59 +02:00
nmlgc 6f05a1bbf8 [Reverse-engineering] [th01] YuugenMagan: Eye distances
Turns out that we can define the magic numbers used in the pentagram
shrink effect in terms of the distances between the eyes and the
pentagram's target position in the center of the playfield. Therefore,
specifying the eye positions in raw pixel coordinates won't give the
full picture (who would have thought).

Part of P0208, funded by GhostPhanom and Yanga.
2022-08-08 20:12:51 +02:00
nmlgc c26ef4bdeb [Reverse-engineering] [th01] YuugenMagan: Eye sprite IDs
Completes P0207, funded by GhostPhanom.
2022-08-08 20:12:03 +02:00
nmlgc 813d54fd0d [Decompilation] [th01] Line bullets
Not really "lasers", as they're also what YuugenMagan's pentagram is
made out of.

Part of P0207, funded by GhostPhanom.
2022-08-08 20:11:57 +02:00
nmlgc abe7d4f1ba [Maintenance] [th01] Pellets: Clarify the bounce-from-top motion types
They really are no different from regular pellet motion until they
reach the top of the playfield. Also, part 2 of 5a8bbd2.

Part of P0207, funded by GhostPhanom.
2022-08-08 20:11:51 +02:00
nmlgc 11dd60e67e [Maintenance] [th01] Define select_for_rank() as `static`
Part of P0207, funded by GhostPhanom.
2022-08-08 20:11:45 +02:00
nmlgc 45a9463def [Maintenance] [th01] Elis: Move pattern data section before the *_load() call
That's the same place it is (and will be) declared for all other
bosses in this game.

Part of P0207, funded by GhostPhanom.
2022-08-08 20:11:38 +02:00
nmlgc 2db58cb3d9 [Maintenance] [th01] Boss entities: Rewrite the entity array as 5 variables
Nooooo, the static initialization code proves that `boss_entities`
couldn't have been an array in ZUN's code! 😢 Which in turn explains
why YuugenMagan's and Elis' code looks the way it does. We could go
into undefined behavior territory and just cast `boss_entity_0` to a
pointer, but let's better not annoy future port authors just for my
personal convenience. In turn, we need to get a bit clever with some of
Elis' code to replace the now wholly redundant `elis_entity_t` type,
but it's not all too bad.

Part of P0207, funded by GhostPhanom.
2022-08-08 20:11:33 +02:00
nmlgc 55ced3bada [Naming] [th01] Boss entities: Clarify that the lock also applies to rendering
You don't get the full picture of YuugenMagan's rendering calls
otherwise.
It's also really stupid in how it trades performance for flickering.

Part of P0207, funded by GhostPhanom.
2022-08-08 20:11:27 +02:00
nmlgc fb72ea5be6 [Maintenance] [th01] Boss entities: Move Orb hitbox setter to collision section
Part of P0207, funded by GhostPhanom.
2022-08-08 20:11:22 +02:00
nmlgc e5ca2928d2 [Maintenance] [th01] Text mode functions: ZUN's proprietary attribute bits
Again (2113031), very helpful for debugging.

Part of P0207, funded by GhostPhanom.
2022-08-08 20:11:16 +02: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 57835690e8 [Maintenance] [th01] Move BSS data of FUUIN.EXE segments ≥4 to the data unit
Part of P0207, funded by GhostPhanom.
2022-08-08 20:11:05 +02:00
nmlgc c99f824f97 [Maintenance] Introduce color component constants
YuugenMagan will need them.

Part of P0207, funded by GhostPhanom.
2022-08-08 20:10:59 +02:00
nmlgc a10fe95b31 [Maintenance] Fix comment↔code associations
• Comments that describe all lines of code until a blank one are placed
  into the lines immediately above
• Comments that describe an entire demarcated block are placed
  immediately below the dash row at the top
• In any case, there should be a blank line after the top comment of
  a demarcated block, to keep IntelliSense-style systems from applying
  the block comment to the first actual line of code…
• …but there shouldn't be one before the dash row at the bottom, where
  it'd be redundant.

Part of P0207, funded by GhostPhanom.
2022-08-08 20:10:53 +02:00
nmlgc 386d9cd4cb [Contributing] Establish a more greppable convention for space-saving `union`s
How did I end up with x86 registers of all things?

Part of P0207, funded by GhostPhanom.
2022-08-08 20:10:47 +02:00
nmlgc 456768a4ff [Contributing] Define `struct`, `class` and `template` naming conventions
Again, these are what I've been mostly following, apart from a few
inconsistencies which this commit also fixes.

Part of P0207, funded by GhostPhanom.
2022-08-08 20:10:38 +02:00
nmlgc 454c105483 [Research] [th01] Konngara: Discover the cause behind the green discoloration
Yup, if it weren't for that one boss function periodically resetting
the palette to the other global one, this discoloration would be
permanent.

Completes P0206, funded by Yanga and [Anonymous].
2022-07-17 20:46:02 +02:00
nmlgc f629b45ce7 [Research] [th01] Mima: Explain the palette resets in the hop pattern
The source: The boss invincibility flash effect, which ends up
unconditionally resetting the palette periodically. But wait, could
that maybe…?

Part of P0206, funded by Yanga and [Anonymous].
2022-07-17 20:46:02 +02:00
nmlgc fa46d71f2e [Decompilation] [th01] Merge segment 32 into a single translation unit
Part of P0206, funded by Yanga and [Anonymous].
2022-07-17 20:46:02 +02:00
nmlgc f933b619b5 [Decompilation] [th01] Mima: Move all data to C land
7th PC-98 Touhou boss completely decompiled, 24 to go!

Part of P0206, funded by Yanga and [Anonymous].
2022-07-17 20:46:02 +02:00
nmlgc 04d12e8d5f [Decompilation] [th01] Mima: Main function
Part of P0206, funded by Yanga and [Anonymous].
2022-07-17 20:32:20 +02:00
nmlgc 6fb3f11c98 [Decompilation] [th01] Mima: Pattern 8/8
The one where ZUN finally uses the corner points for the current frame
as the spawn point for Mima's aimed lasers. 60 functions remaining in
TH01!

Part of P0206, funded by Yanga and [Anonymous].
2022-07-17 20:26:51 +02:00
nmlgc 0d85cfa44d [Decompilation] [th01] Mima: Pattern 7/8
The one where Mima sprays slow pellets from the corner points of the
rotating square around her from 8 frames ago, aimed in a half-circle
motion from her left to her right side and back.

Part of P0206, funded by Yanga and [Anonymous].
2022-07-17 20:23:28 +02:00
nmlgc 33481c857e [Decompilation] [th01] Mima: Pattern 6/8
The one where Mima fires missiles from the corner points of the
rotating square around her from 8 frames ago, aimed along a static
downwards half-circle from her right to her left side, with 16 frames
between the individual missile groups.

Part of P0206, funded by Yanga and [Anonymous].
2022-07-17 20:19:01 +02:00
nmlgc e2c82d8ebe [Decompilation] [th01] Mima: Pattern 5/8
The one where Mima spawns 8 flame pillars, 20 frames apart, at very
specifically calculated random positions, followed by an aimed 3-spread
after each pillar has reached its maximum height.

Part of P0206, funded by Yanga and [Anonymous].
2022-07-17 20:16:12 +02:00
nmlgc 6b1329d6cf [Decompilation] [th01] Mima: Flame pillar rendering
Part of P0206, funded by Yanga and [Anonymous].
2022-07-17 20:15:54 +02:00
nmlgc 327730fca5 [Decompilation] [th01] Mima: Pattern 4/8
The one where Mima hops over ⅕ of the playfield 4 times in a row,
starting at either the left or right edge, while darkening the screen…
or not?

Completes P0205, funded by [Anonymous] and Yanga.
2022-07-17 20:09:42 +02:00
nmlgc 1772a2907a [Decompilation] [th01] Mima: Pattern 3/8
The one where Mima takes the final static part from the first pattern,
and replicates it with two squares that rotate in opposite directions.
Also demonstrates the 34th unblitting bug in this game.

Part of P0205, funded by [Anonymous] and Yanga.
2022-07-17 20:05:47 +02:00
nmlgc 12eb04cc9c [Decompilation] [th01] Mima: Pattern 2/8
The one where Mima spawns missiles from the corner points of the
rotating square around her from 8 frames ago, aimed to Reimu's position
before any missiles were spawned.

Part of P0205, funded by [Anonymous] and Yanga.
2022-07-17 20:03:00 +02:00
nmlgc 6a6b800882 [Decompilation] [th01] Mima: Pattern 1/8
The one where Mima spawns aimed and later static pellets from the
corner points of the rotating square around her from 8 frames ago.

Part of P0205, funded by [Anonymous] and Yanga.
2022-07-17 19:57:42 +02:00
nmlgc 5896752e93 [Decompilation] [th01] Mima: Regular polygon construction
Looks like we've got another massive copy-pasta incoming…

Part of P0205, funded by [Anonymous] and Yanga.
2022-07-17 19:56:36 +02:00
nmlgc 03b6288083 [Naming] [th01] Mima: Generic pattern state variable
Part of P0205, funded by [Anonymous] and Yanga.
2022-07-17 19:55:10 +02:00
nmlgc a0096e19c1 [Pipeline] bmp2arr: Emit 16- and 32-bit arrays in C++ mode
Part of P0205, funded by [Anonymous] and Yanga.
2022-07-17 19:48:40 +02:00
nmlgc 3ea61a8fa7 [Pipeline] bmp2arr: Emit trailing commas in C modes
Part of P0205, funded by [Anonymous] and Yanga.
2022-07-17 19:46:54 +02:00
nmlgc 73670108ae [Pipeline] bmp2arr: Add a C++ output format
This one will use the DotRect template from `planar.h` and generate a
single 16- or 32-dot value per row. Since this converter has a goal of
maximum portability, it makes sense to keep raw the multidimensional
C-style arrays around as a possible output format.

Part of P0205, funded by [Anonymous] and Yanga.
2022-07-17 19:45:14 +02:00
nmlgc caf48cf3ef [Pipeline] bmp2arr: Move C type generation into a single function
Part of P0205, funded by [Anonymous] and Yanga.
2022-07-17 19:40:36 +02:00
nmlgc 47dc6a6285 [Pipeline] bmp2arr: Support sprite widths of 32 pixels
It's more appropriate to have a single check in the task verification
code.

Part of P0205, funded by [Anonymous] and Yanga.
2022-07-17 19:35:33 +02:00
nmlgc 44f52c07f0 [Maintenance] "Properly" work around playfield fraction inaccuracies
Part of P0205, funded by [Anonymous] and Yanga.
2022-07-17 19:34:48 +02:00
nmlgc f8a8ea6dda [Maintenance] Implement constrained random numbers for playfield coordinates
It's been popular with ≥TH02's randring functions, let's do the same
for the playfield.

Part of P0205, funded by [Anonymous] and Yanga.
2022-07-17 19:34:14 +02:00
nmlgc 7070e5f1fa [Maintenance] Return random playfield positions as screen-space coordinates
Part of P0205, funded by [Anonymous] and Yanga.
2022-07-17 19:32:35 +02:00
nmlgc 01fb8529ef [Maintenance] [th01] Bosses: Rewrite shot hitboxes in a visually correct way
Part of P0205, funded by [Anonymous] and Yanga.
2022-07-17 19:29:26 +02:00
nmlgc cac520e466 [Maintenance] [th01] Bosses: Rewrite Orb hitboxes in a visually correct way
You know that things are complicated when you have to resort to Unicode
box drawing character art to explain how two hitboxes relate to each
other. I *hope* this makes enough sense, and that I won't be rewriting
this in terms of ORB_W and ORB_H after all in the future. For now
though, it's immediately obvious when the hitbox reaches outside the
entity. In the case of YuugenMagan, it even simplifies the coordinates
so much that we don't need separate constants.

Part of P0205, funded by [Anonymous] and Yanga.
2022-07-17 19:29:04 +02:00
nmlgc 853952b610 [Maintenance] [th01] Boss entities: The hitbox method relates to the *orb*
I keep getting confused when reading the code.

Part of P0205, funded by [Anonymous] and Yanga.
2022-07-17 19:27:47 +02:00
nmlgc c6e51f7545 [Maintenance] [th01] Clean up pellet headers
Part of P0205, funded by [Anonymous] and Yanga.
2022-07-17 19:26:54 +02:00
nmlgc f6d264aa6e [Maintenance] Publicly declare decimal subpixels
They are not exclusive to Sariel after all…

Part of P0205, funded by [Anonymous] and Yanga.
2022-07-17 19:26:06 +02:00
nmlgc 3259190530 [Readme] Update branch overview
`th01_orb_debug` now also shows the frames since the last collision
with every bumper bar.
2022-07-12 07:59:01 +02:00
nmlgc 0ae642056c [Research] [th01] Document the inadequacy of bumper bar collision handling
The flag that blocks collision handling for vertical bars might prevent
some of the potential glitches here, but definitely not all of them.
Thanks to touhou-memories for bringing this to my attention, this was
indeed a glaring omission.
2022-07-12 07:49:54 +02:00
nmlgc 0c682b5bc0 [Maintenance] Declare the optimization_barrier() a single time
And put that single instance into the compiler optimization workaround
section of `decomp.hpp`.

Part of P0204, funded by [Anonymous].
2022-07-10 13:45:18 +02:00
nmlgc 3e79deeb3a [Contributing] Define function brace placement rules
I've been following them pretty consistently for a while now, time to
finally write them down.

Part of P0204, funded by [Anonymous] and Yanga.
2022-07-10 13:45:18 +02:00