From 83ff3c9ec9e26d30fde3fc25dd6f421a33d5624a Mon Sep 17 00:00:00 2001 From: nmlgc Date: Wed, 23 Mar 2022 23:15:34 +0100 Subject: [PATCH] [Maintenance] [th04/th05] Bullets: Move clear/zap declarations to new header Part of P0188, funded by [Anonymous] and nrook. --- th04/bullet_a.cpp | 1 + th04/main/bullet/bullet.hpp | 17 ----------------- th04/main/bullet/clearzap.hpp | 20 ++++++++++++++++++++ th04/main/bullet/update.cpp | 1 + th05/main/bullet/clip.cpp | 1 + 5 files changed, 23 insertions(+), 17 deletions(-) create mode 100644 th04/main/bullet/clearzap.hpp diff --git a/th04/bullet_a.cpp b/th04/bullet_a.cpp index 42e1cbdf..9aa23f46 100644 --- a/th04/bullet_a.cpp +++ b/th04/bullet_a.cpp @@ -15,6 +15,7 @@ extern "C" { #include "th04/main/playperf.hpp" #include "th04/main/player/player.hpp" #include "th04/main/bullet/bullet.hpp" +#include "th04/main/bullet/clearzap.hpp" #include "th04/main/gather.hpp" #pragma option -a2 diff --git a/th04/main/bullet/bullet.hpp b/th04/main/bullet/bullet.hpp index 1659295a..5e446da5 100644 --- a/th04/main/bullet/bullet.hpp +++ b/th04/main/bullet/bullet.hpp @@ -200,23 +200,6 @@ extern union { SubpixelLength8 speed_delta; } bullet_special_motion; -// Set to `true` to clear all on-screen bullets, giving out a semi-exponential -// bonus for all bullets that were alive on the first frame of activity. -// Lasts for BULLET_ZAP_FRAMES and resets to `false` afterwards. -extern union { - bool active; - unsigned char frames; // doubles as the animation timer -} bullet_zap; -static const int BULLET_ZAP_FRAMES_PER_CEL = 4; -// ZUN bug: Effectively 1 in TH05, see bullets_update() for the cause. -static const int BULLET_ZAP_FRAMES = ( - BULLET_ZAP_CELS * BULLET_ZAP_FRAMES_PER_CEL -); - -// # of frames left during which all on-screen bullets should decay. -// Gives a constant point bonus for every bullet decayed during that time. -extern unsigned char bullet_clear_time; - /// Rendering /// --------- union pellet_render_t { diff --git a/th04/main/bullet/clearzap.hpp b/th04/main/bullet/clearzap.hpp new file mode 100644 index 00000000..648e5be1 --- /dev/null +++ b/th04/main/bullet/clearzap.hpp @@ -0,0 +1,20 @@ +// Set to `true` to clear all on-screen bullets, giving out a semi-exponential +// bonus for all bullets that were alive on the first frame of activity. +// Lasts for BULLET_ZAP_FRAMES and resets to `false` afterwards. +extern union { + bool active; + unsigned char frames; // doubles as the animation timer +} bullet_zap; + +static const int BULLET_ZAP_FRAMES_PER_CEL = 4; + +#ifdef BULLET_ZAP_CELS + // ZUN bug: Effectively 1 in TH05, see bullets_update() for the cause. + static const int BULLET_ZAP_FRAMES = ( + BULLET_ZAP_CELS * BULLET_ZAP_FRAMES_PER_CEL + ); +#endif + +// # of frames left during which all on-screen bullets should decay. +// Gives a constant point bonus for every bullet decayed during that time. +extern unsigned char bullet_clear_time; diff --git a/th04/main/bullet/update.cpp b/th04/main/bullet/update.cpp index 2c292796..ec0d4c8f 100644 --- a/th04/main/bullet/update.cpp +++ b/th04/main/bullet/update.cpp @@ -19,6 +19,7 @@ extern "C" { #include "th04/main/slowdown.hpp" #include "th04/main/spark.hpp" #include "th04/main/bullet/bullet.hpp" +#include "th04/main/bullet/clearzap.hpp" #include "th04/main/player/player.hpp" } #include "th04/main/hud/hud.h" diff --git a/th05/main/bullet/clip.cpp b/th05/main/bullet/clip.cpp index 9e184e51..999f5c39 100644 --- a/th05/main/bullet/clip.cpp +++ b/th05/main/bullet/clip.cpp @@ -10,6 +10,7 @@ extern "C" { #include "th04/main/playfld.hpp" #include "th04/main/player/player.hpp" #include "th04/main/bullet/bullet.hpp" +#include "th04/main/bullet/clearzap.hpp" #include "th05/main/playperf.hpp" bool near bullet_template_clip(void)