Commit Graph

992 Commits

Author SHA1 Message Date
nmlgc dffab7ae91 [Reverse-engineering] [th02/th04/th05] Stage and BGM popup variables
Part of P0089, funded by [Anonymous] and Blue Bolt.
2020-05-03 23:27:40 +02:00
nmlgc 5f047fdab1 [Reverse-engineering] [th04/th05] Clearing the playfield's text RAM area
master.lib's text_boxfillca() function would have been perfectly
suitable here…

Part of P0089, funded by [Anonymous] and Blue Bolt.
2020-05-03 23:25:59 +02:00
nmlgc 98be2f19a5 [Reverse-engineering] [th04/th05] Text dissolve circle sprites
Yeah, *that* effect used for stage and BGM titles. How else to call it?

Part of P0089, funded by [Anonymous] and Blue Bolt.
2020-05-03 23:24:01 +02:00
nmlgc da6b856dc5 [Reverse-engineering] [th04/th05] Stage enemy structure
Last one of the shared entity types! The TH05 version of the .STD enemy
VM would now be ready for decompilation in one single future push.

Completes P0088, funded by -Tom-.
2020-05-03 23:21:30 +02:00
nmlgc ba66fcc801 [Reverse-engineering] [th04/th05] Currently alive player shots
Copying out the shot position might have actually been a decent
optimization for hit detection, to avoid the indirection if the shot
is not colliding with anything.

Part of P0088, funded by -Tom-.
2020-05-03 23:18:56 +02:00
nmlgc 86c7ce540c [Maintenance] [th04/th05] Rename `pellets_alive` to `pellets_render_count`
More consistent with the next structure…

Part of P0088, funded by -Tom-.
2020-05-03 23:17:37 +02:00
nmlgc 97ce7b78cd [Maintenance] Consistently use forward slashes in #include paths
Completes P0087, funded by -Tom-.
2020-04-15 21:34:32 +02:00
wintiger0222 c6b17b0c24 [Reverse-engineering] [th04/th05] Point number popup add functions
Reviewed and merged as part of P0087, funded by -Tom-.
2020-04-15 21:34:32 +02:00
wintiger0222 ff56f162ea [Reverse-engineering] [th04/th05] Point number popup update/render functions
Reviewed and merged as part of P0087, funded by -Tom-.
2020-04-15 21:34:23 +02:00
wintiger0222 b91d82f037 [Reverse-engineering] [th04/th05] Point number popup rendering array
Reviewed and merged as part of P0087, funded by -Tom-.
2020-04-15 21:34:22 +02:00
wintiger0222 1a8da72ba0 [Reverse-engineering] [th04/th05] Point number popup structure
Good job! Nice to see another one of those rare feature whose TH05
implementation is actually less insane than the TH04 one. --Nmlgc

Reviewed and merged as part of P0087, funded by -Tom-.
2020-04-15 21:34:22 +02:00
nmlgc 4e58dadc74 [Reverse-engineering] [th02/th04/th05] Rendering of individual point numerals
Part of P0087, funded by -Tom-.
2020-04-15 21:34:22 +02:00
nmlgc b6fdcb0013 [Maintenance] Start a separate file for recurring sprite blitting algorithms
Part of P0087, funded by -Tom-.
2020-04-15 21:34:21 +02:00
nmlgc 8f824c4297 [Reverse-engineering] [th02/th04/th05] Point numeral sprites
Part of P0087, funded by -Tom-.
2020-04-15 21:34:21 +02:00
nmlgc c0b44ecaec [Position independence] Remaining references to _ctype
Part of P0087, funded by -Tom-.
2020-04-15 21:34:20 +02:00
nmlgc 24b96cd9da [Reverse-engineering] [th05] Curve bullet rendering
TH04's z_super_roll_put_tiny_32x32(), which this is based on, had
checks for not writing empty rows to VRAM. Why would ZUN remove them
here?

Completes P0086, funded by [Anonymous] and Blue Bolt.
2020-04-15 21:34:20 +02:00
nmlgc 8098b62285 [Reverse-engineering] [th05] Aiming to the player
Yes, this only became a dedicated function in TH05, probably due to all
the custom bullet types.

Part of P0086, funded by [Anonymous] and Blue Bolt.
2020-04-15 21:34:19 +02:00
nmlgc cf68f49803 [Reverse-engineering] [th04/th05] Boss phase end functions
…which I'd like to cover all at once.

Part of P0086, funded by [Anonymous] and Blue Bolt.
2020-04-15 21:34:19 +02:00
nmlgc 117fa02525 [Reverse-engineering] [th04] Stage 6 Yuuka's parasol and vanishing animations
Yes, this is the best time to cover these, since Stage 6 Yuuka's
animation state is reset in a variety of the boss phase end functions…

