Commit Graph

2608 Commits

Author SHA1 Message Date
nmlgc 6629d7cb8a [Maintenance] [th04/th05] Turn the SFT2.CDG sanity check into a `static_assert`
Borland's C preprocessor does not track enum values, so this check
always failed when running the code through just `CPP.EXE`.

Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:40:39 +02:00
nmlgc f7c37b500a [Maintenance] [th03] Music Room: Remove the ASM version of comment rendering
Should have been removed in 78728f6.

Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:40:35 +02:00
nmlgc 17a50c7c16 [Maintenance] [th01/th02/th03] graph_putsa_fx: Fix bracketing in FX_SPACING
Which no one ever noticed because this macro is unused.

Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:40:31 +02:00
nmlgc ccc2b541fe [Maintenance] [th01] Pellets: Move documentation and types into `pellet_s.hpp`
Everything related to the definition concept should be in one place.
The resident structure is merely where it's all stored, and the
`debloated` branch will get rid of that structure eventually.

Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:40:27 +02:00
nmlgc d1708c6fe9 [Maintenance] [th01] Declare score types in `score.h`
Yeah, why weren't they?!

Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:40:23 +02:00
nmlgc 975787676e [Maintenance] Move PC-98 keyboard constants into the platform layer
Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:40:18 +02:00
nmlgc 1bc91fd93b [Maintenance] Move the `grcg_off` macro override into an explicit header
Not only would the `(GAME != 2)` need to include TH03 in the future,
but this `#undef` trickery will blow up once we start reorganizing the
`#include`s in the next few commits.
Sadly, a few source files use master.lib's grcg_off() function in one
game and the macro in the other, which makes it infeasible to assign a
distinct name for every function.

Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:40:14 +02:00
nmlgc cc01af3e57 [Readme] Define support tiers for build platforms
Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:40:10 +02:00
nmlgc f7b257aa61 [Build] Mention that Turbo C++ 4.0J must be placed into a legacy codepage path
MS-DOS Player translates long names to the 8.3 format via
GetShortPathNameA(), but it fundamentally can't do Unicode.

Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:40:06 +02:00
nmlgc fa5c820fbe [Build] Display the current PATH if a tool can't be found
Especially helpful on Linux where there's the Linux-native `PATH`, the
completely unrelated `PATH` inside Wine, and `WINEPATH` to prefill the
latter from the former.

Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:39:37 +02:00
nmlgc 62bd5b127c [Build] Remove the last remnants of the 16-bit build part
Creates at least somewhat of a better diff than if we had renamed the
batch file two commits ago.

Now that we invoke TLINK ourselves, the `tlink.exe` error can no longer
appear. Since it did take a few hours to RE this back in 624e0cb, I've
preserved the section at a more dedicated place, at

	https://gist.github.com/nmlgc/6229345c74d1a7d3c6c1b3e988beb0e9

It will also be spelled out in the blog post of this delivery.

Completes P0004, funded by GhostPhanom.
2024-07-09 08:38:39 +02:00
nmlgc 620d9cedcf [Build] Merge the research code into the Tupfile
I considered disabling it by default and only enabling it through an
optional `CONFIG_RESEARCH` variable, but that turned out to be too
annoying and inconsistent when `build_dumb.bat` generation came into
play.

Part of P0004, funded by GhostPhanom.
2024-07-09 08:38:39 +02:00
nmlgc 528a63a42e [Build] Merge the entire 16-bit build part into the Tupfile
Part of P0004, funded by GhostPhanom.
2024-07-09 08:38:39 +02:00
nmlgc 0109bc6aa3 [Build] Compile bmp2arr with Turbo C++, using MS-DOS Player on 64-bit systems
Yup, no more 32-bit C++ compiler required!

Part of P0004, funded by GhostPhanom.
2024-07-09 08:38:39 +02:00
nmlgc c5290c0c30 [Build] Move the TCC and TLINK checks to the 32-bit build part
Part of P0004, funded by GhostPhanom.
2024-07-09 08:38:39 +02:00
nmlgc b86a2b1119 [Build] Rules: Properly split TLINK response file `echo` commands
Completes P0283, funded by [Anonymous].
2024-07-09 08:38:28 +02:00
nmlgc 816f3a083a [Build] Rules: Split long `echo` lines at Windows 9x limits
I have no words.

Part of P0283, funded by [Anonymous].
2024-07-09 08:38:23 +02:00
nmlgc 056085b478 [Build] Rules: Batch TCC invocations with identical command lines
Compiling as many source files as possible within a single TCC process
is the single most important build time optimization we can do. Sadly,
it won't work with Tup's parallel nature, but it can really shine in a
dumb batch build. This is the reason why Windows 9x can compile this
entire codebase on a single core in half the time it takes MS-DOS
Player to do the same on 64-bit Windows, on the same hardware.

