Commit Graph

2159 Commits

Author SHA1 Message Date
nmlgc 650c1e3364 [Maintenance] Review any redundancies and label them as ZUN bloat
Or quirk, in the case of the slow TH01 ending picture blitting.

Part of P0216, funded by JonathKane.
2022-08-16 01:43:14 +02:00
nmlgc 201722d25a [Maintenance] [th01] Finally add a BGM mode type
And name the FM state in a way that already prepares modded PMD
support. That's the number 1 TH01 mod idea, after all.

Part of P0216, funded by JonathKane.
2022-08-16 01:42:29 +02:00
nmlgc c4302b4ab7 [Maintenance] [th01] #include common.h from the resident structure header
Part of P0216, funded by JonathKane.
2022-08-16 01:41:14 +02:00
nmlgc ed3fbde7d7 [Maintenance] Correctly define `nullptr` as `far` for far-data memory models
Turns out I've misread the execl() documentation. That function does in
fact *not* need a second `nullptr` parameter for envp, because it
doesn't pass envp.

Part of P0216, funded by JonathKane.
2022-08-16 01:41:02 +02:00
nmlgc 08fa2151ca [Maintenance] Make the locked condition handler macro publicly available
I've been thinking about a new directory for any core cross-platform
code that these game typically need. These range from stuff like the
hardware-independent pixel_t types (you shouldn't need to #include a
file named "pc98.h" for those), to stuff like this. "logic" might have
been a good directory name, but does it encompass rendering as well?
So, it'll just be "game" for now. 😶

Part of P0216, funded by JonathKane.
2022-08-16 01:39:29 +02:00
nmlgc 690b4df14b [Maintenance] Fix another bunch of accumulated typos and dead code
Part of P0216, funded by JonathKane.
2022-08-16 01:38:12 +02:00
nmlgc 3123c9d3fd [Maintenance] [th01] REIIDEN.EXE: Move master.lib data back to the ASM husk
Completes P0215, funded by Ember2528 and Yanga.
2022-08-15 00:44:05 +02:00
nmlgc 65ce43443c [Decompilation] [th01] REIIDEN.EXE: Move the final pieces of data to C land
100%. What a giant, uncategorizable mess of data.

Part of P0215, funded by Ember2528.
2022-08-15 00:44:05 +02:00
nmlgc 08e064fce0 [Decompilation] [th01] REIIDEN.EXE: main()
Three nested infinite loops, and negative glitch stages in debug mode.
What a fitting end, indeed.

Part of P0215, funded by Ember2528 and Yanga.
2022-08-15 00:44:05 +02:00
nmlgc 6a3c1e0f8d [Maintenance] [th01] REIIDEN.EXE: Fix the last remaining type mismatches
Part of P0215, funded by Ember2528 and Yanga.
2022-08-14 23:27:32 +02:00
nmlgc 0fbc674973 [Decompilation] [th01] Bosses: Freeing function switch
Alright, time for the last bigger one.

Part of P0215, funded by Ember2528 and Yanga.
2022-08-14 23:27:11 +02:00
nmlgc 7b79d185bd [Decompilation] [th01] Pellets: Committing the destroy score
The final dumb function to remain in REIIDEN.EXE, and it only was the
4th last one to be decompiled…

Part of P0215, funded by Ember2528 and Yanga.
2022-08-14 23:26:48 +02:00
nmlgc 36958c2c1f [Decompilation] [th01] Error message for invalid resident state
The only game to show an error message if you try directly launching a
game through its main executable without setting up sound drivers or
the resident structure, and a really good one at that. "Please start
from the batch file" is the most user-friendly sentence you could print
in that case.

Part of P0215, funded by Ember2528 and Yanga.
2022-08-14 23:26:20 +02:00
nmlgc 2174245229 [Decompilation] [th01] Redundant and incomplete graphics freeing function
Part of P0215, funded by Ember2528 and Yanga.
2022-08-14 23:25:57 +02:00
nmlgc 07ea484425 [Decompilation] [th01] In-game debug variable display
Part of P0215, funded by Ember2528 and Yanga.
2022-08-14 23:25:33 +02:00
nmlgc 414770c717 [Decompilation] [th01] Memory info screen
Hiding a lot of dynamic .PTN buffer size information behind misleading
labels. Nothing there to tell ZUN that he could have just easily saved
20% of all this memory by using a structure without an unneeded alpha
plane.

