Commit Graph

1776 Commits

Author SHA1 Message Date
nmlgc e6979070ce [Decompilation] [th01] Elis: Girl sprite unblitting and background snapping
Completes P0166, funded by Ember2528.
2021-11-07 23:15:24 +01:00
nmlgc aeb7fb48aa [Decompilation] [th01] Elis: Sprite loading
In which all the declarations expand the C++ code to take up more lines
than the previous compressed ASM representation.

Part of P0166, funded by Ember2528.
2021-11-07 23:14:13 +01:00
nmlgc e0ecc6bdc0 [Decompilation] [th01] Elis: Initial variables
Part of P0166, funded by Ember2528.
2021-11-07 23:11:52 +01:00
nmlgc 1b1e926cc7 [Naming] [th01] Bosses: Post-defeat-flash palette
Part of P0166, funded by Ember2528.
2021-11-07 23:10:18 +01:00
nmlgc e9af8c91db [Decompilation] [th01] Elis: Sprite freeing
Part of P0166, funded by Ember2528.
2021-11-07 23:08:44 +01:00
nmlgc 6217e51efb [Decompilation] [th01] Elis: Wavy teleport animation
The one with the yellow random stars on top of Elis.

And you know what, I'm just going to accept these incorrect 4 bytes
temporarily. The easy workaround for the three calls in the first
conditional branch inverts the order of that branch and the next one
in the generated ASM, and working around *that* will cause a
disproportionately greater mess. The code generation here is
semantically equivalent to the original ASM, doesn't add or remove a
single byte, and the issue is going to fix itself 5 commits from now.

Part of P0166, funded by Ember2528.
2021-11-07 23:07:22 +01:00
nmlgc 5e8ed65c04 [Naming] [th01] Elis: Girl sprite unblitting and background snapping
In which ZUN wanted to use a parameter to distinguish between taking
the position from Stationary-Or-Wavy-Elis and Attacking-Elis, but then
sets the latter's position to the former's before doing anything with
that parameter.

Part of P0166, funded by Ember2528.
2021-11-07 23:05:58 +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 57de750f6b [Decompilation] [th01] .PTN: Rectangular access macros
Part of P0166, funded by Ember2528.
2021-11-07 23:02:58 +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 9cf3006d4a [Maintenance] [th01] Konngara: Move entity freeing closer to the alias macros
Part of P0165, funded by Ember2528.
2021-11-07 22:55:32 +01:00
nmlgc aaa0ebec92 [Decompilation] [th01] Missiles: Reset function
Due to mixed float/double arithmetic in both of the two remaining
functions, this is all missile code we can meaningfully decompile
right now.

Part of P0165, funded by Ember2528.
2021-11-07 22:54:12 +01:00
nmlgc b4a64324fe [Decompilation] [th01] Missiles: Unput/update/render function
And that's why these feel so awful in-game: Interlaced rendering, and
an unfair 46×46 hitbox around Reimu's center point.

Part of P0165, funded by Ember2528.
2021-11-07 22:52:43 +01:00
nmlgc bce77062c9 [Reverse-engineering] [th01] Missiles: Structure
Another 150 bytes wasted on unused structure members… and if you
already use a SoA layout, you could have also squeezed the flags into 2
bits per entity rather than 8, which would have saved another 37 bytes.

Part of P0165, funded by Ember2528.
2021-11-07 22:51:24 +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 5fa2a4da09 [Maintenance] [th01] .GRC: Define the slot count in terms of used slot IDs
Part of P0165, funded by Ember2528.
2021-11-07 22:49:27 +01:00
nmlgc b28585efa0 [Maintenance] [th01] .PTN: Define the slot count in terms of used slot IDs
There's a reason why the game reserves memory for exactly this many,
after all. This way, we also stop pretending that the game's use of
.PTN is neatly decoupled from the format's interface…

Part of P0165, funded by Ember2528.
2021-11-07 22:48:07 +01:00
nmlgc e39e5cd73e [Decompilation] [th01] Bombs: Damage condition
Frame 100 in the overall animation, frame 40 during the damaging part.

