From 9a8e0fc0fd015fca66fd3f6a42cec2f97ff8e23a Mon Sep 17 00:00:00 2001 From: nmlgc Date: Thu, 18 May 2023 11:00:28 +0200 Subject: [PATCH] [Maintenance] Move the point structures into `pc98.h` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unfortunately, it's still premature to start a separate header file for display-space coordinates like I'm doing with Shuusou Gyoku. What does make sense, though, is moving the display-space vector types next to the display-space scalar types in `pc98.h`. This makes much more sense than keeping them in `master.hpp` just because master.lib also has a Point type. Would have thought that this lets us remove more than two `master.hpp` inclusions, though… Part of P0240, funded by JonathKane. --- master.hpp | 14 +------------- pc98.h | 11 +++++++++++ th03/formats/scoredat.cpp | 1 - th04/main/midboss/inv.cpp | 1 - 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/master.hpp b/master.hpp index aab83283..6f78e4a4 100644 --- a/master.hpp +++ b/master.hpp @@ -11,23 +11,11 @@ /// Types /// ----- -// A version of master.lib's Point without the constructor, even in C++ -struct point_t { - int x, y; -}; - -#ifdef PC98_H - struct screen_point_t { - screen_x_t x; - screen_y_t y; - }; - - #if defined(__cplusplus) +#if (defined(PC98_H) && defined(__cplusplus)) // master.lib palettes use twice the bits per RGB component for more // toning precision typedef RGB RGB8; typedef Palette Palette8; - #endif #endif /// ----- diff --git a/pc98.h b/pc98.h index 60c3f3b7..32a7a121 100644 --- a/pc98.h +++ b/pc98.h @@ -13,6 +13,11 @@ typedef int pixel_t; typedef unsigned int upixel_t; +// A version of master.lib's Point without the constructor, even in C++ +struct point_t { + pixel_t x, y; +}; + // VRAM widths and object-space coordinates typedef int vram_byte_amount_t; typedef int vram_word_amount_t; @@ -36,6 +41,12 @@ typedef unsigned int uscreen_x_t; typedef int screen_y_t; typedef unsigned int uscreen_y_t; +// Display-space point. +struct screen_point_t { + screen_x_t x; + screen_y_t y; +}; + // VRAM X coordinate, ranging from 0 to (RES_X / BYTE_DOTS). typedef int vram_x_t; diff --git a/th03/formats/scoredat.cpp b/th03/formats/scoredat.cpp index 6255d4aa..cde45dfc 100644 --- a/th03/formats/scoredat.cpp +++ b/th03/formats/scoredat.cpp @@ -2,7 +2,6 @@ #include #include "platform.h" -#include "master.hpp" #include "th01/rank.h" #include "th03/common.h" #include "th03/score.h" diff --git a/th04/main/midboss/inv.cpp b/th04/main/midboss/inv.cpp index 5fec207a..dd265534 100644 --- a/th04/main/midboss/inv.cpp +++ b/th04/main/midboss/inv.cpp @@ -2,7 +2,6 @@ #include "platform.h" #include "pc98.h" -#include "master.hpp" #include "th01/math/subpixel.hpp" #include "th04/math/motion.hpp" #include "th04/main/playfld.hpp"