Part of P0086, funded by [Anonymous] and Blue Bolt.
2020-04-15 21:34:18 +02:00
nmlgc 4bab289d8a [Maintenance] [th04/th05] Declare boss explosions in C land
Part of P0086, funded by [Anonymous] and Blue Bolt.
2020-04-15 21:34:13 +02:00
nmlgc cb8da961c9 [Reverse-engineering] [th04/th05] Boss item drops
Part of P0086, funded by [Anonymous] and Blue Bolt.
2020-04-15 21:01:59 +02:00
nmlgc d1f3dcd620 [Maintenance] Move all features exclusive to MAIN.EXE to a main/ subdirectory
Adding op/, main/, and end/ directories does nicely cover a great
majority of the "not really further classifiable slices" implied in
d56bd45.

Part of P0086, funded by [Anonymous] and Blue Bolt.
2020-04-15 20:58:01 +02:00
nmlgc 54ee99b711 [Reverse-engineering] [th04/th05] 3-stack gather circles
Completes P0085, funded by -Tom-.
2020-04-03 17:45:28 +02:00
nmlgc 48203add0a [Reverse-engineering] [th04/th05] Gather circle structure
Part of P0085, funded by -Tom-.
2020-04-03 17:41:04 +02:00
nmlgc 02f0a0afcc [Build] Don't word-align everything by default
Again, 11 necessary workarounds, vs. forcing byte aligment in at least
18 places, and that number would have significantly grown in the
future.

Part of P0085, funded by -Tom-.
2020-04-03 17:35:57 +02:00
nmlgc ffad8cc897 [Build] Use the minimum possible size for enums by default
5 enums where code generation wants an `int`, vs. 11 cases where using
the minimum size is exactly the right default. So it's way more
idiomatic to force those 5 to 16 bits via a dummy element… except that
we can't give it a single, consistent name, because you can't redeclare
the same element in a different enum later.

Oh well, let's have this ugly naming convention instead, which makes it
totally clear that the force element not, in fact, a valid value of
that enum.

Part of P0085, funded by -Tom-.
2020-04-03 17:33:58 +02:00
nmlgc bedba4e070 [Reverse-engineering] [th04/th05] Gather point rendering
As if ZUN had coins for every possible optimization of these rendering
functions, and flipped them seperately before implementing each.
By now, we've probably seen it all though.

Also, 25% RE milestone passed!

Part of P0085, funded by -Tom-.
2020-04-03 17:32:51 +02:00
nmlgc 65816a43db [Reverse-engineering] [th02/th04/th05] Pellet rendering
… which allows a split into first rendering the top part of every
pellet, then the bottom part. This way, the game only needs two
grcg_setcolor() calls for any number of pellets.

Part of P0085, funded by -Tom-.
2020-04-03 17:32:51 +02:00
nmlgc 4843d17aae [Reverse-engineering] [th02/th04/th05] Hardcoded 8×8 pellet sprites
The bottom gray part of pellets in TH04 and TH05 is actually a separate
8×4 sprite…

Part of P0085, funded by -Tom-.
2020-04-03 17:32:50 +02:00
nmlgc bc9a88d3b9 [Maintenance] Decide how to handle pre-shifted sprites in C land
Ideally, the future sprite compiler should automatically pre-shift such
sprites, and correctly place the shifted variants in memory, by merely
parsing the C header. On disk, you'd then only have a .BMP with each
individual cel at x=0.

And that's why we need macros and consistent naming: To express these
semantics, without having to duplicate the sprite declaration in some
other format. sSPARKS[8][8][8] wouldn't help anyone 😛

Now, we could go even further there by defining a separate type
(`preshifted_dots8_t`), and maybe get rid of the _W macro by replacing
it with a method on that type. However,
• that would be inconsistent, since we'll need the _H macro anyway, for
  both the actual rendering code and the sprite compiler
• we couldn't directly call such a method on a 2D or 3D array, and have
  to go down to a single element to do so (`sSPARKS[0][0][0].w()`)
• making it a static method instead duplicates the type all over the
  code
• and any variables of that type would no longer be scalar-type values
  that can be stored in registers, requiring weird workarounds in those
  places. As we've already seen with subpixels.

Part of P0085, funded by -Tom-.
2020-04-03 17:32:50 +02:00
nmlgc 580fa8301a [Decompilation] [th02] Random number ring buffer reads, instance #2
And that's how you decompile from the beginning of a segment.

Part of P0085, funded by -Tom-.
2020-04-03 17:32:49 +02:00
nmlgc 110d6dd9d1 [Maintenance] Merge th01_reiiden_2.inc into th01_reiiden.asm
… it leads to those two files now having a total line count below
TASM's limit of 65,535 🎉

Completes P0084, funded by Yanga.
2020-03-22 10:16:09 +01:00
nmlgc 7698f5da6d [Maintenance] Compress unknown BSS regions using byte arrays
Also something that any future ReC project should be doing right at the
start. Finally, it made sense to do it here as well, because…

