#pragma once #include "core/events.hpp" #include "core/math.hpp" #include "game/floor.hpp" struct Player; // The projector-screen pocket ritual: walk into the screen, walk over all 20 // red Hotline phones scattered on little desks, then step into the glass case // under the yellow Board roof. Proximity only -- no interact key. Pure sim // state; the presenter renders the black room. enum class BlackoutPhase { Idle, Pending, Active, CaseRevealed, Complete }; class BlackoutSequence { public: static constexpr int kPhoneCount = 20; // 5 columns x 4 rows static constexpr float kPhoneRadius = 2.2f; static constexpr float kCaseRadius = 2.6f; static constexpr float kLightsOutDelay = 2.0f; // grace period in the screen void init(const Floor& floor); // derive layout from the authored Screen prop void reset(); // new floor / new run (keeps the layout) // Pending is the 2 s grace after crossing the screen: the room is still // lit and normal gameplay continues until the lights actually go out. bool pending() const { return phase_ == BlackoutPhase::Pending; } float delay_left() const { return delay_; } bool active() const { return phase_ == BlackoutPhase::Active || phase_ == BlackoutPhase::CaseRevealed; } bool complete() const { return phase_ == BlackoutPhase::Complete; } BlackoutPhase phase() const { return phase_; } int answered() const { return answered_count_; } bool phone_answered(int i) const { return answered_[i]; } Vec2 screen_pos() const { return screen_pos_; } Vec2 case_pos() const { return case_pos_; } Vec2 phone(int i) const { return phones_[i]; } // True when the player's centre is inside the (non-colliding) screen footprint. bool entered(Vec2 pos) const; void begin(EventQueue& events); void dev_reveal(EventQueue& events); // QA: jump straight to the glass case // Returns true on the tick the case is entered (lights come back). bool update(float dt, const Player& player, EventQueue& events, bool autoplay); private: void answer(int index, EventQueue& events); BlackoutPhase phase_ = BlackoutPhase::Idle; int answered_count_ = 0; float delay_ = 0.0f; // countdown to lights-out after entering the screen float cooldown_ = 0.0f; // prevents one standing position answering twice float auto_timer_ = 0.0f; // dev --blackout-auto cadence bool answered_[kPhoneCount]{}; Vec2 screen_pos_{}; float screen_half_w_ = 9.0f; float screen_half_d_ = 3.0f; Vec2 phones_[kPhoneCount]{}; Vec2 case_pos_{}; };