That weird double-spacing, however, is the most ridiculous workaround
for a bug I have seen in a long while…

Completes P0282, funded by [Anonymous].
2024-07-09 02:46:55 +02:00
nmlgc dd129f4f6f [Build] Rules: Add output directory creation to the dumb batch file
`tup generate` does this as well, but only emits the `mkdir` calls for
the directories that are missing in the current working tree, requiring
a clean checkout to actually emit all necessary ones. This is much more
convenient.

Part of P0282, funded by [Anonymous].
2024-07-09 02:46:55 +02:00
nmlgc b59ee0bb5f [Build] Skip `tup parse` invocation if the Tupfile didn't change
Saving some additional milliseconds.

Part of P0282, funded by [Anonymous].
2024-07-09 02:46:55 +02:00
nmlgc 6842b64f5c [Build] Reimplement `tup generate` in Lua and Batch
Part of P0282, funded by [Anonymous].
2024-07-09 02:46:55 +02:00
nmlgc d60fb3e66d [Build] Bundle Tup
Yup, a 64-bit build. 32-bit Tup won't make sense going forward because
it can neither inject into a 64-bit MS-DOS Player nor into 16-bit DOS
build tools.

Completes P0003, funded by GhostPhanom.
2024-07-09 02:46:52 +02:00
nmlgc 3a0ff449a5 [Build] Bundle a performance-optimized version of MS-DOS Player
Part of P0003, funded by GhostPhanom.
2024-07-06 18:33:24 +02:00
nmlgc 5a79ea574c [Build] 32-bit: Refactor the Tupfile into Lua
A perfect `tup refactor`, already featuring most of the structure we're
going to use for the merged 32-bit and 16-bit build.
Also, inlining all the BCC32 stuff because we're no longer going to use
this compiler anyway.

Part of P0003, funded by GhostPhanom.
2024-07-06 18:33:24 +02:00
nmlgc f1318782f3 [Build] 32-bit: Remove duplicate backslashes from `bmp2arr.exe`
Single backslashes are still preserved as such in the `tup generate`d
batch file, and we don't need two there. This allows us to cleanly
refactor these commands into the new Lua code.

Completes P0002, funded by GhostPhanom.
2024-07-06 18:33:18 +02:00
nmlgc d7b0b13885 [Build] Emit all intermediate files into `obj/`
Finally, a clean `bin/` tree. 😌
And as for the additional complexities in the Makefile, well, we're
about to get rid of that one anyway. 🚮

Part of P0002, funded by GhostPhanom.
2024-06-30 05:53:13 +02:00
nmlgc 10db923251 [Build] [Pipeline] Compile with optimization flags
The ones we use in `Research/` and for the Anniversary Edition. Better
code generation at the cost of having to explicitly declare `main` as
`__cdecl` so that the linker can find it.

Part of P0002, funded by GhostPhanom.
2024-06-30 05:53:13 +02:00
nmlgc c95d7c5aa8 [Build] Move ZUN.COM generation code into the `Pipeline/` directory
These are just as much of a part of the PC-98 Touhou build pipeline as
the sprite compiler. The future Tupfile will use the tupblocks concept
of treating the build configuration as a branching tree, so we'd like
everything under `Pipeline/` to share a single set of configuration
flags.

Part of P0002, funded by GhostPhanom.
2024-06-30 05:53:13 +02:00
nmlgc b9d5c743a2 [Build] [th05] Use a separate translation unit for `scoreupd.asm`
Finally removing that one inconsistency that dates back to 1f1847d.
Now, every file in the `th0?/` subdirectory is meant to be assembled
with `/dGAME=?`.

Part of P0002, funded by GhostPhanom.
2024-06-30 05:53:13 +02:00
nmlgc 8d5b08306f [Build] 32-bit: Move ASM land `GAME` constants onto the build command line
More complex now, less complex in the Lua rewrite.

Part of P0002, funded by GhostPhanom.
2024-06-30 05:52:59 +02:00
nmlgc f7dbc0b497 [Build] Use a single set of `CFLAGS` in the Makefile
Turns out that all of the previous inconsistencies in the Makefile are
covered by just 8 additional `#pragma`s in the code. Most of those
applied to code that already needed way more flags than the Makefile
bothered to address, such as the extremely silly `-O-`.

Part of P0002, funded by GhostPhanom.
2024-06-24 00:21:31 +02:00
nmlgc 02b6129c51 [Build] [th02] Merge the 2nd and 3rd translation units of ZUN_RES.COM
The string literal placement issue mentioned in 942373e doesn't seem to
be an actual problem (anymore). This is also much simpler, as we get to
save tons of `extern` declarations at the cost of one additional
`#pragma option`.

