Commit Graph

1709 Commits

Author SHA1 Message Date
nmlgc b95450b026 [Maintenance] Remove the .ALPHA segment ordering workaround
We could have just abused the _TEXT segment all this time?!

Part of P0172, funded by [Anonymous] and Blue Bolt.
2021-12-27 01:06:26 +01:00
nmlgc 4d8392ce9c [Maintenance] [th03/th04/th05] Rename `playchars_t` to `playchar_t`
Part of P0172, funded by [Anonymous] and Blue Bolt.
2021-12-27 00:52:20 +01:00
nmlgc 5fac2006ff [Maintenance] Consistently use "score" instead of "points"
Or at least in addition.

Part of P0172, funded by [Anonymous] and Blue Bolt.
2021-12-27 00:50:39 +01:00
nmlgc e95ff108e3 [Maintenance] [th01] Remove no longer used score declarations in ASM land
Part of P0172, funded by [Anonymous] and Blue Bolt.
2021-12-27 00:47:56 +01:00
nmlgc 49e67893cf [Badges] Add the new set of finalization badges
Part of P0171, funded by [Anonymous].
2021-12-16 00:30:12 +01:00
nmlgc 479b76609a [Decompilation] [th05] EMS / Dialog: Exit function
Only reloads the bomb background image from either the EMS area or disk
in this game. Plain and simple.

Completes P0169, funded by Blue Bolt.
2021-11-29 02:01:10 +01:00
nmlgc 9ae4f7726e [Decompilation] [th05] EMS / Dialog: Face loading and rendering
Aha! TH05 actually loads every single rendered dialog image
individually before rendering it, either from the EMS area or disk.
That's one way to save memory, I guess?

Part of P0169, funded by Blue Bolt.
2021-11-29 02:01:10 +01:00
nmlgc 90a2e367bc [Decompilation] [th04] EMS / Dialog: Exit function
That's where TH04 crashes in Stage 5 without an EMS driver, but the
code is fine?! (Well, apart from its silly behavior in the Extra
Stage.)

Part of P0169, funded by Blue Bolt.
2021-11-29 02:01:10 +01:00
nmlgc 7673456ab3 [Decompilation] [th04] EMS / Dialog: Loading the remaining images
What the hell is TH05 doing there…?

Part of P0169, funded by Blue Bolt.
2021-11-29 02:01:10 +01:00
nmlgc d48479ce1b [Reverse-engineering] [th04/th05] Dialog: Face unblitting
TH01-style unblitting from the back page of VRAM, in my TH04/TH05?!
It does make sense to suspend double buffering during dialog though,
and you probably don't want to call any custom stage rendering
functions just to effectively unblit a 128×128 pixel area.

Part of P0169, funded by Blue Bolt.
2021-11-29 02:01:10 +01:00
nmlgc a1ebba2fae [Reverse-engineering] [th04/th05] Dialog: Currently speaking side
Part of P0169, funded by Blue Bolt.
2021-11-29 02:01:09 +01:00
nmlgc 1b3755c592 [Maintenance] [th04/th05] Dialog: Move UI code to a subdirectory under main/
Why did I put all that under formats/?! This doesn't even contain
anything about the format yet.

Part of P0169, funded by Blue Bolt.
2021-11-29 02:01:09 +01:00
nmlgc 8b046dad0f [Decompilation] [th04/th05] EMS: Rendering the eyecatch image
Copied in from EMS memory if available.

Completes P0168, funded by Blue Bolt and rosenrose.
2021-11-29 02:01:01 +01:00
nmlgc bd77463f59 [Decompilation] [th05] EMS: Preloading boss facesets
Oh, an EMS function that does one single thing, and is not potentially
bugged within TH05's original sprite limits?! (Although that last part
might have just been a happy accident.)

Part of P0168, funded by Blue Bolt and rosenrose.
2021-11-29 02:00:58 +01:00
nmlgc 3e99a30c17 [Decompilation] [th04/th05] EMS: Preloading player character .CDG images
Stupid one-off functions deserve stupid names, Part 3. This time also
coming with an unnecessary precondition.

Part of P0168, funded by Blue Bolt and rosenrose.
2021-11-29 02:00:03 +01:00
nmlgc fe33d49e0a [Decompilation] [th04/th05] EMS: Allocation + Preloading the eyecatch image
No, I'm not copying exactly what was on ZUN's monitor during the 2010
MAG・ネット documentary. Also, this one was very lucky not to receive
a stupid function name.

