Commit Graph

2647 Commits

Author SHA1 Message Date
nmlgc 168b366783 Merge branch 'master' into th04_0_ring_as_gameover 2024-07-09 08:53:53 +02:00
nmlgc 23fc9e7b04 [Readme] Discover another potential workaround for the TLINK `Loader error`
OK, *one* more for modern 32-bit Windows before the support tiers go
into effect, bringing this delivery to a nice 69 commits.

Completes P0285, funded by [Anonymous] and iruleatgames.
2024-07-09 08:47:06 +02:00
nmlgc 5356d0e5b6 [Decompilation] [th02] High Score menu: Main function
Part of P0285, funded by [Anonymous] and iruleatgames.
2024-07-09 08:47:03 +02:00
nmlgc c6687a9308 [Decompilation] [th02] High Score menu: HUUHI.DAT saving
Part of P0285, funded by [Anonymous] and iruleatgames.
2024-07-09 08:47:03 +02:00
nmlgc 9a4970c6d8 [Decompilation] [th02] High Score menu: Rendering
Part of P0285, funded by [Anonymous] and iruleatgames.
2024-07-09 08:47:02 +02:00
nmlgc 69a796744f [Translation unit catch-up] [th02] HUUHI.DAT: Loading
Part of P0285, funded by [Anonymous] and iruleatgames.
2024-07-09 08:47:02 +02:00
nmlgc fdaf261931 [Translation unit catch-up] [th02] HUUHI.DAT: Default data
Technically not bloat if we imagine a development setting where ZUN
ran ZUN_RES.COM once and then repeatedly deleted HUUHI.DAT while
leaving ZUN_RES.COM resident.

Part of P0285, funded by [Anonymous] and iruleatgames.
2024-07-09 08:47:02 +02:00
nmlgc 121e39bd74 [Position independence] [th02] High Score menu: HUUHI.DAT references
Part of P0285, funded by [Anonymous] and iruleatgames.
2024-07-09 08:47:02 +02:00
nmlgc 2200c77e60 [Maintenance] Fix another bunch of accumulated typos
Part of P0285, funded by [Anonymous] and iruleatgames.
2024-07-09 08:46:59 +02:00
nmlgc e0eb5cb1be [Maintenance] Turn `vram_offset_divmul` into a template
Has been on the todo list of small features for over two years.

Part of P0285, funded by [Anonymous] and iruleatgames.
2024-07-09 08:46:55 +02:00
nmlgc 1e41fa0617 [Maintenance] Remove redundant `#include`s
Part of P0285, funded by [Anonymous] and iruleatgames.
2024-07-09 08:46:51 +02:00
nmlgc b61e612fdf [Maintenance] #include each header's dependencies within the header itself
OK, this is the big one. We still keep using `#include` guards only
where we absolutely need to, but with each header now being valid in
isolation, this can now actually help *minimize* the length of each
translation unit's `#include` list. Turns out that after removing all
the duplicates, we only *actually* need to guard 29 headers across all
5 games.

