Commit Graph

1647 Commits

Author SHA1 Message Date
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
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