Part of P0002, funded by GhostPhanom.
2024-06-24 00:21:28 +02:00
nmlgc b134834027 [zuncom] zungen: Allow spaces as listfile parameter separators
Not only would newlines complicate the `echo` commands in the future
Tup rules, but the sub-shell trick we'd have to use in order *to*
`echo` such newlines
(https://stackoverflow.com/questions/132799#comment10257404_132811)
won't work when running Tup through Wine:

	https://bugs.winehq.org/show_bug.cgi?id=21227

Part of P0002, funded by GhostPhanom.
2024-06-24 00:21:23 +02:00
nmlgc a214f329a7 [Maintenance] grzview: Copy-paste .GRZ stream arrays
Unfortunate, but we won't be able to reuse the same .OBJ file once we
compile all pipeline tools with the `pascal` calling convention.
Separately compiling `th01/formats/img_data.cpp` would also turn into a
mess with the upcoming `#include` cleanup:

• `img_data.cpp` requires `ptn.hpp`,
• which will require `egc.h`,
• which requires `defconv.h`,
• which requires `GAME` to be defined,
• which makes no sense for pipeline tools.

Part of P0002, funded by GhostPhanom.
2024-06-24 00:21:14 +02:00
nmlgc 0310154789 [Maintenance] Commit .bat files with LF line endings, but check out as CRLF
Windows 9x requires CRLF for batch files to work at all. While Windows
XP and later appear to work with LF line endings, they introduce
devious glitches with certain commands:

	https://www.dostips.com/forum/viewtopic.php?t=8988

However, we still want to use LF endings in the repo to prevent the
annoying ^M whitespace errors.

Part of P0002, funded by GhostPhanom.
2024-06-24 00:21:11 +02:00
nmlgc 87eed57ade [Decompilation] [th03] Hit circles: Rendering
Completes P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
2024-04-23 05:52:53 +02:00
nmlgc 0c6e9e88d0 [Decompilation] [th03] Hit circles: Update function
Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
2024-04-23 05:52:53 +02:00
nmlgc 4005de4d58 [Decompilation] [th03] Hit circles: Spawning player circles
Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
2024-04-23 05:52:53 +02:00
nmlgc 179c5389a7 [Decompilation] [th03] Hit circles: Spawning enemy circles
Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
2024-04-23 05:52:50 +02:00
nmlgc 6f84eb612a [Reverse-engineering] [th03] Hit circles: Structure
Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
2024-04-23 05:52:27 +02:00
nmlgc 1cdf14ab83 [Reverse-engineering] [th03] Global shared hitbox
Featuring a semantically overloaded origin just for the hell of it, eh?

Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
2024-04-21 14:50:21 +02:00
nmlgc c8443b77fe [Reverse-engineering] [th03] Round-or-result frame counter
Would be ZUN bloat if it didn't actually have an effect, since way too
many things read from it 😩

Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
2024-04-21 14:50:21 +02:00
nmlgc 09f5292c0a [Decompilation] [th03] Player: Position update and clamping
Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
2024-04-21 14:50:21 +02:00
nmlgc ead31bdfe0 [Decompilation] [th03] Player: Input → movement velocity
I am once again impressed at Turbo C++ 4.0J's optimizer for still
perfectly inlining two levels of nested conditional branches if they
only depend on compile-time constants.

Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
2024-04-21 14:50:03 +02:00
nmlgc 30ddddb2d4 [Reverse-engineering] [th03] Player: Base speed of currently updated player
Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
2024-04-21 14:29:49 +02:00
nmlgc 93e5f3213d [Decompilation] [th03] Playfield: Playfield X → screen X coordinate conversion
Together with `extern "C"` removal and another pass over constants that
the `x` parameter is calculated from.

Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
2024-04-21 14:29:49 +02:00
nmlgc 06ad372e16 [Decompilation] [th03] Playfield: Screen X → playfield X coordinate conversion
Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
2024-04-21 13:49:44 +02:00
nmlgc 59064548e4 [Decompilation] [th03] Playfield: Entity clipping
Why would you ever micro-optimize this 😩

Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
2024-04-21 13:49:44 +02:00
nmlgc cdc7e5929a [Decompilation] [th03] SPRITE16: Inline methods for playfield clipping
Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
2024-04-21 13:49:37 +02:00
nmlgc 51de5ec036 [Decompilation] [th03] SPRITE16: Inline method for sprite size assignments
All but one of the writes to these globals follow the consistent scheme
of assigning hardcoded literals to first `w` and then `h`, so it makes
sense to encapsulate the conversion from display-space pixels to VRAM
words and heights in a method.
(On that note, we also need a new type to encode the notion of
VRAM-space heights as opposed to the display-space heights of
`pixel_t`.)

Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
2024-04-21 13:41:58 +02:00