Part of P0165, funded by Ember2528.
2021-11-07 22:42:41 +01:00
nmlgc 7cc0189439 [Decompilation] Move palette loops to common macros
You'd really want to overload `operator =` for those.

Part of P0165, funded by Ember2528.
2021-11-07 22:41:39 +01:00
nmlgc 629bf7b08e [Naming] [th01] Drop the redundant `_all()` suffix on manager class methods
Part of P0165, funded by Ember2528.
2021-11-07 22:40:34 +01:00
nmlgc 7a0e5d8d85 [Decompilation] [th01] Player: Miss animation
And even the final function in this 3-push series comes with a
potential visual glitch…

Completes P0164, funded by Yanga.
2021-10-20 10:59:36 +02:00
nmlgc f1fdc3e3fd [Decompilation] [th01] Move shot combo start code into an inline function
At least one additional piece of code where this makes sense, and only
became possible after the last commit.

Part of P0164, funded by Yanga.
2021-10-20 10:59:36 +02:00
nmlgc ec4e541ee7 [Decompilation] [th01] Player: Orb collision and repulsion handling
Properly decompiling the calls to this function from the previous one
allows us to get rid of seemingly unrelated `goto`s there.

Part of P0164, funded by Yanga.
2021-10-20 10:59:36 +02:00
nmlgc 6d572b33cf [Decompilation] [th01] Player: Main control and rendering function
Yup, what a giant, unstructured mess. Enjoy the 85 conditional
branches.

Completes P0163, funded by Ember2528.
2021-10-20 10:59:36 +02:00
nmlgc fa77fcfa36 [Reverse-engineering] [th01] Player: Orb collision and repulsion constants
Part of P0163, funded by Ember2528.
2021-10-20 09:25:32 +02:00
nmlgc 326128dbde [Reverse-engineering] [th01] Player: Movement and attack modes and submodes
> direction merged into special attack enum
> direction outside special attack using a different enum
> both are stored in a single overloaded variable
> separate variable for direction only used during dashes, but only
  pointlessly, in addition to the other one

That function's gonna be terrible.