Part of P0285, funded by [Anonymous] and iruleatgames.
2024-07-09 08:46:42 +02:00
nmlgc 18b9cd7cee [Decompilation] [th04/th05] Demo Play: Replay file loading
Completes P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:44:38 +02:00
nmlgc e353800f46 [Maintenance] Hidden #include dependency removal: TH04
Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:42:24 +02:00
nmlgc 0b06980360 [Maintenance] Hidden #include dependency removal: TH03
Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:42:21 +02:00
nmlgc 8a63c2ae53 [Maintenance] Hidden #include dependency removal: TH01
Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:42:17 +02:00
nmlgc 7c0f05f735 [Maintenance] Hidden #include dependency removal: Rank
Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:42:13 +02:00
nmlgc dba448965e [Maintenance] Hidden #include dependency removal: Subpixels
Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:42:09 +02:00
nmlgc ab41c89327 [Maintenance] Hidden #include dependency removal: kaja.h
Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:42:06 +02:00
nmlgc d625833696 [Maintenance] Hidden #include dependency removal: Global headers
Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:42:02 +02:00
nmlgc 4ad62ce9d9 [Maintenance] [th04/th05] Dialog: Merge `shared.hpp` into `shared.cpp`
This is the only place where it was #included.

Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:41:58 +02:00
nmlgc b44c74886e [Maintenance] EGC: Move implementation macros into a separate header
Avoids the `decomp.hpp` dependency in `th01/hardware/egc.h`.

Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:41:54 +02:00
nmlgc dda1af97ea [Maintenance] [th01] .PTN: Move data declarations into a separate header
These declarations (and the associated `planar.h` dependency) are
needed by a lot fewer translation units than the rest of `ptn.hpp`.

Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:41:50 +02:00
nmlgc a7463cf4cd [Maintenance] Sound: Move implementation details into a separate header
No need to add a dependency on `x86real.h` to every translation unit
that includes `snd.h`.

Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:41:46 +02:00
nmlgc 3b46fd9138 [Maintenance] [th04/th05] Move `PlayfieldPoint` into TH04's playfield header
It has a hidden dependency on TH04's scroll functions, and TH02 seems
to use screen coordinates throughout.

Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:41:37 +02:00
nmlgc 15f89da4ee [Maintenance] master.hpp: Split off all PC-98 graphics-related declarations
Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:41:33 +02:00
nmlgc f92936f9bb [Maintenance] master.hpp: Move memory model definitions into a separate header
Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:41:29 +02:00
nmlgc 3fad323d14 [Maintenance] master.hpp: Move into the master.lib directory
With the upcoming `#include` cleanup, it finally makes sense to split
off all graphics-related code into its own header. In turn, it makes
more sense to store all of these future master.lib headers in, well,
the master.lib directory, which provides a new 8 characters for their
file names. Turns out that the rationale I gave for the root directory
placement in 8266bbd didn't hold up 3½ years later…
(Also, the `pc98.h` declarations will eventually be split into
`game/coords.hpp` and something in `platform/x86real/pc98/`.)

Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:41:24 +02:00
nmlgc a9c3825ce3 [Maintenance] master.hpp: Remove `egc_selectpat()` and `egc_setrop()`
egc_setrop() delivers nothing of value, just obscures the single thing
it does, and disrupts the visual flow of the code.
egc_selectpat() isn't much better, is used a total of two times, says
almost nothing from its name alone, and MASTER.MAN's documentation adds
so little of value that you'd want to consult hardware documentation
anyway once you try to understand it.
Not to mention that both add a dependency on master.hpp for what are
actually PC-98 hardware constants.

Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:41:19 +02:00
nmlgc bb419fa649 [Maintenance] [th04/th05] OP.EXE: Move page synchronization into its own header
Three `#include`s for such a small function… (And soon it's going to be
4!)

Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:41:15 +02:00
nmlgc c95323c259 [Maintenance] Packfiles: Declare file name length in a separate header
The upcoming `#include` cleanup is going to spell out all implicit
dependencies of every header file. This would
• `#include "master.hpp"` in every header that uses `PF_FN_LEN`, and
• `#include "pc98.h"` in `master.hpp`, adding lots of graphics
  declarations to translation units that don't need them.

Moving `PF_FN_LEN` to its own file not only avoids needless inclusions
of `master.hpp` and all of its future dependencies later, but already
removes `master.hpp` from 6 translation units – not to mention that we
no longer need to preprocessor-guard some of the usages of `PF_FN_LEN`.

Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:41:08 +02:00
nmlgc 1aff43bca6 [Maintenance] Spell out master.lib's RNG functions
`irand()` and `rand()` are only identical on Borland compilers. The
specific RNG implementation is an integral part of the original game
logic, so we actually never want to use the generic libc `rand()`. Any
future replays recorded on PC-98 builds should play back identically on
whatever system we port the games to, after all.

Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:41:04 +02:00
nmlgc 7b6984b9ad [Maintenance] [th04/th05] ZUN Soft logo: Move private declarations to the .cpp
Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:41:00 +02:00
nmlgc 110d0534ed [Maintenance] Move `extern "C"` into the headers it applies to
The translation units were probably a better place back when most of
the codebase was still compiled in C mode, we only had a few C++ TUs,
almost everything needed to be declared as `extern "C"`, and moving
these declarations into the headers would have been really noisy with
all the `#ifdef __cplusplus` / `#endif` required. Nowadays though,
we've greatly reduced that surface area. And given that headers will
include even more headers as part of the upcoming `#include` cleanup,
it makes sense to make the jump now.

Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:40:49 +02:00
nmlgc c85c0e2483 [Maintenance] Remove `extern "C"` from more areas of code
Much more than usual, now that we've got a snappy build system! This
commit covers
• All .PI functions across all games
• TH02's High Score entry functions
• TH03's shots_update() and shots_render()
• All functions declared in `th04/op/op.hpp`
• TH04/TH05's bb_txt_put_8_raw(), bullet_template_clip(),
  player_pos_update_and_clamp(), score_update_and_render(), and
  slowdown_frame_delay()
• TH05's reimu_stars_update_and_render(), score_delta_commit(),
  stage2_invalidate(), stage2_update(), and space_window_set()

Part of P0284, funded by [Anonymous] and Blue Bolt.
2024-07-09 08:40:43 +02:00
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