Commit Graph

190 Commits

Author SHA1 Message Date
nmlgc 03048c318d [Decompilation] [th04/th05] Cutscenes: Text blending
Completes P0116, funded by [Anonymous] and Lmocinemod.
2020-09-12 12:09:31 +02:00
nmlgc 650d863942 [Reverse-engineering] [th05] Cutscenes: Shift-JIS codepoint ➜ text color map
Populated by the `\c=<codepoint>,<color>` commands seen at the top of
the .TXT files.

Part of P0116, funded by [Anonymous] and Lmocinemod.
2020-09-12 11:36:49 +02:00
nmlgc e38602c108 [Reverse-engineering] [th05] High score menu: Floating glyph ball structure
Part of P0116, funded by [Anonymous] and Lmocinemod.
2020-09-12 11:35:32 +02:00
nmlgc e5328a32fc [Reverse-engineering] [th05] Staff roll: Verdict bitmap
28,160 bytes of global data just for a overly large 320×704 bitmap
that allows you to scroll between the general verdict and the
individual end-of-stage scores with the Up and Down keys. That's one
benefit of splitting your game into multiple executables, I guess?

Completes P0115, funded by Lmocinemod and Blue Bolt.
2020-09-12 11:28:01 +02:00
nmlgc 827aee427c [Reverse-engineering] [th05] Staff roll: Star positions
Part of P0115, funded by Lmocinemod and Blue Bolt.
2020-09-12 11:27:51 +02:00
nmlgc d54fe1b041 [Reverse-engineering] [th05] Staff roll: Orb trail positions
Part of P0115, funded by Lmocinemod and Blue Bolt.
2020-09-12 11:27:41 +02:00
nmlgc ba1f9e230e [Reverse-engineering] [th05] Staff roll: Orb particle structure
Subpixels with 32-bit X and Y components?! That's new.
And yeah, they still just use 4 bits for the fractional part.

Also, let's try something revolutionary for these declarations that are
only used in a single .ASM dump file, and put them all straight before
the first function they are used in. Then we certainly don't forget to
delete them once we're done decompiling that stuff 🙃

Part of P0115, funded by Lmocinemod and Blue Bolt.
2020-09-12 11:23:41 +02:00
nmlgc 4e6bedf20d [Decompilation] [th05] Staff roll: Space window coordinates
Part of P0115, funded by Lmocinemod and Blue Bolt.
2020-09-12 11:21:44 +02:00
nmlgc c59283969e [Reverse-engineering] [th05] Staff roll: Space camera velocity
Part of P0115, funded by Lmocinemod and Blue Bolt.
2020-09-12 11:11:40 +02:00
nmlgc 716a925636 [Decompilation] [th03] YUME.CFG loading and saving
Oh, I just needed something in TH03's OP.EXE before code segment 2.

Part of P0114, funded by Lmocinemod.
2020-09-07 21:18:40 +02:00
nmlgc f6757fe76a [Maintenance] Fix DEFCONV declarations, and remove them where possible
Wow, this is the first time we're about to call any of these from C
land in ≥TH03? Found no built-in way to just uppercase an identifier
in TASM, so apparently we have to spell out the names in both lower-
and uppercase.
So, let's go back to regular, non-macro PUBLIC / PROC / ENDP code
wherever we can – for all functions introduced in ≥TH03, and for
everything that takes no parameters. It's simply not worth the
trouble.

Part of P0114, funded by Lmocinemod.
2020-09-07 21:18:39 +02:00
nmlgc d40547e601 [Maintenance] Drop the `slot` infix for PI-related identifiers
ZUN doesn't ever use PI functions without these slots, making that infix
kind of redundant.

Part of P0114, funded by Lmocinemod.
2020-09-07 21:18:39 +02:00
nmlgc e447a2d687 [Position independence] [th04/th05] Final data references in TH05's MAIN.EXE
And that's it, actual position dependence achieved! 🎉 Again, the
website won't quite show 100% PI, but that (again) are all false
positives, to be covered in an upcoming push…