Part of P0168, funded by Blue Bolt and rosenrose.
2021-11-29 01:53:43 +01:00
nmlgc ccca7bf6ee [Reverse-engineering] [th04/th05] EMS: Cache area layout
Part of P0168, funded by Blue Bolt and rosenrose.
2021-11-29 01:53:13 +01:00
nmlgc 9c99bc0eb1 [Contributing] Don't enforce preservation of symbol names from leaked ZUN code
We can do much better ourselves.

Part of P0168, funded by Blue Bolt and rosenrose.
2021-11-28 21:51:28 +01:00
nmlgc 488115513c [Maintenance] master.hpp transition: EMS functions
Part of P0168, funded by Blue Bolt and rosenrose.
2021-11-28 19:15:22 +01:00
nmlgc dbd9e23bf9 [Maintenance] [th04/th05] Split segment #1 before the EMS functions
Well, except for GameCore(), which has nothing of interest.

Part of P0168, funded by Blue Bolt and rosenrose.
2021-11-28 19:15:22 +01:00
nmlgc 99aee2bdbe [Maintenance] Consistently use singular for entity structure and file names
Not too sure about "chars" yet, with TH03 and all.

Part of P0168, funded by Blue Bolt and rosenrose.
2021-11-28 19:14:02 +01:00
nmlgc 15b4011ff2 [Maintenance] Remove inconsistent newlines before `extern "C"` braces
Part of P0168, funded by Blue Bolt and rosenrose.
2021-11-28 18:53:09 +01:00
nmlgc c2de6ab23b [Decompilation] [th01] Boss defeat sequence: Generic version
Copy-pasted from the SinGyoku version, and the differences can be fully
parametrized. Awesome to have a series of pushes end like this!

Completes P0167, funded by Ember2528.
2021-11-07 23:33:18 +01:00
nmlgc 021cbc8e9d [Decompilation] [th01] Boss defeat sequence: SinGyoku version + route selection
Part of P0167, funded by Ember2528.
2021-11-07 23:32:21 +01:00
nmlgc d5ec2220ec [Decompilation] [th01] Boss defeat sequence: Drawing white lines
Part of P0167, funded by Ember2528.
2021-11-07 23:32:04 +01:00
nmlgc 61091c31cc [Decompilation] [th01] Stage opening animation
Macro-free, compile-time conversion from Shift-JIS to JIS is entirely
possible in this 1994 C++ compiler, even when using an inlined
function! Awesome.

Really though, how often can you needlessly re-blit the same thing?

Part of P0167, funded by Ember2528.
2021-11-07 23:29:37 +01:00
nmlgc 692e8d1c42 [Naming] [th01] Remove "back/front" terminology from inter-page copy functions
TH01 doesn't use "back" and "front" pages in the way the later games
do, after all. Indicating that the source page of this parameter-less
function is the one that was previously set via graph_accesspage_func()
is going to make pretty much all its call sites way clearer, and stops
implying any further state.

Part of P0167, funded by Ember2528.
2021-11-07 23:27:30 +01:00
nmlgc e612d9a653 [Maintenance] [th01] Stage objects: Fix inconsistent function declarations
Part of P0167, funded by Ember2528.
2021-11-07 23:25:21 +01:00
nmlgc 5ed7f7150a [Maintenance] [th01] Start a new header file for text layer functions
What's most ridiculous about this is that ZUN had already reimplemented
master.lib text mode functions (th01/hardware/ztext.c). He simply never
used anything from there.

Part of P0167, funded by Ember2528.
2021-11-07 23:25:06 +01:00
nmlgc 6e7ab07659 [Decompilation] [th01] Loading and initializing common data used in all stages
Stupid one-off functions deserve stupid names, Part 2. If it only
loaded sprites, I might have given it a somewhat better name.

Part of P0167, funded by Ember2528.
2021-11-07 23:22:10 +01:00
nmlgc 6e0f9e568a [Decompilation] [th01] Sariel: Wand sprite unblitting and background snapping
Mission accomplished, Sariel unblocked… but what do we now do with the
remaining ¾ of this push? I'd really like to focus on Sariel in her own
dedicated push series…

Part of P0167, funded by Ember2528.
2021-11-07 23:20:46 +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 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