Commit Graph

650 Commits

Author SHA1 Message Date
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 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 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
nmlgc 7b6090110f [Maintenance] [th01] Cards: Merge segment 30 code into a single source file
The fact that the game insists on this translation unit is already bad
enough – thanks to the static constructor for the CCards and CObstacles
instances, we can't merge it with segment 31. Just `#include`ing
str_val.cpp here is much less bad than having more than one extra
source file.

Part of P0204, funded by [Anonymous] and Yanga.
2022-07-10 13:45:17 +02:00
nmlgc 3a97e3f846 [Maintenance] [th01] Move integer→string conversions to the `math/` directory
The nondescript nature of `core/` has been annoying me for a while, and
these function kind of are number-related after all.

Part of P0204, funded by [Anonymous] and Yanga.
2022-07-10 13:37:56 +02:00
nmlgc 39da5da2ea [Decompilation] [th01] Bomb animation
And that's 50% of all PC-98 Touhou game code RE'd! 🎉

Also, 70 functions remaining in TH01.

Part of P0204, funded by [Anonymous] and Yanga.
2022-07-10 13:36:35 +02:00
nmlgc 9cfb0a791d [Decompilation] [th01] Stage objects: Move all data to C land
Part of P0204, funded by [Anonymous] and Yanga.
2022-07-10 13:31:38 +02:00
nmlgc b539336ed3 [Decompilation] [th01] Stage objects: Portal update/render/reset function
Part of P0204, funded by [Anonymous] and Yanga.
2022-07-10 13:29:11 +02:00
nmlgc 86cdf5f655 [Decompilation] [th01] Stage objects: Turret fire/reset function
Completes P0203, funded by [Anonymous] and GhostRiderCog.
2022-07-10 13:28:38 +02:00
nmlgc f85587dda4 [Decompilation] [th01] Stage objects: Main obstacle update/render function
In which ZUN needs a hack to make columns of vertical bumper bars work
at all with the way the Orb's X velocity is implemented… and may have
just deliberately ensured that the Orb can definitely loop infinitely
between two bumpers.

(Those two wrong NOPCALLs aren't worth working around. It would
basically require taking apart the entire function, and they'll be gone
by the next two commits anyway.)

Part of P0203, funded by [Anonymous] and GhostRiderCog.
2022-07-10 13:28:27 +02:00
nmlgc 8a92de7b27 [Reverse-engineering] [th01] Stage objects: Per-type obstacle frame semantics
Part of P0203, funded by [Anonymous] and GhostRiderCog.
2022-07-10 13:14:49 +02:00
nmlgc e86a6ca88b [Naming] [th01] Stage objects: Rename the background+object blitting function
All throughout this codebase, `X_put_8()` implies that just the single
sprite of X is blitted on top of whatever is in VRAM at the given
position. This function blits more than one sprite though. (Also,
portal rendering is going to introduce a helper function that does only
blit a single thing.)

Part of P0203, funded by [Anonymous] and GhostRiderCog.
2022-07-10 13:13:54 +02:00
nmlgc 05b28f709b [Maintenance] [th01] Orb: Don't make the Y velocity publically available
The fact that it's only mutated internally by applying a force on the
Orb is going to become very relevant.

Part of P0203, funded by [Anonymous] and GhostRiderCog.
2022-07-10 13:13:15 +02:00
nmlgc 711af96314 [Maintenance] [th01] Move STAGE?.DAT loading declaration to `stages.hpp`
Removes the dependency on the STAGE?.DAT format from some bosses.

Part of P0203, funded by [Anonymous] and GhostRiderCog.
2022-07-10 13:11:28 +02:00
nmlgc 2113031a27 [Maintenance] [th01] Declare z_text_vputsa()
It's been highly useful for debug output at specific screen positions
for a number of times now.

Part of P0203, funded by [Anonymous] and GhostRiderCog.
2022-07-10 13:11:20 +02:00
nmlgc 001033d15a [Maintenance] [th01] Remove `extern "C"` from more areas of code
The .GRC and .GRP functions, to be specific.

Part of P0203, funded by [Anonymous] and GhostRiderCog.
2022-07-10 13:09:12 +02:00
nmlgc bca1b7d38a [Maintenance] Add a `nullptr` polyfill to platform.h
Which allows us to remove <stddef.h> from translation units that just
needed it for `NULL`.

Part of P0203, funded by [Anonymous] and GhostRiderCog.
2022-07-10 13:02:51 +02:00
nmlgc 4568bf7383 [Decompilation] [th01] Particles / HUD HP / Missiles: Move data to C land
…including those.

Completes P0202, funded by [Anonymous] and Yanga.
2022-06-25 18:21:09 +02:00
nmlgc 3f52d9a16f [Decompilation] [th01] YuugenMagan: Sprite loading and initial variables
Doing this one now allows us to completely get rid of a bunch of ASM
land declations…

Part of P0202, funded by [Anonymous] and Yanga.
2022-06-25 18:21:08 +02:00
nmlgc 988cf64bf3 [Decompilation] [th01] Missiles: Spawn function + Sprite selection by angle
The latter being the dumbest, most decadent piece of FPU abuse in this
game. But it works 🤷

Part of P0202, funded by [Anonymous] and Yanga.
2022-06-25 18:21:08 +02:00
nmlgc 68ace9c126 [Decompilation] [th01] SinGyoku: Move all data to C land
6th PC-98 Touhou boss completely decompiled, 25 to go!

Part of P0202, funded by [Anonymous] and Yanga.
2022-06-25 18:21:08 +02:00
nmlgc 50f58a6045 [Decompilation] [th01] SinGyoku: Main function
80 functions remaining in TH01, and less than 10,000 ASM instructions
remaining in REIIDEN.EXE!

Part of P0202, funded by [Anonymous] and Yanga.
2022-06-25 18:21:08 +02:00
nmlgc 40d9348c86 [Decompilation] [th01] SinGyoku: Transformations for patterns 5 and 6
Then again, this more flexible architecture points towards SinGyoku's
male form potentially having had way more varied patterns earlier in
development… or planned, but never realized.

Part of P0202, funded by [Anonymous] and Yanga.
2022-06-25 18:21:08 +02:00
nmlgc a3364e8f60 [Decompilation] [th01] SinGyoku: Pattern 6/6
The one where SinGyoku's male form fires 3 sets of 10 aimed sling
pellets from random locations within its sprite.

Part of P0202, funded by [Anonymous] and Yanga.
2022-06-25 18:21:08 +02:00
nmlgc 1020bbba56 [Decompilation] [th01] SinGyoku: Pattern 5/6
The one where SinGyoku's male form fires 3×10 pellets at random
downwards angles.

Part of P0202, funded by [Anonymous] and Yanga.
2022-06-25 18:21:08 +02:00