Part of P0084, funded by Yanga.
2020-03-22 10:16:09 +01:00
nmlgc c338305a61 [Decompilation] REYHI*.DAT loading and recreation
With master.lib file I/O in REIIDEN.EXE, and POSIX file I/O in
FUUIN.EXE… yup.

Part of P0084, funded by Yanga.
2020-03-22 10:16:08 +01:00
nmlgc e5af7a9ff5 [Maintenance] [th01] Split the REYHI*.DAT function segment into two
Painless this time, since we're only splitting off a handful of
functions there. Any future ReC project should simply assign every
function to its own segment though, to avoid having to do this…

Definitely going to do that more often now, especially for OP and
cutscenes of other games!

Part of P0084, funded by Yanga.
2020-03-22 10:02:12 +01:00
nmlgc ee9168b7eb [Reverse-engineering] [th01] REYHI*.DAT structure
Part of P0084, funded by Yanga.
2020-03-22 10:01:16 +01:00
nmlgc 1cc9cefa26 [Decompilation] [th01] PTN-sized page 0→1 copies
Final shared function in TH01's OP.EXE.

Part of P0084, funded by Yanga.
2020-03-22 09:59:24 +01:00
nmlgc dfac2f2fd4 [Position independence] [th01] EGC-powered page 1→0 region copy calls
12.4 fixed-point subpixels, in TH01?

Completes P0083, funded by Yanga.
2020-03-18 20:33:59 +01:00
nmlgc 9e676ce3ef [Decompilation] [th01] .PTN snap functions
Which repurpose the .PTN image slots to store the background of
frequently updated VRAM sections, like all the numbers in the HUD.
Future games would simply use the text RAM and gaiji for numbers. Which
would have worked just fine for TH01 as well (especially since all the
functions we've seen so far are aligned to the 8-pixel byte grid), but
it looks as if ZUN simply wasn't aware of gaiji during the development
of TH01.

Part of P0083, funded by Yanga.
2020-03-18 20:33:58 +01:00
nmlgc a184413f27 [Decompilation] [th01] .PTN file loading and non-transparent display
What is this, error checking in a ZUN game?! And surprisingly good code
for deriving the alpha plane?!

Part of P0083, funded by Yanga.
2020-03-18 20:33:58 +01:00
nmlgc d79f4c1171 [Maintenance] [th01] Correctly declare the packfile functions in C land
Mangled C++ function names would *not* have been a mistake if I hadn't
made the other mistake of restricting parts of the code to C…

Part of P0083, funded by Yanga.
2020-03-18 20:33:53 +01:00
nmlgc df6b636053 [Decompilation] Add an inline function for VRAM offset calculation
Which actually does inline… in C++, because Turbo C++ doesn't support
the `inline` keyword in C mode. So much for the superiority of that
language, even in 1994…

Part of P0083, funded by Yanga.
2020-03-18 20:11:18 +01:00
nmlgc 2546c5dfcb [Reverse-engineering] [th01] .PTN slot structure
Part of P0083, funded by Yanga.
2020-03-18 20:09:57 +01:00
nmlgc 40bb265b52 [Maintenance] Add macros for abstracting dot types based on width macros
Part of P0083, funded by Yanga.
2020-03-18 20:07:15 +01:00
nmlgc f6cbff0bf9 [Decompilation] [th01] .GRP file loading and display
All the weird double returns in FUUIN.EXE just magically appear with
-O-! 😮

And yeah, it's a bowl of global state spaghetti once again. 🍝 Named
the functions in a way that would make sense to a user of the API, who
should be aware of typical side effects, like, y'know, a changed
hardware palette… That's how you end up with the supposed "main"
function getting a "_palette_show" suffix.

Completes P0082, funded by Ember2528.
2020-03-13 19:48:38 +01:00
nmlgc 70176537e6 [Maintenance] Add include guards to ReC98.h
They do make everything so much simpler, after all. Especially now that
th01/formats/grz.cpp should compile as a freestanding translation unit,
as part of the .GRZ viewer.

Part of P0082, funded by Ember2528.
2020-03-13 19:16:02 +01:00
nmlgc 76634342f1 [Reverse-engineering] [th01] Global .GRP and .PTN variables
Since we not only have the .PTN sub-image count array in the middle of
all those .GRP flags, but the .PTN loading code also reusing the
palette set flag…

Part of P0082, funded by Ember2528.
2020-03-13 19:14:45 +01:00
nmlgc 8adbeb76b6 [Decompilation] [th01] .GRP palette fades
It's optimization barrier time again \o/

Part of P0082, funded by Ember2528.
2020-03-13 19:14:32 +01:00
nmlgc 63ed22ba67 [Reverse-engineering] [th01] .GRP palette
Part of P0082, funded by Ember2528.
2020-03-13 19:09:24 +01:00
nmlgc 00050d0e5e [Decompilation] [th01] VRAM text typing
Yeah, that 8×16 text RAM grid is so restricting.

Part of P0082, funded by Ember2528.
2020-03-13 19:09:12 +01:00