|
@@ -20,18 +20,18 @@ using namespace danmaku;
|
|
|
using shot = std::pair<math::vec2, float>;
|
|
using shot = std::pair<math::vec2, float>;
|
|
|
|
|
|
|
|
struct burstshot : public danmaku::bullet_pattern {
|
|
struct burstshot : public danmaku::bullet_pattern {
|
|
|
- static std::shared_ptr<burstshot> create(danmaku::actor*,
|
|
|
|
|
|
|
+ static std::shared_ptr<burstshot> create(danmaku::actor *,
|
|
|
Json::Value const &);
|
|
Json::Value const &);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
burstshot(danmaku::actor *, float shot_interval, std::vector<shot> shots);
|
|
burstshot(danmaku::actor *, float shot_interval, std::vector<shot> shots);
|
|
|
void update(float delta) override;
|
|
void update(float delta) override;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
danmaku::actor * actor;
|
|
danmaku::actor * actor;
|
|
|
danmaku::bullet_timer shot_timer;
|
|
danmaku::bullet_timer shot_timer;
|
|
|
float last_fired{std::numeric_limits<float>::lowest()};
|
|
float last_fired{std::numeric_limits<float>::lowest()};
|
|
|
std::vector<shot> shots;
|
|
std::vector<shot> shots;
|
|
|
};
|
|
};
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
std::vector<shot> shot_vector(std::size_t count, float facing, float covered,
|
|
std::vector<shot> shot_vector(std::size_t count, float facing, float covered,
|
|
|
float speed, bool clockwise) {
|
|
float speed, bool clockwise) {
|
|
|
if (covered == 360.f) { ++count; }
|
|
if (covered == 360.f) { ++count; }
|
|
@@ -39,7 +39,7 @@ std::vector<shot> shot_vector(std::size_t count, float facing, float covered,
|
|
|
float start = facing + (.5f * covered);
|
|
float start = facing + (.5f * covered);
|
|
|
float end = start - covered;
|
|
float end = start - covered;
|
|
|
if (clockwise != (end < start)) { std::swap(start, end); }
|
|
if (clockwise != (end < start)) { std::swap(start, end); }
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
float const delta = (end - start) / count;
|
|
float const delta = (end - start) / count;
|
|
|
float current = start;
|
|
float current = start;
|
|
|
for (std::size_t i = 0; i < count; ++i, current += delta) {
|
|
for (std::size_t i = 0; i < count; ++i, current += delta) {
|
|
@@ -53,14 +53,13 @@ burstshot::burstshot(danmaku::actor * actor, float shot_interval,
|
|
|
std::vector<shot> shots)
|
|
std::vector<shot> shots)
|
|
|
: actor(actor), shot_timer{shot_interval}, shots(shots) {}
|
|
: actor(actor), shot_timer{shot_interval}, shots(shots) {}
|
|
|
|
|
|
|
|
-std::shared_ptr<burstshot> burstshot::create(danmaku::actor* actor,
|
|
|
|
|
|
|
+std::shared_ptr<burstshot> burstshot::create(danmaku::actor * actor,
|
|
|
Json::Value const & json) {
|
|
Json::Value const & json) {
|
|
|
- return std::make_shared<burstshot>(actor, 0.f, shot_vector(0, 0.f, 0.f, 0.f, false));
|
|
|
|
|
|
|
+ return std::make_shared<burstshot>(actor, 0.f,
|
|
|
|
|
+ shot_vector(0, 0.f, 0.f, 0.f, false));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-void burstshot::update(float delta) {
|
|
|
|
|
-
|
|
|
|
|
-}
|
|
|
|
|
|
|
+void burstshot::update(float delta) {}
|
|
|
|
|
|
|
|
namespace danmaku {
|
|
namespace danmaku {
|
|
|
BIND_BULLET_PATTERN("burstshot", &burstshot::create);
|
|
BIND_BULLET_PATTERN("burstshot", &burstshot::create);
|