From d1f1b7d4052deffa96d8cac1bc8b4244d78ace8b Mon Sep 17 00:00:00 2001 From: nmlgc Date: Tue, 12 Jan 2021 21:09:19 +0100 Subject: [PATCH] [Maintenance] Move twobyte_t into its own header file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit And hope that there won't be any more generic utility types like it… Part of P0133, funded by [Anonymous]. --- ReC98.h | 8 -------- ReC98.inc | 6 +----- th01/fuuin_02.cpp | 1 + th01/main/boss/entity_a.cpp | 7 ++++++- th01/main_19.cpp | 1 + th04/end/box.cpp | 7 ++++++- twobyte.h | 9 +++++++++ twobyte.inc | 4 ++++ 8 files changed, 28 insertions(+), 15 deletions(-) create mode 100644 twobyte.h create mode 100644 twobyte.inc diff --git a/ReC98.h b/ReC98.h index d50ae651..385b66e9 100644 --- a/ReC98.h +++ b/ReC98.h @@ -53,12 +53,4 @@ #define RES_PARASIZE ((sizeof(resident_t) + 0xF) >> 4) // ------ -typedef union { - struct { - int8_t lo, hi; - } byte; - uint8_t u[2]; - int16_t v; -} twobyte_t; - #endif /* REC98_H */ diff --git a/ReC98.inc b/ReC98.inc index cdcc3ad0..671cbf06 100644 --- a/ReC98.inc +++ b/ReC98.inc @@ -29,6 +29,7 @@ include libs/master.lib/pf.inc include libs/master.lib/clip.inc include libs/master.lib/macros.inc include libs/kaja/kaja.inc +include twobyte.inc include pc98.inc include th01/hardware/egc.inc include th02/formats/pi_slots.inc @@ -47,11 +48,6 @@ setfarfp macro farfp, func mov word ptr farfp, offset func endm -twobyte_t struc - lo db ? - hi db ? -twobyte_t ends - ; master.lib extensions ; --------------------- ; super_roll_put_1plane() plane_put constants diff --git a/th01/fuuin_02.cpp b/th01/fuuin_02.cpp index 6035a308..70b3f3c8 100644 --- a/th01/fuuin_02.cpp +++ b/th01/fuuin_02.cpp @@ -10,6 +10,7 @@ extern "C" { #include #include "ReC98.h" #include "pc98kbd.h" +#include "twobyte.h" #include "th01/ranks.h" #include "th01/hardware/graph.h" #include "th01/hardware/input.hpp" diff --git a/th01/main/boss/entity_a.cpp b/th01/main/boss/entity_a.cpp index 8649add4..c566785d 100644 --- a/th01/main/boss/entity_a.cpp +++ b/th01/main/boss/entity_a.cpp @@ -1,4 +1,9 @@ -#include "ReC98.h" +#include +#include "platform.h" +#include "pc98.h" +#include "planar.h" +#include "master.hpp" +#include "twobyte.h" #include "th01/math/area.hpp" #include "th01/math/wave.hpp" #include "th01/hardware/egc.h" diff --git a/th01/main_19.cpp b/th01/main_19.cpp index 8d905603..22b2c109 100644 --- a/th01/main_19.cpp +++ b/th01/main_19.cpp @@ -9,6 +9,7 @@ extern "C" { #include #include #include "ReC98.h" +#include "twobyte.h" #include "th01/ranks.h" #include "th01/formats/grp.h" #include "th01/hardware/palette.h" diff --git a/th04/end/box.cpp b/th04/end/box.cpp index c8491d58..2fa2c3b1 100644 --- a/th04/end/box.cpp +++ b/th04/end/box.cpp @@ -1,5 +1,10 @@ -#include "ReC98.h" +#include +#include "platform.h" +#include "pc98.h" +#include "planar.h" #include "decomp.h" +#include "twobyte.h" +#include "master.hpp" // Note that this does not correspond to the tiled area painted into TH05's // EDBK?.PI images. diff --git a/twobyte.h b/twobyte.h new file mode 100644 index 00000000..0a0bc2f7 --- /dev/null +++ b/twobyte.h @@ -0,0 +1,9 @@ +// Used by various (dumb) pieces of code that require byte-wise access to +// 16-bit values. +typedef union { + struct { + int8_t lo, hi; + } byte; + uint8_t u[2]; + int16_t v; +} twobyte_t; diff --git a/twobyte.inc b/twobyte.inc new file mode 100644 index 00000000..0939a0a2 --- /dev/null +++ b/twobyte.inc @@ -0,0 +1,4 @@ +twobyte_t struc + lo db ? + hi db ? +twobyte_t ends