Completes P0112, funded by [Anonymous] and Blue Bolt.
2020-08-28 16:21:20 +02:00
wintiger0222 db206f9d41 [Reverse-engineering] [th02/th04/th05] HUD: Bar colors
Reviewed and merged as part of P0112, funded by [Anonymous] and Blue
Bolt.
2020-08-28 16:21:13 +02:00
nmlgc 6cd11b0a44 [Reverse-engineering] [th05] Bullets: Pellet delay cloud render list
Making sure that we don't ever have to iterate over the 8×8 pellet part
of the bullet array during rendering… sure, but why not give the same
optimization treatment to the 16×16 bullets?

Part of P0112, funded by [Anonymous] and Blue Bolt.
2020-08-28 15:31:02 +02:00
nmlgc db0adbc58f [Maintenance] [th02/th04/th05] Rename `HUD_TRAM_W` to `HUD_KANJI_W`
Right, *_TRAM_W refers to 8-pixel halfwidth characters, and *_KANJI_W
to 16-pixel full-width characters… which also include gaiji, which are
what the entire HUD is made out of.

Part of P0112, funded by [Anonymous] and Blue Bolt.
2020-08-28 15:30:34 +02:00
nmlgc ed113d9c30 [Reverse-engineering] [th04/th05] Stage tiles: Initial ring buffer filling
…Wow. A 32-element lookup table for the very computationally expensive
operation of (i * 320), needlessly limiting the amount of unique 384×80
tile sections in a stage to 32… and then TH05 further "optimizes" this
lookup by pre-multiplying all section IDs in the .STD file with the
element size of that table, to save a grand total of 1 x86 instruction.

Part of P0112, funded by [Anonymous] and Blue Bolt.
2020-08-28 15:28:26 +02:00
nmlgc a89836c18e [Decompilation] [th05] Bombs: Reimu's blue star animation
After ternary expressions straight out of Jigoku in 57be510, we now got
pointer arithmetic straight out of Jigoku… with, unsurprisingly, two
ZUN bugs.

Part of P0112, funded by [Anonymous] and Blue Bolt.
2020-08-28 15:22:28 +02:00
nmlgc a7a053fb52 [Reverse-engineering] [th05] Bombs: Character-specific animation structures
Final structure in TH05's `MAIN.EXE`! And, just like this game's custom
entities, every character uses the same structure fields with vastly
different semantics and high-level types… yup, time for separate
structures again.

Part of P0112, funded by [Anonymous] and Blue Bolt.
2020-08-28 15:18:15 +02:00
nmlgc fb67d4d054 [Maintenance] Rename all old *_X and *_Y constants to *_LEFT and *_TOP
Part of P0112, funded by [Anonymous] and Blue Bolt.
2020-08-28 15:14:22 +02:00
nmlgc 5a1e16de60 [Maintenance] Subpixels: Rename to_screen() to to_pixel()
We've been establishing `screen` as meaning "a coordinate rooted at the
top-left corner of the display", whereas most of the Subpixels in >TH01
are rooted at the top-left of the playfield.

Part of P0112, funded by [Anonymous] and Blue Bolt.
2020-08-28 15:14:17 +02:00
nmlgc 4ef4c9eeb0 [Maintenance] [th05] Split segment #1 before Reimu's bomb star animation
Nope, not going to figure this one out on ASM level.

Completes P0111, funded by [Anonymous] and Blue Bolt.
2020-08-28 15:08:21 +02:00
nmlgc c5b5dc0201 [Reverse-engineering] General bomb-related globals
Yup, function pointers, frame counters, and general state variables for
all 5 games.

Part of P0111, funded by [Anonymous] and Blue Bolt.
2020-08-28 15:03:03 +02:00
nmlgc 1c3e9097cc [Decompilation] [th05] EX-Alice: Fire wave management
Final unknown entity in TH05 that can collide with the player!
Get position independence hype!
(Also, no structure member comments necessary, thanks to the new
types!)

