Commit Graph

38 Commits

Author SHA1 Message Date
nmlgc 515b4c6315 [Decompilation] [th01] YuugenMagan: Move all data to C land
And that's it! All TH01 bosses fully decompiled, which makes 8 PC-98
Touhou bosses in total with 23 to go! And now, time to move a whole lot
of other data…

Completes P0210, funded by Arandui and Yanga.
2022-08-08 20:15:10 +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 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 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 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 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 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 6f2881f056 [Maintenance] Remove `extern "C"` from more areas of code
The .PTN functions, vector functions, and egc_copy_rect_1_to_0_1()
(finally!) from TH01, as well as playfld.hpp from all games(finally!),
together with a bunch of other functions in their vicinity.

Part of P0201, funded by Ember2528 and Yanga.
2022-06-24 23:28:19 +02:00
nmlgc f4785a2577 [Maintenance] [th01] Boss entities: Declare dummy clamp parameters as defaults
Part of P0201, funded by Ember2528 and Yanga.
2022-06-24 22:53:28 +02:00
nmlgc 124f68946a [Maintenance] [th01] Boss entities: Force `bos_image` through a getter method
Noooo, SinGyoku will in fact prove the existence of this getter method
via the given code generation detail. Might as well go fully consistent
then and exclusively use the methods, ending the previous party time.

Part of P0201, funded by Ember2528 and Yanga.
2022-06-24 22:50:24 +02:00
nmlgc 7bdf35a22b [Maintenance] [th01] Remove `extern "C"` from more areas of code
The .BOS freeing funtions, others that are close to them in the typical
#include order, and the ending picture functions.

Part of P0198, funded by Lmocinemod and Ember2528.
2022-06-16 22:51:07 +02: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 920274f3d6 [Decompilation] [th01] Mima: Sprite loading
Part of P0167, funded by Ember2528.
2021-11-07 23:18:47 +01:00
nmlgc 61005a6deb [Decompilation] [th01] Mima: Sprite blitting
Part of P0167, funded by Ember2528.
2021-11-07 23:17:01 +01:00
nmlgc 256d699b82 [Decompilation] [th01] Mima: Boss sprite unblitting and background snapping
Part of P0166, funded by Ember2528.
2021-11-07 23:04:20 +01:00
nmlgc f2bca016e2 [Decompilation] [th01] Mima: Spread-in animation
Completes P0165, funded by Ember2528.
2021-11-07 23:01:21 +01:00
nmlgc f2d55e78bf [Decompilation] [th01] Mima: Broken vertical sprite transition
Also effectively unused.

Part of P0165, funded by Ember2528.
2021-11-07 22:58:54 +01:00
nmlgc 0aaa021c95 [Decompilation] [th01] Mima: Initial variables
Part of P0165, funded by Ember2528.
2021-11-07 22:57:58 +01:00
nmlgc b517bd3502 [Decompilation] [th01] Mima: Sprite freeing
Part of P0165, funded by Ember2528.
2021-11-07 22:56:50 +01:00
nmlgc 7bf183621c [Reverse-engineering] [th01] Bosses: .PTN slot IDs
Common sense: Entity backgrounds always go into slot X, missile sprites
into slot Y, and wave sprites into slot Z
ZUN: "Nah, let's set aside two slots, and bosses can just freely use
them as they want 🎺"

Part of P0165, funded by Ember2528.
2021-11-07 22:50:28 +01:00
nmlgc a99eb4ed44 [Decompilation] [th01] select_for_rank: Don't redeclare the rank variable
Otherwise, it gets quite annoying to use that variable in the rest of
the translation unit.

Part of P0153, funded by Ember2528.
2021-08-22 15:07:17 +02:00
nmlgc dc9e3ee475 [Decompilation] [th01] Bosses: Collision handling
Functions with 12 parameters are hard to describe, y'know. Looking
forward to decompiling these giant expressions for the actual
boss↔orb collision parameter passed to this function…

Oh well, at least we're now totally ready for some boss code next
year. 😌

Completes P0131, funded by Yanga.
2020-12-18 01:38:52 +01:00
nmlgc d5fd70c458 [Decompilation] [th01] HUD: HP rendering
And we're right back to things not being nice. Because yeah, why
shouldn't these three distinct rendering functions be part of a single
function, selected by magic numbers?
Or why shouldn't the 16×16 wrapper around a 32×32 set of graphics
functions be used to handle backgrounds for 16×8 sprites, resulting in
needlessly complex parameter calculations that lead to sloppy code?

Part of P0131, funded by Yanga.
2020-12-18 01:38:48 +01:00
nmlgc 64f872e5c5 [Decompilation] [th01] Difficulty-based value selection
And with that, TH01 is pushed over the 50% completion mark! 🎉

This time, it's only YuugenMagan who gets no own copy. Giant RE% gains
from all these calls, but let's hope I don't regret already decompiling
this one for all bosses. It's not quite at the beginning of SinGyoku's,
Mima's, and Elis' code segment, after all…

Part of P0130, funded by Yanga.
2020-12-18 00:59:41 +01:00