Commit Graph

12 Commits

Author SHA1 Message Date
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 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 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 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 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
nmlgc 415bef1176 [Maintenance] [th03] SPRITE16: Move game-level code into `main/`
We'd like t have a method to set the clipping coordinates from a player
ID, but such a method requires a dependency on `playfld.hpp` in `main`.
`SPF_DOWNWARDS_COLUMN` is kind of game-specific to begin with, too.

Part of P0280, funded by [Anonymous], Blue Bolt, and JonathKane.
2024-04-21 13:36:03 +02:00
nmlgc 7e89d76751 [Maintenance] [th03] Define a player ID type
Luckily, C has nothing against `typedef`s being repeatedly defined to
the same value.

Part of P0261, funded by [Anonymous] and Yanga.
2023-11-01 23:17:52 +01:00
nmlgc b9402be979 [Maintenance] Simplify two-state entity flags
Changing the type to `bool` highlights that these have only two states.
No `switch` required.

Part of P0236, funded by Yanga.
2023-03-29 12:36:55 +02:00
nmlgc f9d983e0c0 [Decompilation] [th03] Player: Collision detection
8×8-pixel* player hitbox confirmed.

(* 8×4 in VRAM terms)

Completes P0183, funded by Yanga and [Anonymous].
2022-02-18 09:36:34 +01:00