Walk into the Projector Room screen to enter a black room with 20 ringing red-phone tables. Sweep all phones, then step into the yellow-roofed glass case to restore the lights and claim the FLUORESCENT Light Switch skill. - Blender: phone_table, case_frame and case_glass GLBs + reproducible build_blackout_props.py, concept lineup and source .blend - Sim: BlackoutSequence state machine, Game ownership, spawn freeze during the pocket, FLUORESCENT active skill with unlock flag and buff effect - Render: uAlpha glass blending, three ActorModels, blackout camera/pass, event VFX, HUD progress card and third skill stamp - Dev flags: --blackout-test, --blackout-auto, --blackout-reveal - Tests: headless blackout chain/claim test (8/8 CTest pass) - Docs: BLACKOUT_RITUAL.md plus design/roadmap/art/README updates
79 lines
2.7 KiB
C++
79 lines
2.7 KiB
C++
// Projector-screen blackout: 20 phone chain, glass case claim, skill reward.
|
|
#include <cstdio>
|
|
|
|
#include "game/game.hpp"
|
|
|
|
namespace {
|
|
|
|
constexpr float kDt = 1.0f / 60.0f;
|
|
bool failed = false;
|
|
|
|
void check(bool ok, const char* what) {
|
|
if (!ok) {
|
|
std::printf("FAIL: %s\n", what);
|
|
failed = true;
|
|
}
|
|
}
|
|
|
|
int count_events(const Game& game, EventType type) {
|
|
int n = 0;
|
|
for (int i = 0; i < game.events.count; ++i)
|
|
if (game.events.items[i].type == type) ++n;
|
|
return n;
|
|
}
|
|
|
|
} // namespace
|
|
|
|
int main() {
|
|
Game game(42);
|
|
const BlackoutSequence& b = game.blackout;
|
|
check(!b.active() && !b.complete(), "blackout starts idle");
|
|
check(!game.skill_system.fluorescent_unlocked, "reward starts locked");
|
|
|
|
// Walking into the non-colliding screen begins the puzzle.
|
|
game.player.pos = b.screen_pos();
|
|
game.update(InputState{}, kDt);
|
|
check(b.active(), "entering the screen starts blackout");
|
|
check(count_events(game, EventType::BlackoutStart) == 1,
|
|
"blackout start event emitted");
|
|
|
|
// Every unanswered phone can be activated by walking over it; order does
|
|
// not matter and an already-answered phone is inert.
|
|
for (int pass = 0; pass < 2; ++pass) {
|
|
for (int i = 0; i < BlackoutSequence::kPhoneCount; ++i) {
|
|
game.player.pos = b.phone(i);
|
|
game.blackout.update(0.7f, game.player, game.events, false);
|
|
}
|
|
}
|
|
check(b.answered() == BlackoutSequence::kPhoneCount,
|
|
"all 20 phones answer exactly once");
|
|
check(b.phase() == BlackoutPhase::CaseRevealed,
|
|
"case reveals after the last phone");
|
|
check(count_events(game, EventType::BlackoutPhone) ==
|
|
BlackoutSequence::kPhoneCount,
|
|
"one phone event per phone");
|
|
check(count_events(game, EventType::BlackoutCase) == 1,
|
|
"case reveal event emitted");
|
|
|
|
// Entering the case completes the ritual and restores the lights.
|
|
game.player.pos = b.case_pos();
|
|
game.update(InputState{}, kDt);
|
|
check(b.complete(), "entering the case completes the ritual");
|
|
check(count_events(game, EventType::BlackoutComplete) == 1,
|
|
"completion event emitted");
|
|
check(game.skill_system.fluorescent_unlocked,
|
|
"completion unlocks the FLUORESCENT skill");
|
|
|
|
// Re-entering the screen after completion does nothing.
|
|
game.player.pos = b.screen_pos();
|
|
game.update(InputState{}, kDt);
|
|
check(!b.active(), "the ritual cannot be restarted after completion");
|
|
|
|
// Floor jump / reset make it claimable again, but the unlock persists.
|
|
game.blackout.reset();
|
|
check(!b.complete() && b.answered() == 0, "reset clears puzzle progress");
|
|
|
|
if (failed) return 1;
|
|
std::printf("blackout ritual: all checks passed\n");
|
|
return 0;
|
|
}
|