Part of P0163, funded by Ember2528.
2021-10-20 09:25:32 +02:00
nmlgc 24b3a0d37d [Reverse-engineering] [th01] Player: MIKO_AC.BOS and MIKO_AC2.BOS sprite IDs
Completes P0162, funded by Ember2528.
2021-10-20 09:25:32 +02:00
nmlgc 1dde208a92 [Reverse-engineering] [th01] Player: MIKO.PTN sprite IDs
Hooray, separate sprites for facing left and right. That huge function
would have probably been less than half as long if ZUN just implemented
sprite mirroring, but doing that on PC-98 might have been just a
little bit *too* nontrivial for a first game. (At least he did it in
TH03, where he couldn't get away with pre-mirrored sprites.)

Part of P0162, funded by Ember2528.
2021-10-20 09:24:55 +02:00
nmlgc 8d6ab75353 [Naming] [th01] Reduce CPlayerAnim instances to their width and height
Everything about these is bad, including my previous attempt at naming
them. The "forward" instance also contains the flip kick animations
(facing sideways), and MIKO.PTN also contains animations. Those sprite
sizes really are the only reason why those needed to exist at all, so
why pretend that they fulfill some higher semantic reason?

Part of P0162, funded by Ember2528.
2021-10-20 00:06:16 +02:00
nmlgc be29850887 [Maintenance] [th01] Rename the resident debug flags
MODE_REGULAR is an awfully generic name for a global constant.

Part of P0162, funded by Ember2528.
2021-10-20 00:06:16 +02:00
nmlgc c4a0eb6aff [Maintenance] [th01] Change the left/right input flags to an enum
The big player control function uses a separate variable of this type.

Part of P0162, funded by Ember2528.
2021-10-20 00:06:16 +02:00
nmlgc 8db3dd2919 [Build] Don't compile any ZUN code directly to `bin/`
I've long moved to a convention of putting every .OBJ compiled from ZUN
code into the subdirectory of the game that introduced it. These four
are the last remaining inconsistencies from earlier in development.

Part of P0162, funded by Ember2528.
2021-10-20 00:06:16 +02:00
nmlgc 81dd96e4f4 [Research] Discover how `SCOPY@` disables Turbo C++ stack cleanup optimization
Yup, it's a compiler bug, and it removes a small bit of freedom as far
as decompilation order is concerned. In particular, this means that we
can't do TH01's continue and pause menus before having decompiled the
bomb animation.
Would have been nice to pad out the previous push with those, but
instead, I had to spend way too much time figuring *this* out…

Completes P0161, funded by [Anonymous].
2021-10-09 23:28:22 +02:00
nmlgc 44d1389835 [Research] Discover how producing line numbers (`-y`) slightly optimizes jumps
Yes, seriously. Not something we actually need right now, but who
knows!

Part of P0161, funded by [Anonymous].
2021-10-09 23:27:59 +02:00
nmlgc a317cb49fc [Maintenance] Fix another bunch of accumulated typos
Part of P0161, funded by [Anonymous].
2021-10-09 23:26:02 +02:00
nmlgc b9f1fefb84 [Maintenance] [th01] Remove the last traces of `#pragma option -b`
Part of P0161, funded by [Anonymous].
2021-10-09 23:26:01 +02:00
nmlgc 42ba4a5725 [Decompilation] [th01] Particle system
Only seen in Mima's fight, but initialized for all non-final boss
fights. Also with explicit support for all 8 origin edges, not just the
top-right one used in Mima's fight… and an off-by-one error?!

Completes P0160, funded by Yanga.
2021-10-09 23:25:59 +02:00
nmlgc b6e07e301a [Decompilation] [th01] HUD: Background snapping and initial rendering
Part of P0160, funded by Yanga.
2021-10-09 23:23:46 +02:00
nmlgc c1ae914b99 [Decompilation] [th01] Stage timer: Initial values
Hardcoded for every one of the 35 stages.

Part of P0160, funded by Yanga.
2021-10-09 23:20:04 +02:00
nmlgc 6c98e473cc [Decompilation] [th01] Stage timer: Background snapping and initial rendering
Part of P0160, funded by Yanga.
2021-10-09 23:20:04 +02:00
nmlgc afd5707561 [Decompilation] [th01] Stage timer: Tick, extend, and render functions
Oh hey, another HUD element that is needlessly (and slowly) drawn to
VRAM. The custom boldfaced font would have been a perfect fit for
gaiji… well, OK, halfwidth gaiji weren't exactly well documented back
then.

Part of P0160, funded by Yanga.
2021-10-09 23:20:04 +02:00
nmlgc a2c06fbd2b [Maintenance] [th01] HUD: Rename *_initial() to *_bg_snap_and_put()
After all, these are called again during all of Sariel's background
changes, not really just when starting a scene or boss battle.

Part of P0160, funded by Yanga.
2021-10-09 23:20:04 +02:00
nmlgc ea0997ab38 [Decompilation] [th01] Pellet speed modification
Category: Function comment spells out entire function code because its
effects are impossible to summarize

Part of P0160, funded by Yanga.
2021-10-09 23:20:02 +02:00
nmlgc 2f9304781f [Maintenance] [th01] Split segment #1 before the pellet speed modification code
There might only be three functions between the second and new third
split, but these seem to depend on the entire rest of the code for
card-flipping stages…

Part of P0160, funded by Yanga.
2021-10-08 18:39:04 +02:00
nmlgc e491cd7b03 [Decompilation] [th01] Stage objects: Card update and rendering
Including firing the revenge pellets on Lunatic. And that's all
non-boilerplate card code done as well!

Completes P0159, funded by Yanga.
2021-09-28 18:05:25 +02:00
nmlgc 36068acb02 [Decompilation] [th01] Stage objects: Card score popup rendering
Part of P0159, funded by Yanga.
2021-09-28 18:05:25 +02:00
nmlgc 4c500599a9 [Decompilation] [th01] Stage objects: Card/Orb collision handling
An X/Y point structure, in my TH01? And another actually logical
hitbox? (Rest of the code's still bad, though.)

Part of P0159, funded by Yanga.
2021-09-28 18:05:25 +02:00