[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.
This commit is contained in:
nmlgc 2024-05-16 19:34:26 +02:00
parent 1aff43bca6
commit c95323c259
8 changed files with 16 additions and 5 deletions

5
game/pf.h Normal file
View File

@ -0,0 +1,5 @@
// Shared packfile declarations
// ----------------------------
// Maximum name of a file name inside a packfile. (8.3 + terminating \0)
#define PF_FN_LEN 13

View File

@ -408,9 +408,6 @@ int MASTER_RET file_delete(const char MASTER_PTR *filename);
// Packfiles
// ---------
// Maximum file name length
#define PF_FN_LEN 13
extern unsigned char pfkey; // 復号化キー
extern unsigned bbufsiz; // バッファサイズ

View File

@ -1,7 +1,9 @@
/// Uncompressed monochrome 8w×h sprite format
/// ------------------------------------------
#include "th01/formats/sprfmt_h.hpp"
#include "th01/sprites/main_grc.h"
#include "game/pf.h"
#define GRC_MAGIC "GRCG"

View File

@ -1,3 +1,5 @@
#include "game/pf.h"
// Encraption key
extern uint8_t arc_key;

View File

@ -1,6 +1,8 @@
/// Entities
/// --------
#include "game/pf.h"
// Slot count for unique .BOS files associated with CBossEntity instances.
// *Not* CBossEntity instances themselves!
#define BOS_ENTITY_SLOT_COUNT 4

View File

@ -1,3 +1,5 @@
#include "game/pf.h"
static const int PLAYER_ANIM_IMAGES_PER_SLOT = 32;
struct PlayerAnimImages {

View File

@ -1,3 +1,4 @@
#include "game/pf.h"
#include "defconv.h"
#ifdef __cplusplus
@ -97,7 +98,7 @@ void snd_delay_until_volume(uint8_t volume);
SND_LOAD_SE = (PMD_GET_SE_ADDRESS << 8),
} snd_load_func_t;
#if (GAME <= 3) && defined(MASTER_HPP)
#if (GAME <= 3)
// Loads a song in .M format ([func] == SND_LOAD_SONG) or a sound
// effect bank in EFC format ([func] == SND_LOAD_SE) into the
// respective work buffer of the sound driver. If MIDI is used, 'md'

View File

@ -51,7 +51,7 @@ extern "C" {
// sets [snd_se_mode] and [snd_bgm_mode] accordingly. Returns [snd_bgm_mode].
int pascal snd_determine_modes(int req_bgm_mode, int req_se_mode);
#if defined(PMD) && defined(MASTER_HPP)
#if defined(PMD)
// Loads a song ([func] == SND_LOAD_SONG) or a sound effect bank ([func] ==
// SND_LOAD_SE) into the respective work buffer of the sound driver. [fn] must
// be null-terminated (despite the fixed length) and not have any extension.