Completes P0214, funded by Ember2528.
2022-08-14 23:24:53 +02:00
nmlgc ea8e2a2f9f [Decompilation] [th01] REIIDEN.EXE: Out-of-memory handler
Part of P0214, funded by Ember2528.
2022-08-14 23:24:29 +02:00
nmlgc 44dbae8062 [Decompilation] [th01] Score-based extends
Part of P0214, funded by Ember2528.
2022-08-14 23:24:06 +02:00
nmlgc 9814f769fb [Decompilation] [th01] Player: Game Over animation
Where ZUN forgets the trigonometry functions used everywhere else in
the game, attempts to implement a velocity calculation from scratch
instead, and fails in every way possible. Oh, and it also has an
out-of-bounds memory access…

Part of P0214, funded by Ember2528.
2022-08-14 23:23:25 +02:00
nmlgc a981007b7a [Decompilation] [th01] Continue menu
Part of P0214, funded by Ember2528.
2022-08-14 23:22:47 +02:00
nmlgc f075c0904e [Maintenance] [th01] REIIDEN.EXE: Merge the first two translation units again
Part of P0214, funded by Ember2528.
2022-08-14 23:22:35 +02:00
nmlgc 191a3497d8 [Decompilation] [th01] Pause menu
Part of P0214, funded by Ember2528.
2022-08-14 23:21:16 +02:00
nmlgc 402bb38324 [Decompilation] [th01] Orb/stage/pellet unblit/update/render/VSync function
 Doing way too many things and thus being impossible to name
 1 ZUN bug
 1 ZUN quirk

Off to a final great start! 😵 Stupid one-off functions deserve stupid
names, Part 5. Oh well, only 30 functions to go…

Part of P0214, funded by Ember2528.
2022-08-14 23:20:24 +02:00
nmlgc ff42470c8d [Maintenance] [th01] REIIDEN.EXE: Merge the first two translation units
Yup, code generation details force us to merge these as soon as we can.

Part of P0214, funded by Ember2528.
2022-08-14 23:20:11 +02:00
nmlgc d4140adb6e [Decompilation] [th01] REIIDEN.EXE: Move already referenced literals to C land
Part of P0214, funded by Ember2528.
2022-08-14 23:17:46 +02:00
nmlgc b60a23e737 [Naming] [th01] Rename `done` to `player_is_hit`
One disgusting abuse of this flag shouldn't ruin a perfectly adequate
variable name, and force a dependency on input variables on every
gameplay-related translation unit. Especially since the "ZUN bloat"
convention allows us to clearly highlight it.

Part of P0214, funded by Ember2528.
2022-08-14 23:16:40 +02:00
nmlgc c26f885502 [Naming] [th01] Fix stage ID vs. stage number confusion
Part of P0214, funded by Ember2528.
2022-08-14 23:16:40 +02:00
nmlgc 881094f9c6 [Naming] [th01] Player: Clearly distinguish the reset subfunction
This clarifies so much that it's worth its own commit.

Part of P0214, funded by Ember2528.
2022-08-14 23:05:45 +02:00
nmlgc 8877c66b24 [Maintenance] [th01] Add functions for blitting default player and Orb sprites
Part of P0214, funded by Ember2528.
2022-08-14 23:05:08 +02:00
nmlgc 3f8c0f4685 [Maintenance] [th01] Rename the `test_*()` functions to `debug_*()`
Conceptually, we can lump both "test" and "debug" modes under a single
"debug" umbrella.

Part of P0214, funded by Ember2528.
2022-08-14 23:04:21 +02:00
nmlgc cf95cc8717 [Maintenance] [th01] Remove `extern "C"` from all remaining areas of code
Nothing says "we're getting things done" quite as much as this.

Part of P0214, funded by Ember2528.
2022-08-14 23:03:15 +02:00
nmlgc 40051f5ae2 [Maintenance] [th01] Move remaining non-literal data into a new assembly unit
Yeah, no, I'm not going to declare all of those as `extern` and then
"Move all data to C land" after decompiling the entire segment. Once
again (94372d2), it's not too bad – heck, in REIIDEN.EXE, it's less
than a screen worth of identifiers that are still being referenced.

Part of P0214, funded by Ember2528.
2022-08-14 23:02:39 +02:00
nmlgc cc9b323501 [Maintenance] Keep Turbo C++'s <conio.h> from redefining I/O port intrinsics
Especially since it uses the inferior fundamental integer types because
this was the 90's.

