Commit Graph

1776 Commits

Author SHA1 Message Date
nmlgc 4b0b092a26 [Reverse-engineering] [th01] Stage clear flag
Part of P0159, funded by Yanga.
2021-09-28 18:05:25 +02:00
nmlgc e3c36d0151 [Reverse-engineering] [th01] Bombs: Animation frame
Part of P0159, funded by Yanga.
2021-09-28 18:05:25 +02:00
nmlgc 53c5c5b3aa [Maintenance] [th01] Add an enum for the cels in the card flip animation
Part of P0159, funded by Yanga.
2021-09-28 18:05:25 +02:00
nmlgc 0d497452ef [Maintenance] [th01] Use a single header file for bomb declarations
Part of P0159, funded by Yanga.
2021-09-28 18:05:25 +02:00
nmlgc 31d7f166b9 [Maintenance] Force the difficulty level enum to `int`
That should finally get it right, with no more casts anywhere.

Part of P0159, funded by Yanga.
2021-09-28 18:05:25 +02:00
nmlgc 990b598292 [Decompilation] [th01] Point items: Unblit/update/render function
Items done, in 1¼ pushes… way too long for how simple their code could
actually be.

Part of P0159, funded by Yanga.
2021-09-28 18:05:25 +02:00
nmlgc ef5225448c [Decompilation] [th01] Point items: Collection and drop callbacks
Part of P0159, funded by Yanga.
2021-09-28 18:05:25 +02:00
nmlgc e9950e2399 [Decompilation] [th01] Point items: Reset function
10 slots are too much for manual inlining, eh? Thankfully.

Part of P0159, funded by Yanga.
2021-09-28 18:05:25 +02:00
nmlgc 655d366166 [Decompilation] [th01] Point items: Blitting and sloppy unblitting loops
Part of P0159, funded by Yanga.
2021-09-28 18:05:25 +02:00
nmlgc 6160a9c93f [Decompilation] [th01] Point items: Collision handling
Part of P0159, funded by Yanga.
2021-09-28 18:05:25 +02:00
nmlgc d7430f2bcc [Decompilation] [th01] Point items: Spawn function
And now, Ctrl-C, Ctrl-V, s/bomb/point/.

Part of P0159, funded by Yanga.
2021-09-28 18:05:25 +02:00
nmlgc a82725862a [Decompilation] [th01] Bomb items: Unblit/update/render function
Part of P0159, funded by Yanga.
2021-09-28 18:05:24 +02:00
nmlgc c0c0ebc3cd [Decompilation] [th01] Bomb items: Collection and drop callbacks
Second instance of min/max clamping macros being nested into each
other…

Completes P0158, funded by Yanga.
2021-09-28 18:05:24 +02:00
nmlgc c8f05b8675 [Decompilation] [th01] Items: Generic unblit/update/render function
So generic that every individual structure member is separately passed
by reference. 🤪 That's one way to practice this aspect of C++, I
guess?

Part of P0158, funded by Yanga.
2021-09-28 18:05:24 +02:00
nmlgc e993e20da6 [Decompilation] [th01] Bomb items: Reset function
This actually made me research whether Turbo C++ 4.0J had some obscure
loop unrolling optimization option. But no, ZUN must have done that by
hand…

Part of P0158, funded by Yanga.
2021-09-28 18:05:24 +02:00
nmlgc 54fc657902 [Decompilation] [th01] Bomb items: Blitting and sloppy unblitting loops
With the latter being unused, thankfully.

Part of P0158, funded by Yanga.
2021-09-28 18:05:24 +02:00
nmlgc 318130ab9c [Decompilation] [th01] Bomb items: Collision handling
That is actually a perfectly logical and symmetrical hitbox, even
though it might not look like it.

Part of P0158, funded by Yanga.
2021-09-28 18:05:24 +02:00
nmlgc b9bc6ac04d [Decompilation] [th01] Bomb items: Spawn function
Part of P0158, funded by Yanga.
2021-09-28 18:05:24 +02:00
nmlgc b75ee8c208 [Reverse-engineering] [th01] Items: Structure
Storing bomb and point items not just in separate arrays, but also
using separate *functions* for both?! At least it's only a single
structure for both.