Part of P0111, funded by [Anonymous] and Blue Bolt.
2020-08-28 14:59:27 +02:00
nmlgc d6f634631f [Maintenance] Declare distinct types for pixel and VRAM sizes
Oh wait, we also need one of those for an upcoming structure!

Part of P0111, funded by [Anonymous] and Blue Bolt.
2020-08-28 14:53:33 +02:00
nmlgc 368f151759 [Maintenance] Declare distinct types for screen, VRAM, and TRAM coordinates
Whew, time to look at every `int` variable we ever declared! The best
moment to do this would have been a year ago, but well, better late
than never. No need to communicate that in comments anymore.

These shouldn't be used for widths, heights, or sprite-space
coordinates. Maybe we'll cover that another time, this commit is
already large enough.

Part of P0111, funded by [Anonymous] and Blue Bolt.
2020-08-28 14:53:30 +02:00
nmlgc 9e06c45656 [Decompilation] [th05] Line sets: Copying lines up by 1 element
Which can't be a class method, but only because CX and DX would be
swapped then… yup.

Part of P0110, funded by [Anonymous] and Blue Bolt.
2020-08-19 20:12:00 +02:00
nmlgc 2ef3db3052 [Maintenance] Remove the `operator =` overloads for Subpixels
At least we've now documented their negative effects.

Part of P0110, funded by [Anonymous] and Blue Bolt.
2020-08-19 20:10:08 +02:00
nmlgc 7c4d31c02b [Decompilation] [th05] Line sets: Rendering
With all the memmove()-style shifting of individual lines, there's
probably a point to reserving 20 lines per set, but only ever rendering
4 of them. We'll see once I get to decompile all of these functions.

Part of P0110, funded by [Anonymous] and Blue Bolt.
2020-08-19 20:10:08 +02:00
nmlgc 8cf1e74565 [Maintenance] [th05] Split segment #1 before the line set render function
Why does this suddenly break select_for_rank() in C land?!

Part of P0110, funded by [Anonymous] and Blue Bolt.
2020-08-19 20:10:07 +02:00
nmlgc 808a5b94d3 [Reverse-engineering] [th05] Line sets: Structure
Not just used for the zooming lines in Shinki's background, but also
for the pentagram (and circle!) in EX-Alice's background.

Part of P0110, funded by [Anonymous] and Blue Bolt.
2020-08-19 20:10:06 +02:00
nmlgc 3821333a7f [Reverse-engineering] [th05] Bosses: Background particle structure
Straightforward even without looking at the functions more closely.

Part of P0110, funded by [Anonymous] and Blue Bolt.
2020-08-19 20:10:04 +02:00
nmlgc 40aea2d171 [Maintenance] [th05] Declare the particle sprite size in a single place
Because it's used by more than one entity type.

Part of P0110, funded by [Anonymous] and Blue Bolt.
2020-08-19 19:33:32 +02:00
nmlgc 60a700eeda [Maintenance] Declare the "no valid point" constant (-999) in a single place
Part of P0110, funded by [Anonymous] and Blue Bolt.
2020-08-19 19:32:37 +02:00
nmlgc 2c7d86bc5b [Decompilation] [th05] Mai & Yuki: Smooth random movement
Wow, so the boss_stuff_t structure did exist in the original code after
all. This is the only function in all of TH04 and TH05 that confirms
it – in dea40ad, it just seemed like something I made up, out of
convenience.