Part of P0214, funded by Ember2528.
2022-08-14 22:58:18 +02:00
nmlgc 158a91e3ce [Maintenance] [th01] FUUIN.EXE: Move master.lib data back to the main ASM husk
Completes P0213, funded by Ember2528 and GhostRiderCog.
2022-08-11 23:21:23 +02:00
nmlgc 1fd32fad0f [Decompilation] [th01] FUUIN.EXE: Move the final pieces of data to C land
100%.

Part of P0213, funded by Ember2528 and GhostRiderCog.
2022-08-11 23:21:23 +02:00
nmlgc 96e18b33be [Decompilation] [th01] FUUIN.EXE: main()
The final secret of this executable: With a loaded MDRV2, enter

	fuuin t1

on the DOS prompt to view the 魔界/Makai Good Ending, or

	fuuin t

for the 地獄/Jigoku Good Ending.

(Bad Endings can only be accessed by pre-allocating the TH01 resident
structure and setting one of the `continues_per_scene` array members to
a nonzero value.)

Part of P0213, funded by Ember2528 and GhostRiderCog.
2022-08-11 23:21:23 +02:00
nmlgc 90077fdc79 [Decompilation] [th01] Move FUUIN.EXE input and High Score data to C land
Might as well figure out that horribly entangled data layout sooner
rather than later…

Part of P0213, funded by Ember2528 and GhostRiderCog.
2022-08-11 23:21:23 +02:00
nmlgc 643f662815 [Decompilation] [th01] VSync interrupt handler: Move all data to C land
Ending the data catch-up with… an unused mouse cursor graphic?!

Part of P0213, funded by Ember2528 and GhostRiderCog.
2022-08-11 23:21:23 +02:00
nmlgc c5b7f8d771 [Decompilation] [th01] Text mode functions: Move all data to C land
Part of P0213, funded by Ember2528 and GhostRiderCog.
2022-08-11 23:21:23 +02:00
nmlgc 6b3fc6c4d1 [Decompilation] [th01] Game init and exit functions: Move all data to C land
Part of P0213, funded by Ember2528 and GhostRiderCog.
2022-08-11 23:21:23 +02:00
nmlgc 443a334067 [Decompilation] [th01] Core graphics/palette functions: Move all data to C land
Part of P0213, funded by Ember2528 and GhostRiderCog.
2022-08-11 23:21:23 +02:00
nmlgc e79f6c62bf [Decompilation] [th01] .GRP / .GRZ / .PTN: Move all data to C land
Cross-executable ZUN bloat 🤮

Part of P0213, funded by Ember2528 and GhostRiderCog.
2022-08-11 23:21:23 +02:00
nmlgc ce9f1ed0c0 [Maintenance] [th01] Move OP and REIIDEN master.lib data to new assembly units
Part of P0213, funded by Ember2528 and GhostRiderCog.
2022-08-11 23:21:23 +02:00
nmlgc 774c97e31d [Decompilation] [th01] Pellet delay clouds: Move all data to C land
That's all hardcoded sprites transferred to C land! Yeah, I know,
what a significant milestone… except…

Part of P0213, funded by Ember2528 and GhostRiderCog.
2022-08-11 23:21:23 +02:00
nmlgc 738964a451 [Decompilation] [th01] Random resident structure stuff: Move all data to C land
Part of P0213, funded by Ember2528 and GhostRiderCog.
2022-08-11 23:21:23 +02:00
nmlgc 1971682309 [Decompilation] [th01] VRAM page transitions: Move all data to C land
Part of P0213, funded by Ember2528 and GhostRiderCog.
2022-08-11 23:21:23 +02:00
nmlgc 1031815450 [Decompilation] [th01] Shootout lasers: Move all data to C land
Part of P0213, funded by Ember2528 and GhostRiderCog.
2022-08-11 23:21:23 +02:00
nmlgc a3bc614e68 [Decompilation] [th01] MDRV2: Move all data to C land
Part of P0213, funded by Ember2528 and GhostRiderCog.
2022-08-11 23:21:23 +02:00
nmlgc 04f5c27d13 [Maintenance] [th01] Move FUUIN.EXE's master.lib data to a new assembly unit
Part of P0213, funded by Ember2528 and GhostRiderCog.
2022-08-11 23:21:22 +02:00
nmlgc bfb15c7afe [Decompilation] [th01] High score menu: Move BSS data in REIIDEN.EXE to C land
Work around inconsistency now, save catch-up work later.

Part of P0213, funded by Ember2528 and GhostRiderCog.
2022-08-11 23:21:22 +02:00