Part of P0158, funded by Yanga.
2021-09-28 18:05:24 +02:00
nmlgc fc40bdaa09 [Maintenance] [th01] Wrap EGC rectangle copies with 16-bit-aligned widths
Consolidating the associated "WTF" and "I don't even" and "lol ZUN"
into one place.

Part of P0158, funded by Yanga.
2021-09-28 18:05:24 +02:00
nmlgc 403fbcc37f [Maintenance] Remove `extern "C"` from more areas of decompiled code
Most notably from `th01/core/str_val`, where it's really in the way.
That mistake will haunt me until this all is done, probably…

Part of P0158, funded by Yanga.
2021-09-28 18:05:24 +02:00
nmlgc f005eb023b [Maintenance] Remove all unused externs in ASM land
Part of P0158, funded by Yanga.
2021-09-28 18:05:24 +02:00
nmlgc cf356bbf5e [Maintenance] [th01] Start a new header for commonly used VRAM color indices
Part of P0158, funded by Yanga.
2021-09-28 18:05:24 +02:00
nmlgc e07624a7be [Maintenance] [th01] Start a new header for clamping macros
Part of P0158, funded by Yanga.
2021-09-28 18:05:24 +02:00
nmlgc c2fa1f3d3b [Maintenance] [th01] Use a common macro for sloppy unblitting of .PTN sprites
Part of P0158, funded by Yanga.
2021-09-28 18:05:24 +02:00
nmlgc bf7bb7ed73 [Decompilation] [th01] 16× TRAM letters: HARRY UP
Largely copy-pasted from the previous function, once again.

Completes P0157, funded by Yanga.
2021-09-12 20:31:41 +02:00
nmlgc d0275f7ba6 [Decompilation] [th01] 16× TRAM letters: STAGE + number
Part of P0157, funded by Yanga.
2021-09-12 20:31:41 +02:00
nmlgc 6119c7122d [Decompilation] [th01] 16× TRAM letters: INT 18h, AH=14h wrapper
A wrapper function around hardware functionality?! In my TH01?!

Part of P0157, funded by Yanga.
2021-09-12 20:31:41 +02:00
nmlgc 84a3d465dc [Decompilation] [th01] 16× TRAM letters: Single transparent centered kanji
Used for the 東方★靈異伝 effect at the beginning of each scene. Good
that there's this second TRAM page, that's how we can be lazy and just
write into the 26th row :tannedcirno:

Part of P0157, funded by Yanga.
2021-09-12 20:31:41 +02:00
nmlgc b7a10e1a0a [Decompilation] [th01] 16× TRAM letters: Printing fullwidth JIS characters
A small function that prompted lots of research into whether it's
actually correct… which then revealed that every single widely used
PC-98 emulator is broken in this regard. More about that in two
upcoming pushes…

Part of P0157, funded by Yanga.
2021-09-12 20:31:39 +02:00
nmlgc ab4c1a9bad [Maintenance] Add a template for stupid bytewise access to logical structures
For the cases where ZUN's code would always be cleaner without it.

Part of P0157, funded by Yanga.
2021-09-12 18:35:08 +02:00
nmlgc af2c0e14a4 [Maintenance] Adopt the peek() and poke() inline functions from <dos.h>
Which still allows us to replace a bunch of manual MK_FP() macros with
calls to these functions.

Part of P0157, funded by Yanga.
2021-09-12 17:50:41 +02:00
nmlgc 4bc6405543 [Decompilation] [th01] HARRY UP pellet pattern
Completes P0156, funded by Ember2528.
2021-08-22 23:56:59 +02:00
nmlgc c30304c71e [Reverse-engineering] [th01] Stage timer
Yes, time*r*, since it technically doesn't count frames.

Part of P0156, funded by Ember2528.
2021-08-22 23:56:59 +02:00
nmlgc 33c9ef6582 [Decompilation] [th01] Sariel: Loading and initial variables
Part of P0156, funded by Ember2528.
2021-08-22 23:56:59 +02:00
nmlgc 0b18c7b99a [Decompilation] [th01] Sariel: Entrance animation
Just combining effects I've already decompiled last year.