Completes P0109, funded by [Anonymous] and Blue Bolt.
2020-08-16 21:41:34 +02:00
nmlgc 18a8eccd2f [Decompilation] [th05] Bosses: Smooth random movement
Part of P0109, funded by [Anonymous] and Blue Bolt.
2020-08-16 21:41:34 +02:00
nmlgc 023417a1b4 [Maintenance] Move boss declarations to boss.hpp
Part of P0109, funded by [Anonymous] and Blue Bolt.
2020-08-16 21:40:35 +02:00
nmlgc 88cc266a24 [Maintenance] [th04/th05] Put global and stage-specific patnums into one enum
Right, because you'd also want to automatically shift the IDs for every
stage-specific sprite if you add or remove a new stage-independent one.

Part of P0109, funded by [Anonymous] and Blue Bolt.
2020-08-16 21:40:35 +02:00
nmlgc 4f7a3a28c3 [Reverse-engineering] [th05] Difficulty- and rank-based bullet pattern tuning
If C allowed labels of other functions as `goto` targets, this *might*
have been decompilable into something useful to modders. But like this,
there's no point in even trying.

Yeah, you *really* don't want to base your fangame mod on TH05.

Part of P0109, funded by [Anonymous] and Blue Bolt.
2020-08-16 21:40:33 +02:00
nmlgc 0644857fcb [Decompilation] [th05] Bosses: Smoothly flying towards a point
Found a uth05win inaccuracy! Once the Y coordinate gets close enough to
the target point, it actually speeds up twice as much as the X
coordinate would. This might make uth05win a couple of frames slower in
all boss fights from Stage 3 on.

And yeah, got too used to decompilation to go back to splitting off
RE'd functions in ASM land 😛

Part of P0109, funded by [Anonymous] and Blue Bolt.
2020-08-16 21:40:31 +02:00
nmlgc bd1c2ee7de [Maintenance] #define the number of dots in a byte
One fewer magic number. And one more deliberate dependency on a
PC-98-specific hardware constant, to further drive home just how
unportable these games are, even once decompilation will be complete.

Part of P0105, funded by Yanga.
2020-08-12 16:16:58 +02:00
nmlgc 8367a41d46 [Maintenance] Decide on *_id for 0-based, and *_num for 1-based IDs
Which we've been already subconciously doing with the resident
`demo_num` variable.

Part of P0104, funded by Ember2528.
2020-07-27 17:22:28 +02:00
nmlgc a207d6a494 [Decompilation] Add screen-space assignment overloads for Subpixels
Also great news for those people who want to remove any and all C++ in
their mods, because this forces us to spell out subpixel literals as
actual floats, every time. And with that, you're back to being able to
simply search-replace for all the instances you'll have to change.

Part of P0099, funded by Ember2528.
2020-07-12 16:00:59 +02:00
nmlgc 8f8940801d [Maintenance] Move the Subpixel class to TH01
At least pellets are moved at a decent precision in this game.

Part of P0099, funded by Ember2528.
2020-07-12 15:16:03 +02:00
nmlgc 1799d67782 [Build] Convert all known hardcoded sprites during the 32-bit build part
You can now mod them by simply editing .BMP files!
2020-07-09 22:28:15 +02:00
nmlgc c9eef45724 [Maintenance] Fix inconsistencies in sprite declarations 2020-07-09 22:28:14 +02:00
nmlgc ed4d7282a0 [Pipeline] Add .BMP versions of all hardcoded 1bpp sprites found so far
A future sprite converter (documented in #8) could then convert these
to C or ASM arrays.

(Except for the piano sprites for TH05's Music Room, which are stored
and used in such a compressed way that it defeats the purpose of
storing them as bitmaps.
2020-06-21 23:03:45 +02:00
nmlgc 97dce75446 [Maintenance] Proofread all comments in C land 2020-06-21 22:14:08 +02:00
nmlgc 90252cc59a [Decompilation] [th04/th05] Stage and BGM title popups
Completes P0089, funded by [Anonymous] and Blue Bolt.
2020-05-04 16:14:21 +02:00
nmlgc e1f3af547f [Maintenance] [th04/th05] Declare null callbacks in a single place in C land
Part of P0089, funded by [Anonymous] and Blue Bolt.
2020-05-04 16:14:18 +02:00