From b7ea95836d60cf9e1c74b6540e87b11b37aa4852 Mon Sep 17 00:00:00 2001 From: nmlgc Date: Thu, 20 Feb 2020 19:11:53 +0100 Subject: [PATCH] [Maintenance] [th03/th04/th05] Start a new "essential macros" file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both player/player.hpp and resident.hpp (in case of TH03's PLAYER_COUNT) and th04/shared.hpp (in case of TH04/TH05's MAIN_STAGE_COUNT) have way too much additional stuff that we don't want to include everywhere we need these constants. So let's try this "no types allowed" approach instead… maybe that'll work out for once. Part of P0076, funded by [Anonymous] and -Tom-. --- th03/common.h | 6 ++++++ th03/player/player.hpp | 2 -- th04/common.h | 7 +++++++ th04/shared.hpp | 5 ++--- 4 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 th03/common.h create mode 100644 th04/common.h diff --git a/th03/common.h b/th03/common.h new file mode 100644 index 00000000..24218d85 --- /dev/null +++ b/th03/common.h @@ -0,0 +1,6 @@ +/* ReC98 + * ----- + * Common, essential macros for TH03. No types here! + */ + +#define PLAYER_COUNT 2 diff --git a/th03/player/player.hpp b/th03/player/player.hpp index c6685c83..d10bf3ef 100644 --- a/th03/player/player.hpp +++ b/th03/player/player.hpp @@ -1,5 +1,3 @@ -#define PLAYER_COUNT 2 - #define HALFHEARTS_MAX 10 #define ROUND_START_INVINCIBILITY_FRAMES 50 diff --git a/th04/common.h b/th04/common.h new file mode 100644 index 00000000..85297881 --- /dev/null +++ b/th04/common.h @@ -0,0 +1,7 @@ +/* ReC98 + * ----- + * Common, essential macros for TH04. No types here! + */ + +#define MAIN_STAGE_COUNT 6 +#define STAGE_EXTRA MAIN_STAGE_COUNT diff --git a/th04/shared.hpp b/th04/shared.hpp index 3e6520d9..3d05eef7 100644 --- a/th04/shared.hpp +++ b/th04/shared.hpp @@ -3,6 +3,8 @@ * Types shared between TH04 and TH05 */ +#include "th04/common.h" + /// Math /// ---- #include "th03/math/subpixel.hpp" @@ -32,9 +34,6 @@ int pascal far select_for_rank( /// Stages /// ------ -#define MAIN_STAGE_COUNT 6 -#define STAGE_EXTRA MAIN_STAGE_COUNT - extern nearfunc_t_near stage_invalidate; extern nearfunc_t_near stage_render; /// ------