Part of P0156, funded by Ember2528.
2021-08-22 23:56:59 +02:00
nmlgc e1fcd75cb4 [Decompilation] [th01] Konngara: Move all data to C land
And that's it! No Konngara-related code left in ASM land, first boss
complete! 30 to go :P

Part of P0156, funded by Ember2528.
2021-08-22 23:56:59 +02:00
nmlgc 6ffe87f35b [Decompilation] [th01] Konngara: Main function
Third longest function in all of PC-98 Touhou, and it's even more of a
copy-pasta than the patterns we've seen earlier. Certainly didn't feel
that long.

Part of P0156, funded by Ember2528.
2021-08-22 23:56:58 +02:00
nmlgc 8aa2b6a405 [Maintenance] [th01] Fix boss_hit_update_and_render() declarations
Part of P0156, funded by Ember2528.
2021-08-22 18:50:20 +02:00
nmlgc 9ad578ea93 [Reverse-engineering] [th01] Game clear flag
Completes P0155, funded by Ember2528.
2021-08-22 18:50:20 +02:00
nmlgc 40846cab45 [Decompilation] [th01] Konngara: Pattern 12/12
The one where 10-way spreads of pellets rain from Konngara's sleeve
every 10 frames.

Part of P0155, funded by Ember2528.
2021-08-22 18:50:20 +02:00
nmlgc 26f019385f [Decompilation] [th01] Konngara: Pattern 11/12
The one where Konngara swings their sword and fires fast aimed pellets
towards the player.
The third time we've seen the exact same basic function layout…

Part of P0155, funded by Ember2528.
2021-08-22 18:50:20 +02:00
nmlgc 9c7981fc59 [Decompilation] [th01] Konngara: Pattern 10/12
The one with lasers fired from the sword across the whole playfield,
either from left to right or from right to left, together with aimed
3-way spreads, every 10 frames.

Part of P0155, funded by Ember2528.
2021-08-22 18:50:20 +02:00
nmlgc 27c7ffaaa3 [Maintenance] [th01] Fix the type of CShootoutLaser::spawn()'s `col` parameter
Similarly to cb6367a, you also can't tell from a function's ASM whether
a parameter that's assigned to an 8-bit destination is actually an 8-bit
parameter, or a narrowed 16-bit parameter. That can really only be
gleaned from looking at all call sites…

Part of P0155, funded by Ember2528.
2021-08-22 18:50:20 +02:00
nmlgc 4fe260f7d5 [Decompilation] [th01] Konngara: Pattern 9/12
The one where Konngara swings their sword and spawns triangle-shaped
subpatterns along the slash path.
At least no randomness in that one.

Part of P0155, funded by Ember2528.
2021-08-22 18:50:20 +02:00
nmlgc 031b526421 [Decompilation] [th01] Konngara: Pattern 8/12
The one where Konngara swings their sword and lets pellets rain along
the (surprisingly triangular) slash path.
Yeah… not worth expressing these coordinates in playfield space when
they clearly correspond to specific locations in the background image.

Completes P0154, funded by Ember2528.
2021-08-22 18:50:20 +02:00
nmlgc 6647e3ed5f [Decompilation] [th01] Konngara: Sword slash animation
Switches are bad, right?

Part of P0154, funded by Ember2528.
2021-08-22 18:50:05 +02:00
nmlgc 2b84f81b53 [Decompilation] [th01] Konngara: Pattern 7/12
The one where Konngara shoots rays in a semicircle motion from their
sword to the edge of the playfield, with pellets raining down from the
ray's end point.

Insert "if… else if… else if…" joke. And hey, I've finally had the idea
to use function-local enums in place of #define!

Part of P0154, funded by Ember2528.
2021-08-22 18:47:26 +02:00
nmlgc eb3d214eca [Decompilation] [th01] Konngara: Pattern 6/12
The one with four homing snakes. Almost entirely copy-pasted from the
two-snake version.

Part of P0154, funded by Ember2528.
2021-08-22 18:46:24 +02:00
nmlgc f023655599 [Decompilation] [th01] Konngara: Pattern 5/12
The one with lots of single bullets being sprayed from Konngara's cup.
Featuring ridiculous aiming.

Part of P0154, funded by Ember2528.
2021-08-22 18:41:39 +02:00