FBC: NIGHT SHIFT - added the projector-screen blackout ritual
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
This commit is contained in:
parent
336c1249e9
commit
1aa33d3743
29 changed files with 951 additions and 59 deletions
|
|
@ -37,6 +37,7 @@ add_test(NAME level_core_test COMMAND level_core_test)
|
|||
|
||||
# Simulation-only test: the player must keep moving through enemy contact.
|
||||
set(GAME_SIM_SOURCES
|
||||
src/game/blackout.cpp
|
||||
src/game/buffs.cpp
|
||||
src/game/corruption.cpp
|
||||
src/game/ritual.cpp
|
||||
|
|
@ -58,6 +59,11 @@ target_link_libraries(skills_test PRIVATE level_core)
|
|||
add_dependencies(skills_test bake_level)
|
||||
add_test(NAME concrete_call_skill COMMAND skills_test)
|
||||
|
||||
add_executable(blackout_test tests/blackout_test.cpp ${GAME_SIM_SOURCES})
|
||||
target_link_libraries(blackout_test PRIVATE level_core)
|
||||
add_dependencies(blackout_test bake_level)
|
||||
add_test(NAME blackout_ritual COMMAND blackout_test)
|
||||
|
||||
set(LEVEL_JSON ${CMAKE_SOURCE_DIR}/assets/levels/floor01.json)
|
||||
set(BAKED_HPP ${CMAKE_SOURCE_DIR}/src/game/level_baked.hpp)
|
||||
add_custom_command(
|
||||
|
|
@ -93,6 +99,7 @@ add_executable(cntrl
|
|||
src/render/clay_impl.cpp
|
||||
src/render/ui_font.cpp
|
||||
src/render/clay_ui.cpp
|
||||
src/game/blackout.cpp
|
||||
src/game/buffs.cpp
|
||||
src/game/corruption.cpp
|
||||
src/game/ritual.cpp
|
||||
|
|
|
|||
|
|
@ -16,6 +16,11 @@ briefly, and `[L]` switches autoplay off entirely. The HUD stamps show both
|
|||
cooldowns and the shared mode.
|
||||
**Difficulty:** Risk of Rain 2-style continuous *Corruption* scaling — the clock is the
|
||||
enemy. See `docs/GAME_DESIGN.md`.
|
||||
**Projector-screen blackout:** walk into the Projector Room's big screen and the
|
||||
lights go out — twenty red-phone tables appear in the dark. Walk over all of
|
||||
them and a glass case with a yellow Board roof materialises at the screen; step
|
||||
inside to restore the lights and claim the FLUORESCENT Light Switch skill. See
|
||||
`docs/BLACKOUT_RITUAL.md`.
|
||||
|
||||
## Status
|
||||
|
||||
|
|
@ -76,6 +81,8 @@ area blasts in the open-plan room for litter/destruction VFX look-dev),
|
|||
`--floor-overview` (whole-floor overhead dev camera for the Floor 01 blockout),
|
||||
`--plaza-test` (start in the central plaza hub scene), `--office-test` (start in
|
||||
the office suite and inspect its destructible paper/bins),
|
||||
`--blackout-test` (start inside the projector screen), `--blackout-auto`
|
||||
(auto-answer the phones), `--blackout-reveal` (QA the glass case),
|
||||
`--fov <deg>`, `--cam-height <m>` and `--cam-forward <m>` for camera framing captures; F12 saves a screenshot on
|
||||
demand. Hiss corruption is visualised on enemies carrying an active
|
||||
enemy-channel buff (burn/slow/vulnerable/resonance) and on Objects of Power.
|
||||
|
|
@ -148,6 +155,7 @@ set `CNTRL_LEVEL` to import a different level file.
|
|||
| Shift / Space | Dash (*Evade*) |
|
||||
| J / gamepad Y | CONCRETE CALL — hurl a pile of concrete at the nearest crowd |
|
||||
| K / gamepad B | WARP — magnetize enemies together, then collapse them |
|
||||
| U / gamepad face-left | FLUORESCENT (earned in the projector-screen blackout) |
|
||||
| L / gamepad Back | Toggle skill autoplay (AUTO / MANUAL / OFF on the HUD stamps) |
|
||||
| R | Restart run (on death) |
|
||||
| Esc | Quit |
|
||||
|
|
@ -160,6 +168,7 @@ set `CNTRL_LEVEL` to import a different level file.
|
|||
- `docs/ART_DIRECTION.md` — the 3D-env + low-poly-actor diorama look, UI, audio
|
||||
- `docs/TECHNICAL.md` — stack, architecture, module map
|
||||
- `docs/LEVEL_DESIGN_REVIEW.md` — 2D map vs. client audit, findings and fix status
|
||||
- `docs/BLACKOUT_RITUAL.md` — projector-screen blackout: 20 phones, glass case, Light Switch OoP
|
||||
- `docs/ROADMAP.md` — milestones M0–M7 and current status
|
||||
- `docs/concept/` — rendered Blender concept frames (visual target for M5)
|
||||
- `docs/ENV_ENHANCEMENT.md` — enhancement slices S0–S17 for the environment/actors
|
||||
|
|
|
|||
BIN
assets/blender/fbc_blackout_props.blend
Normal file
BIN
assets/blender/fbc_blackout_props.blend
Normal file
Binary file not shown.
BIN
assets/models/props/case_frame.glb
Normal file
BIN
assets/models/props/case_frame.glb
Normal file
Binary file not shown.
BIN
assets/models/props/case_glass.glb
Normal file
BIN
assets/models/props/case_glass.glb
Normal file
Binary file not shown.
BIN
assets/models/props/phone_table.glb
Normal file
BIN
assets/models/props/phone_table.glb
Normal file
Binary file not shown.
|
|
@ -18,6 +18,7 @@ uniform vec4 colDiffuse;
|
|||
uniform vec3 uCameraPos;
|
||||
|
||||
uniform float uTime = 0.0;
|
||||
uniform float uAlpha = 1.0;
|
||||
uniform float uFlash = 0.0;
|
||||
uniform float uCorruption = 0.0;
|
||||
uniform float uOutline = 0.0;
|
||||
|
|
@ -131,5 +132,5 @@ void main()
|
|||
float fog = (1.0 - exp(-dist * 0.014)) * 0.55;
|
||||
lit = mix(lit, vec3(0.055, 0.058, 0.070), fog);
|
||||
|
||||
finalColor = vec4(lit, 1.0);
|
||||
finalColor = vec4(lit, uAlpha);
|
||||
}
|
||||
|
|
|
|||
123
docs/BLACKOUT_RITUAL.md
Normal file
123
docs/BLACKOUT_RITUAL.md
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
# FBC: NIGHT SHIFT — The Blackout Ritual (Projector Screen)
|
||||
|
||||
**Status:** implemented (2026-11-24).
|
||||
**Scope:** a self-contained pocket ritual inside the Projector Room, using the
|
||||
big projector screen as a threshold. New Blender props, a blackout presentation
|
||||
mode, a proximity puzzle, and the Light Switch OoP reward.
|
||||
|
||||
---
|
||||
|
||||
## 1. Design intent
|
||||
|
||||
The Projector Room already holds the 20 s briefing-reel ritual, but the
|
||||
**projection screen itself had no collision and no purpose** — you could walk
|
||||
straight through it. It is now the threshold for the game's strangest Object
|
||||
of Power encounter:
|
||||
|
||||
> You step into the screen. The fluorescents die. The room is gone. You stand
|
||||
> in black space in front of twenty little desks, each carrying a red Hotline
|
||||
> phone, all ringing. Walk over every phone. When the last one goes quiet, a
|
||||
> glass case with a yellow Board roof appears at the screen. Step inside it and
|
||||
> the lights come back — and the Light Switch is yours for the run.
|
||||
|
||||
Design pillars it respects:
|
||||
- **No pause screens.** The corruption clock keeps running; only the Director's
|
||||
spawns are suspended and the horde freezes outside the pocket. You can still
|
||||
move and Evade.
|
||||
- **Mega Man reward.** Completing the ritual grants a permanent OoP (an active
|
||||
skill) for the rest of the run.
|
||||
- **Readable in one glance.** Unanswered phones glow red; answered ones go
|
||||
dark. The HUD shows `PHONES ANSWERED n / 20` and one dot per phone.
|
||||
|
||||
## 2. Experience flow
|
||||
|
||||
| Phase | Player sees | Player does | HUD |
|
||||
|---|---|---|---|
|
||||
| `Idle` | Normal Projector Room; the screen is just set dressing | Walk into the screen footprint (≈18 × 6 m) | `OoP DETECTED` banner: `BLACKOUT — ANSWER ALL 20 PHONES` |
|
||||
| `Active` | Black room, the agent, 20 glowing phone tables in a 5 × 4 grid | Walk over each of the 20 phones (order irrelevant) | `BLACKOUT — THE HOUSE IS RINGING`, progress dots |
|
||||
| `CaseRevealed` | Same dark room; a glass case with a yellow roof appears at the screen, switch inside | Walk into the case | `LIGHT SWITCH UNGUARDED — ENTER THE CASE` |
|
||||
| `Complete` | Lights snap back, normal room and horde return | Continue the run | `BLACKOUT CLEARED — FLUORESCENT LIGHT CLAIMED` |
|
||||
|
||||
Edge cases:
|
||||
- Claimed once per run. A floor jump (`blackout.reset()`) makes it claimable
|
||||
again on L2+; the FLUORESCENT skill unlock persists for the run.
|
||||
- Entering the screen replaces any other in-progress ritual (one ritual at a
|
||||
time). Ritual HUD prompts are suppressed while in the pocket.
|
||||
- Death during blackout ends the run normally.
|
||||
- Re-entering the screen after completion does nothing.
|
||||
|
||||
## 3. Puzzle rules
|
||||
|
||||
- **20 phones**, fixed 5 × 4 grid (7 × 9 m spacing) in front of the screen,
|
||||
derived from the authored `PropKind::Screen` position in `floor01.json` — no
|
||||
new level data, no extra anchors, deterministic per floor.
|
||||
- Proximity only (radius 2.2 m), no interact key: the whole game is played by
|
||||
moving. A short 0.3 s debounce prevents one standing spot answering twice.
|
||||
- **No order and no wrong answers.** Any unanswered phone can be answered; the
|
||||
grid simply drains from 20 to 0. This keeps the encounter a *sweep* rather
|
||||
than a memory test, which suits a move-only auto-brawler.
|
||||
- The last phone reveals the case at the screen mouth. Entering it (2.6 m)
|
||||
completes the ritual: the scene goes back to the normal room and the reward
|
||||
is granted on that transition.
|
||||
- Reward: **FLUORESCENT**, a third active skill (`U`, gamepad face-left). It
|
||||
floods a 6 m radius with fluorescent light: enemies in range get
|
||||
`damage_taken_mult ×1.25` for 10 s, plus a bright flash. Cooldown 14 s. It
|
||||
joins the same `SkillSystem` manual/autoplay path as CONCRETE CALL and WARP,
|
||||
and its HUD stamp only appears once earned.
|
||||
|
||||
## 4. Presentation
|
||||
|
||||
- `Game::blackout.active()` clears the 3D target to near-black in `main.cpp`.
|
||||
- `Presenter::draw_scene` branches into `draw_blackout()` before any normal
|
||||
environment pass: dim floor slab, the 20 phone tables (unanswered ones with
|
||||
a red ground ring, billboard glow and a pulsing hit-flash), the agent, and
|
||||
the glass case once revealed. Enemies, XP shards, props and post-decay are
|
||||
not drawn.
|
||||
- A dedicated overhead camera (`height 44`, focus on the grid) frames all 20
|
||||
desks and the player at once; the normal tactical framing resumes on exit.
|
||||
- Events `BlackoutStart/Phone/Case/Complete` drive sparks and containment
|
||||
waves; post FX and the containment clock stay visible throughout.
|
||||
- HUD: a centred yellow-bordered progress card; the objective panel keeps
|
||||
showing the floor goal so the clock's pressure remains legible.
|
||||
|
||||
## 5. Blender assets (`tools/blender/build_blackout_props.py`)
|
||||
|
||||
| GLB | Contents | Tris | Rendering in game |
|
||||
|---|---|---|---|
|
||||
| `phone_table.glb` | Desk, drawer, red handset, rotary dial, hot indicator, cord | 746 | opaque actor shader, pulsing flash + red glow |
|
||||
| `case_frame.glb` | Plinth, brass trim, four posts, **yellow Board roof**, roof seal | 176 | opaque actor shader, 1.5× scale |
|
||||
| `case_glass.glb` | Four translucent panes | 64 | actor shader with new `uAlpha` uniform (0.30) and depth-mask-free alpha blending |
|
||||
|
||||
Conventions: one merged mesh per GLB, painted `Color` vertex attribute, origin
|
||||
at feet, facing +Z in engine (-Y in Blender), exports via `actor_kit.export_actor`.
|
||||
The existing `switch.glb` is drawn inside the case (2.2× scale).
|
||||
Concept: `docs/concept/blackout_props_lineup.png`.
|
||||
Source scene: `assets/blender/fbc_blackout_props.blend`.
|
||||
|
||||
## 6. Implementation map
|
||||
|
||||
- **Sim:** `src/game/blackout.{hpp,cpp}` (new), `game.{hpp,cpp}` ownership,
|
||||
spawn/combat suppression, reward grant, reset on floor jump.
|
||||
- **Events:** `core/events.hpp` + presenter consumer.
|
||||
- **Skills:** `SkillType::Fluorescent`, unlock flag, buff application.
|
||||
- **Models:** three `ActorModel` entries + paths; `uAlpha` in `actor.fs`;
|
||||
alpha/blend support in `ModelBank::draw`.
|
||||
- **Presenter:** `blackout_mode` camera + `draw_blackout()` pass.
|
||||
- **UI:** blackout progress card, third skill stamp, custom completion banner.
|
||||
- **Input:** `U` / gamepad face-left (autoplay means no key is required).
|
||||
- **Dev hooks:** `--blackout-test` (start inside the screen),
|
||||
`--blackout-auto` (answer phones automatically),
|
||||
`--blackout-reveal` (jump to the glass case for QA).
|
||||
- **Tests:** `tests/blackout_test.cpp` (CTest `blackout_ritual`).
|
||||
|
||||
## 7. Verification gates
|
||||
|
||||
- `cmake --build build -j6` clean; `ctest --test-dir build` 8/8 pass.
|
||||
- `./build/cntrl --blackout-test --screenshot ... --screenshot-at 2` shows the
|
||||
dark room, all 20 tables and the agent.
|
||||
- `--blackout-test --blackout-reveal --screenshot ...` shows the yellow-roofed
|
||||
glass case with the switch inside.
|
||||
- `--blackout-test --blackout-auto` completes the ritual and restores the
|
||||
lights; the FLUORESCENT stamp appears on the HUD.
|
||||
- A normal `--seed 42 --bot` run still reaches the key/door loop unchanged.
|
||||
- No missing-model fallback warnings for the three new GLBs.
|
||||
|
|
@ -30,6 +30,7 @@ Legend: **[B]** Blender scene (`tools/blender/build_scene.py`) · **[G]** game
|
|||
| S15 | Polish pass | Desaturated Mold, outlined Hiss units, clamped camera + dressed outer service band, dimmed glare, crisp HUD, floor decals, carpet seams, gentle contrast grade | **DONE** [G][B] |
|
||||
| S16 | Bigger floor + open-plan room | 260 × 260 m arena with shared pillar anchors, red approach runners, eight-piece Blender furniture kit (desks, meeting table, chairs, computers, plants, sofas, lamps, partitions) dressed into a Control-style research room, live camera dev slider | **DONE** [B][G] |
|
||||
| S17 | Rigged reference agent | ~6k-tri player model built from the Control reference art (yellow helmet, glowing respirator, sage coveralls, harness, radio, boxy angled rifle with red rounds), 19-bone Blender armature, Idle/Run/Dash/Fire/Stagger actions, skinned GLB playback in game | **DONE** [B][G] |
|
||||
| S18 | Projector-screen blackout kit | 20-table red-phone grid prop, translucent case panes, plinth/posts and yellow Board roof; alpha-blended glass in the actor shader and a black-room presentation pass | **DONE** [B][G] |
|
||||
|
||||
## S0 — Light, surface & post pass [B][R]
|
||||
|
||||
|
|
@ -438,6 +439,14 @@ clipping < 0.5%, red-dominant 15–25%.
|
|||
|
||||
## Status log
|
||||
|
||||
- 2026-11-24 (S18): built `phone_table.glb` (746 tris, red handset/dial/cord),
|
||||
`case_frame.glb` (176 tris, brass plinth/posts and yellow roof) and
|
||||
`case_glass.glb` (64 tris, four panes) in Blender via the reproducible
|
||||
`tools/blender/build_blackout_props.py`; concept lineup rendered to
|
||||
`docs/concept/blackout_props_lineup.png`. Added `uAlpha` to the actor shader
|
||||
so the exported glass draws translucent in-engine, and a black-room
|
||||
presentation pass with a dedicated overhead camera. See
|
||||
`docs/BLACKOUT_RITUAL.md`.
|
||||
- 2026-11-23 (S17): replaced the procedural-only guard with a reference-based
|
||||
`agent.glb`: 6.2k tris, 19-bone armature, five baked actions, CPU-skinned by
|
||||
raylib through the existing actor shader. Verified with close and bot captures.
|
||||
|
|
|
|||
|
|
@ -97,6 +97,18 @@ AWE: NIGHT SHIFT, CONTROL: BREACH PROTOCOL).
|
|||
a new prop (`ActorModel::Switch`, S11 props pipeline — presenter fallback
|
||||
draws a plate until art lands); the HUD completes with
|
||||
`RITUAL COMPLETE — Fluorescents revived`.
|
||||
**Projector-screen blackout (implemented, see `docs/BLACKOUT_RITUAL.md`):**
|
||||
the Projector Room's big screen is a threshold. Walk into it and the House
|
||||
goes black — only the agent and **20 red-phone tables** (a fixed 5 × 4 grid)
|
||||
are drawn. Walk over all 20 phones (no order, no wrong answers); a translucent
|
||||
glass case with a **yellow Board roof** and the Light Switch inside appears
|
||||
at the screen. Entering the case restores the lights and grants the permanent
|
||||
`FLUORESCENT` active skill (`U` / gamepad face-left, 6 m light, enemies take
|
||||
×1.25 damage for 10 s, 14 s cooldown, autoplays like the other skills). The
|
||||
Director stops spawning and enemies freeze during the pocket, but the
|
||||
corruption clock keeps running — the run never pauses. Claimable once per
|
||||
run; a floor jump makes it available again.
|
||||
|
||||
4. **OoP Evolutions:** OoP lv4 + a specific passive = **Altered Form** (build-crafting
|
||||
layer).
|
||||
5. **Floors get progressively harder** (§3 corruption escalation) and each floor
|
||||
|
|
|
|||
|
|
@ -78,6 +78,10 @@ critical path.
|
|||
3. **Projector Room / Briefing** (39 x 63 m) — right of the plaza. A Hiss briefing
|
||||
reel runs on the wall. Reach the projector -> **OoP ritual** -> claim the
|
||||
Projector as a run skill. Seating rows give the room a readable arena shape.
|
||||
Its big screen is also a threshold: enter it to trigger the **blackout
|
||||
ritual** — sweep 20 ringing red-phone tables in the dark, then step into the
|
||||
yellow-roofed glass case to restore the lights and claim the Light Switch
|
||||
OoP (`docs/BLACKOUT_RITUAL.md`).
|
||||
4. **Office Suite** (114 x 54 m) — directly **right of the Silos**, the repurposed
|
||||
open-plan Research room: the full S16 GLB kit (desks, computers, chairs,
|
||||
partitions, meeting table, sofas, lamps, plants, cabinets, crates) on a teal
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
| M0 | Scaffold: CMake + raylib 6.2, window, states, input, fixed tick | Builds; window opens; quits clean | **DONE** |
|
||||
| M1 | Grey-box vertical slice: move, dash, 1 auto-weapon, 3 enemy types, XP -> level-up (offers roll at thresholds, no pick, §2.2), corruption clock, death screen | *Fun for 60 seconds with placeholder art* | **DONE** |
|
||||
| M2 | Horde foundation: pooling, spatial hash, credit-based Director (+ too-cheap rule), OoP weapons (4), evolutions, damage numbers | 250+ enemies at 60 fps; RoR2 spawn feel | **DONE** - 250 enemies @ 60 fps verified via --bot --no-damage stress capture; 4 OoPs with levels 1-4 + Altered Forms, director bank + burst behavior in HUD |
|
||||
| M3 | Floors & OoP rituals: room-template assembly, keys/threshold doors, ritual quest flow (reach -> complete -> claim skill), simple TV ritual MVP (reach TV -> wait 60 s -> TV live), complex lightswitch ritual (§2.3 of GAME_DESIGN.md: magnet-catch bait near the switch -> revival + Fluorescent Light reward), Oceanview shop, 1 boss + boss door | Full 3-floor run start -> finish | **PARTIAL** — Floor 01 blockout, room collision, key -> door loop and the Projector ritual -> permanent skill are playable; other six floors, Oceanview shop and bosses outstanding |
|
||||
| M3 | Floors & OoP rituals: room-template assembly, keys/threshold doors, ritual quest flow (reach -> complete -> claim skill), simple TV ritual MVP (reach TV -> wait 60 s -> TV live), complex lightswitch ritual (§2.3 of GAME_DESIGN.md: magnet-catch bait near the switch -> revival + Fluorescent Light reward), Oceanview shop, 1 boss + boss door | Full 3-floor run start -> finish | **PARTIAL** — Floor 01 blockout, room collision, key -> door loop, the Projector ritual -> permanent skill and the projector-screen blackout (20 phones -> glass case -> Light Switch OoP) are playable; other six floors, Oceanview shop and bosses outstanding |
|
||||
| M4 | Debuffs & Buffs — scene-wide ECS-like system (components, durations, duration bars); player buff examples (damage amp, speed, regen, armor); elite debuff batteries (Resonant, Phasing, Shielded, Mending, Volatile); **world objects of power — SCP-like items on the scene (spawn: enemy deaths + scatter, magnet catch applies — player or nearest enemy, player+enemy channel debuffs — Unidentified)** | Distinct debuff/buff identities per enemy class | |
|
||||
| M5 | Enemy components & elites: T1/T2 affixs, Taken/Elevated/Cluster/Host variants | Soft groups of elites; elite reads distinct | |
|
||||
| M6 | Art/audio pass: brutalist floor kit, standee art, corruption-driven shaders/audio/env decay, OFL fonts (Archivo, IBM Plex Mono), SFX | Looks like Control; plays 20 min without repetition | |
|
||||
|
|
|
|||
BIN
docs/concept/blackout_props_lineup.png
Normal file
BIN
docs/concept/blackout_props_lineup.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 661 KiB |
|
|
@ -16,6 +16,10 @@ enum class EventType {
|
|||
TierUp,
|
||||
KeyAcquired,
|
||||
FloorCleared,
|
||||
BlackoutStart, // pos = projector screen, magnitude = unused
|
||||
BlackoutPhone, // pos = phone, magnitude = phones answered so far
|
||||
BlackoutCase, // pos = case reveal position
|
||||
BlackoutComplete, // pos = case, ritual claimed
|
||||
};
|
||||
|
||||
// Opt-in surface effects for an area detonation. Paper is spatial-gated by the
|
||||
|
|
|
|||
115
src/game/blackout.cpp
Normal file
115
src/game/blackout.cpp
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
#include "game/blackout.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
#include "game/player.hpp"
|
||||
|
||||
void BlackoutSequence::init(const Floor& floor) {
|
||||
screen_pos_ = Floor::to_world(129.0f, 69.0f); // authored Screen prop
|
||||
for (const FloorProp& p : floor.props()) {
|
||||
if (p.kind != PropKind::Screen) continue;
|
||||
screen_pos_ = p.pos;
|
||||
screen_half_w_ = std::max(3.0f, p.w * 0.25f);
|
||||
screen_half_d_ = 3.0f;
|
||||
break;
|
||||
}
|
||||
|
||||
// Twenty desks in a 5 x 4 grid in front of the screen, all inside the
|
||||
// Projector Room. No ordering: the player simply walks over every phone.
|
||||
constexpr int kCols = 5;
|
||||
constexpr int kRows = kPhoneCount / kCols;
|
||||
constexpr float kDx = 7.0f;
|
||||
constexpr float kDy = 9.0f;
|
||||
const Vec2 grid_centre{screen_pos_.x, screen_pos_.y + 20.0f};
|
||||
for (int r = 0; r < kRows; ++r) {
|
||||
for (int c = 0; c < kCols; ++c) {
|
||||
phones_[r * kCols + c] = {
|
||||
grid_centre.x + (c - (kCols - 1) * 0.5f) * kDx,
|
||||
grid_centre.y + (r - (kRows - 1) * 0.5f) * kDy};
|
||||
}
|
||||
}
|
||||
// The case materialises right at the screen mouth, clear of the phone grid.
|
||||
case_pos_ = {screen_pos_.x, screen_pos_.y + 1.5f};
|
||||
reset();
|
||||
}
|
||||
|
||||
void BlackoutSequence::reset() {
|
||||
phase_ = BlackoutPhase::Idle;
|
||||
answered_count_ = 0;
|
||||
cooldown_ = 0.0f;
|
||||
auto_timer_ = 0.0f;
|
||||
for (bool& done : answered_) done = false;
|
||||
}
|
||||
|
||||
bool BlackoutSequence::entered(Vec2 pos) const {
|
||||
return phase_ == BlackoutPhase::Idle &&
|
||||
std::fabs(pos.x - screen_pos_.x) <= screen_half_w_ &&
|
||||
std::fabs(pos.y - screen_pos_.y) <= screen_half_d_;
|
||||
}
|
||||
|
||||
void BlackoutSequence::begin(EventQueue& events) {
|
||||
if (phase_ != BlackoutPhase::Idle) return;
|
||||
phase_ = BlackoutPhase::Active;
|
||||
answered_count_ = 0;
|
||||
cooldown_ = 0.6f;
|
||||
auto_timer_ = 0.0f;
|
||||
events.push(EventType::BlackoutStart, screen_pos_);
|
||||
}
|
||||
|
||||
void BlackoutSequence::dev_reveal(EventQueue& events) {
|
||||
if (phase_ != BlackoutPhase::Active) return;
|
||||
for (int i = 0; i < kPhoneCount; ++i) answered_[i] = true;
|
||||
answered_count_ = kPhoneCount;
|
||||
phase_ = BlackoutPhase::CaseRevealed;
|
||||
events.push(EventType::BlackoutCase, case_pos_);
|
||||
}
|
||||
|
||||
void BlackoutSequence::answer(int index, EventQueue& events) {
|
||||
if (index < 0 || index >= kPhoneCount || answered_[index]) return;
|
||||
answered_[index] = true;
|
||||
++answered_count_;
|
||||
cooldown_ = 0.3f;
|
||||
auto_timer_ = 0.0f;
|
||||
events.push(EventType::BlackoutPhone, phones_[index],
|
||||
static_cast<float>(answered_count_));
|
||||
if (answered_count_ >= kPhoneCount) {
|
||||
phase_ = BlackoutPhase::CaseRevealed;
|
||||
events.push(EventType::BlackoutCase, case_pos_);
|
||||
}
|
||||
}
|
||||
|
||||
bool BlackoutSequence::update(float dt, const Player& player,
|
||||
EventQueue& events, bool autoplay) {
|
||||
bool entered_case = false;
|
||||
cooldown_ = std::max(0.0f, cooldown_ - dt);
|
||||
|
||||
if (phase_ == BlackoutPhase::Active) {
|
||||
if (autoplay && cooldown_ <= 0.0f) {
|
||||
auto_timer_ += dt;
|
||||
if (auto_timer_ >= 0.45f) {
|
||||
for (int i = 0; i < kPhoneCount; ++i) {
|
||||
if (!answered_[i]) {
|
||||
answer(i, events);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cooldown_ <= 0.0f) {
|
||||
for (int i = 0; i < kPhoneCount; ++i) {
|
||||
if (answered_[i]) continue;
|
||||
if (distance(player.pos, phones_[i]) > kPhoneRadius) continue;
|
||||
answer(i, events);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (phase_ == BlackoutPhase::CaseRevealed) {
|
||||
if (distance(player.pos, case_pos_) <= kCaseRadius) {
|
||||
phase_ = BlackoutPhase::Complete;
|
||||
entered_case = true;
|
||||
events.push(EventType::BlackoutComplete, case_pos_);
|
||||
}
|
||||
}
|
||||
return entered_case;
|
||||
}
|
||||
57
src/game/blackout.hpp
Normal file
57
src/game/blackout.hpp
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
#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, 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;
|
||||
|
||||
void init(const Floor& floor); // derive layout from the authored Screen prop
|
||||
void reset(); // new floor / new run (keeps the layout)
|
||||
|
||||
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 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_{};
|
||||
};
|
||||
|
|
@ -108,8 +108,9 @@ void apply_offer(Game& g, const Offer& o) {
|
|||
Game::Game(std::uint64_t seed, const std::string& level_path)
|
||||
: floor(level_path), rng(seed), seed_(seed) {
|
||||
weapon_system.reset();
|
||||
skill_system.reset();
|
||||
skill_system.reset_all();
|
||||
ritual_system.init(floor);
|
||||
blackout.init(floor);
|
||||
player.pos = floor.spawn();
|
||||
}
|
||||
|
||||
|
|
@ -123,12 +124,14 @@ void Game::reset() {
|
|||
clearance = 1;
|
||||
floor.reset_doors();
|
||||
floor_banner = 0.0f;
|
||||
floor_banner_text = nullptr;
|
||||
side_banner = 0.0f;
|
||||
side_banner_text = "";
|
||||
for (bool& claimed : side_reward_claimed_) claimed = false;
|
||||
enemy_system.clear();
|
||||
weapon_system.reset();
|
||||
skill_system.reset();
|
||||
skill_system.reset_all();
|
||||
blackout.reset();
|
||||
pickup_system.clear();
|
||||
corruption = Corruption{};
|
||||
director = Director{};
|
||||
|
|
@ -171,50 +174,69 @@ void Game::update(const InputState& in, float dt) {
|
|||
}
|
||||
|
||||
player_update(player, in, dt, floor);
|
||||
const bool projector_skill_claimed =
|
||||
ritual_system.type() == RitualType::Projector && ritual_system.complete();
|
||||
ritual_system.update(dt, player, buff_system, enemy_system);
|
||||
if (!projector_skill_claimed && ritual_system.type() == RitualType::Projector
|
||||
&& ritual_system.complete()) {
|
||||
grant_ritual_skill();
|
||||
floor_banner = std::max(floor_banner, 3.0f);
|
||||
}
|
||||
director.update(dt, corruption, run_time, player, enemy_system, rng,
|
||||
config.max_enemies, floor);
|
||||
enemy_system.update(dt, player, buff_system, events, floor, corruption);
|
||||
// "Taken"/"Confused" push the player after player_update, so re-resolve.
|
||||
player.pos = floor.resolve(player.pos, 0.45f);
|
||||
if (config.no_player_damage) player.hp = player.stats.max_hp; // stress mode
|
||||
weapon_system.update(dt, player, enemy_system, events, rng, floor);
|
||||
skill_system.update(dt, in, player, enemy_system, events);
|
||||
|
||||
if (length_sq({in.move_x, in.move_y}) < 1e-4f && !in.dash) idle_time += dt;
|
||||
else idle_time = 0.0f;
|
||||
if (!pending_offers.empty()) {
|
||||
offer_timer -= dt;
|
||||
if (offer_timer <= 0.0f || idle_time >= 5.0f) {
|
||||
apply_offer(*this, pending_offers.front());
|
||||
pending_offers.erase(pending_offers.begin());
|
||||
offer_timer = 3.0f;
|
||||
idle_time = 0.0f;
|
||||
if (blackout.active()) {
|
||||
// Inside the screen: the House holds its breath. The corruption clock
|
||||
// keeps running (the run never pauses) but the Director stops spawning
|
||||
// and the horde freezes outside the pocket. Only the puzzle advances.
|
||||
if (blackout.update(dt, player, events, blackout_auto)) {
|
||||
skill_system.unlock_fluorescent();
|
||||
floor_banner = std::max(floor_banner, 4.0f);
|
||||
floor_banner_text = "BLACKOUT CLEARED — FLUORESCENT LIGHT CLAIMED";
|
||||
}
|
||||
}
|
||||
} else if (blackout.entered(player.pos)) {
|
||||
// One active ritual at a time: entering the screen replaces whatever
|
||||
// was in progress and starts the phone chain.
|
||||
blackout.begin(events);
|
||||
ritual_system = RitualSystem{};
|
||||
floor_banner = std::max(floor_banner, 3.0f);
|
||||
floor_banner_text = "BLACKOUT — ANSWER ALL 20 PHONES";
|
||||
} else {
|
||||
const bool projector_skill_claimed =
|
||||
ritual_system.type() == RitualType::Projector && ritual_system.complete();
|
||||
ritual_system.update(dt, player, buff_system, enemy_system);
|
||||
if (!projector_skill_claimed && ritual_system.type() == RitualType::Projector
|
||||
&& ritual_system.complete()) {
|
||||
grant_ritual_skill();
|
||||
floor_banner = std::max(floor_banner, 3.0f);
|
||||
}
|
||||
director.update(dt, corruption, run_time, player, enemy_system, rng,
|
||||
config.max_enemies, floor);
|
||||
enemy_system.update(dt, player, buff_system, events, floor, corruption);
|
||||
// "Taken"/"Confused" push the player after player_update, so re-resolve.
|
||||
player.pos = floor.resolve(player.pos, 0.45f);
|
||||
if (config.no_player_damage) player.hp = player.stats.max_hp; // stress mode
|
||||
weapon_system.update(dt, player, enemy_system, events, rng, floor);
|
||||
skill_system.update(dt, in, player, enemy_system, buff_system, events);
|
||||
|
||||
death_pass();
|
||||
if (length_sq({in.move_x, in.move_y}) < 1e-4f && !in.dash) idle_time += dt;
|
||||
else idle_time = 0.0f;
|
||||
if (!pending_offers.empty()) {
|
||||
offer_timer -= dt;
|
||||
if (offer_timer <= 0.0f || idle_time >= 5.0f) {
|
||||
apply_offer(*this, pending_offers.front());
|
||||
pending_offers.erase(pending_offers.begin());
|
||||
offer_timer = 3.0f;
|
||||
idle_time = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
float xp_gained = 0.0f;
|
||||
pickup_system.update(dt, player, events, xp_gained);
|
||||
xp += xp_gained;
|
||||
floor_pass();
|
||||
side_room_pass();
|
||||
death_pass();
|
||||
|
||||
while (xp >= xp_to_next) {
|
||||
xp -= xp_to_next;
|
||||
level += 1;
|
||||
xp_to_next = 10.0f + 6.0f * static_cast<float>(level - 1);
|
||||
auto offers = roll_offers(*this);
|
||||
for (const Offer& o : offers) pending_offers.push_back(o);
|
||||
offer_timer = 3.0f;
|
||||
float xp_gained = 0.0f;
|
||||
pickup_system.update(dt, player, events, xp_gained);
|
||||
xp += xp_gained;
|
||||
floor_pass();
|
||||
side_room_pass();
|
||||
|
||||
while (xp >= xp_to_next) {
|
||||
xp -= xp_to_next;
|
||||
level += 1;
|
||||
xp_to_next = 10.0f + 6.0f * static_cast<float>(level - 1);
|
||||
auto offers = roll_offers(*this);
|
||||
for (const Offer& o : offers) pending_offers.push_back(o);
|
||||
offer_timer = 3.0f;
|
||||
}
|
||||
}
|
||||
|
||||
player.hp = std::min(player.stats.max_hp, player.hp + player.stats.regen * dt);
|
||||
|
|
@ -229,6 +251,7 @@ void Game::floor_pass() {
|
|||
if (!has_key && distance(player.pos, floor.key_pos()) <= floor.key_radius()) {
|
||||
has_key = true;
|
||||
floor_banner = 3.0f;
|
||||
floor_banner_text = nullptr;
|
||||
events.push(EventType::KeyAcquired, floor.key_pos());
|
||||
return;
|
||||
}
|
||||
|
|
@ -244,6 +267,7 @@ void Game::floor_pass() {
|
|||
floor.unlock_all_doors();
|
||||
for (bool& claimed : side_reward_claimed_) claimed = false;
|
||||
floor_banner = 4.0f;
|
||||
floor_banner_text = nullptr;
|
||||
has_key = false;
|
||||
events.push(EventType::FloorCleared, floor.door_pos(),
|
||||
static_cast<float>(floor_number));
|
||||
|
|
@ -254,6 +278,7 @@ void Game::floor_pass() {
|
|||
pickup_system.clear();
|
||||
buff_system = BuffSystem{};
|
||||
ritual_system = RitualSystem{};
|
||||
blackout.reset();
|
||||
player.pos = floor.spawn();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "core/events.hpp"
|
||||
#include "core/rng.hpp"
|
||||
#include "game/blackout.hpp"
|
||||
#include "game/buffs.hpp"
|
||||
#include "game/corruption.hpp"
|
||||
#include "game/director.hpp"
|
||||
|
|
@ -52,6 +53,8 @@ public:
|
|||
EnemySystem enemy_system;
|
||||
WeaponSystem weapon_system;
|
||||
SkillSystem skill_system; // player-triggered / autoplayed active skills
|
||||
BlackoutSequence blackout; // projector-screen phone puzzle
|
||||
bool blackout_auto = false; // dev --blackout-auto: answer phones automatically
|
||||
PickupSystem pickup_system;
|
||||
BuffSystem buff_system;
|
||||
Corruption corruption;
|
||||
|
|
@ -68,6 +71,7 @@ public:
|
|||
int floor_clears = 0;
|
||||
int clearance = 1; // diegetic stamp; gates the three side-room doors
|
||||
float floor_banner = 0.0f;
|
||||
const char* floor_banner_text = nullptr; // overrides the default key/floor banner
|
||||
float side_banner = 0.0f;
|
||||
const char* side_banner_text = "";
|
||||
int kills = 0;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ struct InputState {
|
|||
bool dash = false; // one-shot
|
||||
bool skill_concrete = false; // one-shot: CONCRETE CALL (J / gamepad Y)
|
||||
bool skill_warp = false; // one-shot: WARP (K / gamepad B)
|
||||
bool skill_fluorescent = false; // one-shot: FLUORESCENT (U, ritual reward)
|
||||
bool toggle_autoplay = false; // one-shot (L / gamepad Back)
|
||||
bool restart = false; // one-shot
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "core/events.hpp"
|
||||
#include "core/spatial_hash.hpp"
|
||||
#include "game/buffs.hpp"
|
||||
#include "game/enemies.hpp"
|
||||
#include "game/player.hpp"
|
||||
|
||||
|
|
@ -24,6 +25,10 @@ constexpr float kBlastDamage = 95.0f;
|
|||
constexpr float kCastRange = 18.0f;
|
||||
constexpr float kManualHold = 5.0f;
|
||||
constexpr float kCrowdRadius = 2.6f;
|
||||
constexpr float kFluorescentCooldown = 14.0f;
|
||||
constexpr float kLightRadius = 6.0f;
|
||||
constexpr float kLightDuration = 10.0f;
|
||||
constexpr float kLightDamageMult = 1.25f;
|
||||
|
||||
// Picks the densest nearby crowd and returns its centroid; a lone enemy is a
|
||||
// valid target. Returns false when there is nothing in casting range.
|
||||
|
|
@ -106,6 +111,26 @@ void try_cast_warp(SkillSystem& skills, Player& player, EnemySystem& enemies,
|
|||
static_cast<unsigned>(index));
|
||||
}
|
||||
|
||||
// The projector-screen ritual reward: flood the room with fluorescent light.
|
||||
void try_cast_fluorescent(SkillSystem& skills, Player& player, EnemySystem& enemies,
|
||||
BuffSystem& buffs, EventQueue& events) {
|
||||
const int index = static_cast<int>(SkillType::Fluorescent);
|
||||
if (!skills.fluorescent_unlocked || skills.cooldowns[index] > 0.0f ||
|
||||
!player.alive()) {
|
||||
return;
|
||||
}
|
||||
BuffEffect effect;
|
||||
effect.damage_taken_mult = kLightDamageMult;
|
||||
for (std::size_t i = 0; i < enemies.enemies.size(); ++i) {
|
||||
if (distance(player.pos, enemies.enemies[i].pos) > kLightRadius) continue;
|
||||
buffs.apply(static_cast<int>(i), effect, kLightDuration, "FLUORESCENT LIGHT");
|
||||
enemies.enemies[i].hit_flash = 0.15f;
|
||||
}
|
||||
skills.cooldowns[index] = kFluorescentCooldown;
|
||||
events.push(EventType::SkillCast, player.pos, kLightRadius,
|
||||
static_cast<unsigned>(index));
|
||||
}
|
||||
|
||||
void detonate(const ConcretePile& pile, EnemySystem& enemies, EventQueue& events) {
|
||||
for (Enemy& e : enemies.enemies) {
|
||||
if (distance(pile.pos, e.pos) >= pile.blast_radius + e.radius) continue;
|
||||
|
|
@ -133,6 +158,7 @@ const char* skill_name(SkillType type) {
|
|||
switch (type) {
|
||||
case SkillType::ConcreteCall: return "CONCRETE CALL";
|
||||
case SkillType::Warp: return "WARP";
|
||||
case SkillType::Fluorescent: return "FLUORESCENT";
|
||||
default: return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
|
@ -141,6 +167,7 @@ float skill_cooldown(SkillType type) {
|
|||
switch (type) {
|
||||
case SkillType::ConcreteCall: return kConcreteCooldown;
|
||||
case SkillType::Warp: return kWarpCooldown;
|
||||
case SkillType::Fluorescent: return kFluorescentCooldown;
|
||||
default: return 1.0f;
|
||||
}
|
||||
}
|
||||
|
|
@ -153,24 +180,32 @@ void SkillSystem::reset() {
|
|||
warps.clear();
|
||||
}
|
||||
|
||||
void SkillSystem::reset_all() {
|
||||
reset();
|
||||
fluorescent_unlocked = false;
|
||||
}
|
||||
|
||||
void SkillSystem::update(float dt, const InputState& in, Player& player,
|
||||
EnemySystem& enemies, EventQueue& events) {
|
||||
EnemySystem& enemies, BuffSystem& buffs,
|
||||
EventQueue& events) {
|
||||
if (in.toggle_autoplay) autoplay_enabled = !autoplay_enabled;
|
||||
manual_hold = std::max(0.0f, manual_hold - dt);
|
||||
for (float& cd : cooldowns) cd = std::max(0.0f, cd - dt);
|
||||
|
||||
if (in.skill_concrete || in.skill_warp) {
|
||||
if (in.skill_concrete || in.skill_warp || in.skill_fluorescent) {
|
||||
// A manual press takes control; autoplay stays off for a short window
|
||||
// even if the skill is still cooling down.
|
||||
manual_hold = kManualHold;
|
||||
}
|
||||
if (in.skill_concrete) try_cast(*this, player, enemies, events);
|
||||
if (in.skill_warp) try_cast_warp(*this, player, enemies, events);
|
||||
if (in.skill_fluorescent) try_cast_fluorescent(*this, player, enemies, buffs, events);
|
||||
if (autoplay_active()) {
|
||||
// Generic autoplay: every skill is cast from this same path when the
|
||||
// player isn't driving them by hand.
|
||||
try_cast(*this, player, enemies, events);
|
||||
try_cast_warp(*this, player, enemies, events);
|
||||
try_cast_fluorescent(*this, player, enemies, buffs, events);
|
||||
}
|
||||
|
||||
for (std::size_t i = 0; i < piles.size();) {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
// Player-triggered active skills (distinct from the always-on OoP weapons).
|
||||
// Skills can always be cast with their key, and auto-fire when the player is
|
||||
// not using them — future skills only need a new enum value and a cast rule.
|
||||
enum class SkillType { ConcreteCall = 0, Warp, Count };
|
||||
enum class SkillType { ConcreteCall = 0, Warp, Fluorescent, Count };
|
||||
constexpr int kSkillCount = static_cast<int>(SkillType::Count);
|
||||
|
||||
const char* skill_name(SkillType type);
|
||||
|
|
@ -39,17 +39,21 @@ struct WarpField {
|
|||
struct EventQueue;
|
||||
struct EnemySystem;
|
||||
struct Player;
|
||||
class BuffSystem;
|
||||
|
||||
struct SkillSystem {
|
||||
float cooldowns[kSkillCount]{};
|
||||
float manual_hold = 0.0f; // manual-control window after a key press
|
||||
bool autoplay_enabled = true;
|
||||
bool fluorescent_unlocked = false; // claimed from the projector-screen case
|
||||
DensePool<ConcretePile> piles{16};
|
||||
DensePool<WarpField> warps{4};
|
||||
|
||||
void reset();
|
||||
void reset(); // does not clear the unlock
|
||||
void reset_all(); // new run: clears the unlock too
|
||||
void unlock_fluorescent() { fluorescent_unlocked = true; }
|
||||
void update(float dt, const InputState& in, Player& player,
|
||||
EnemySystem& enemies, EventQueue& events);
|
||||
EnemySystem& enemies, BuffSystem& buffs, EventQueue& events);
|
||||
|
||||
// 1 = ready, 0 = just cast. Drives the HUD icon.
|
||||
float readiness(SkillType type) const;
|
||||
|
|
|
|||
37
src/main.cpp
37
src/main.cpp
|
|
@ -48,6 +48,9 @@ struct Options {
|
|||
bool floor_overview = false; // --floor-overview: whole-floor dev camera
|
||||
bool plaza_test = false; // --plaza-test: start in the central plaza
|
||||
bool office_test = false; // --office-test: start in the office suite
|
||||
bool blackout_test = false; // --blackout-test: start inside the screen
|
||||
bool blackout_auto = false; // --blackout-auto: auto-answer phones
|
||||
bool blackout_reveal = false; // --blackout-reveal: QA the glass case
|
||||
bool fullscreen = false; // --fullscreen: borderless fullscreen
|
||||
int aniso = 0; // --aniso 0|4|8: concrete texture filtering
|
||||
float fov = 0.0f; // --fov <deg>: initial camera FOV
|
||||
|
|
@ -96,6 +99,12 @@ Options parse_options(int argc, char** argv) {
|
|||
opts.plaza_test = true;
|
||||
} else if (std::strcmp(argv[i], "--office-test") == 0) {
|
||||
opts.office_test = true;
|
||||
} else if (std::strcmp(argv[i], "--blackout-test") == 0) {
|
||||
opts.blackout_test = true;
|
||||
} else if (std::strcmp(argv[i], "--blackout-auto") == 0) {
|
||||
opts.blackout_auto = true;
|
||||
} else if (std::strcmp(argv[i], "--blackout-reveal") == 0) {
|
||||
opts.blackout_reveal = true;
|
||||
} else if (std::strcmp(argv[i], "--fullscreen") == 0) {
|
||||
opts.fullscreen = true;
|
||||
} else if (std::strcmp(argv[i], "--aniso") == 0 && i + 1 < argc) {
|
||||
|
|
@ -117,6 +126,7 @@ struct InputFrame {
|
|||
bool dash = false;
|
||||
bool skill_concrete = false;
|
||||
bool skill_warp = false;
|
||||
bool skill_fluorescent = false;
|
||||
bool toggle_autoplay = false;
|
||||
bool restart = false;
|
||||
};
|
||||
|
|
@ -147,6 +157,7 @@ void poll_input(InputFrame& frame) {
|
|||
frame.dash = frame.dash || IsKeyPressed(KEY_LEFT_SHIFT) || IsKeyPressed(KEY_SPACE);
|
||||
frame.skill_concrete = frame.skill_concrete || IsKeyPressed(KEY_J);
|
||||
frame.skill_warp = frame.skill_warp || IsKeyPressed(KEY_K);
|
||||
frame.skill_fluorescent = frame.skill_fluorescent || IsKeyPressed(KEY_U);
|
||||
frame.toggle_autoplay = frame.toggle_autoplay || IsKeyPressed(KEY_L);
|
||||
frame.restart = frame.restart || IsKeyPressed(KEY_R);
|
||||
if (frame.pad >= 0) {
|
||||
|
|
@ -157,6 +168,8 @@ void poll_input(InputFrame& frame) {
|
|||
|| IsGamepadButtonPressed(frame.pad, GAMEPAD_BUTTON_RIGHT_FACE_UP);
|
||||
frame.skill_warp = frame.skill_warp
|
||||
|| IsGamepadButtonPressed(frame.pad, GAMEPAD_BUTTON_RIGHT_FACE_RIGHT);
|
||||
frame.skill_fluorescent = frame.skill_fluorescent
|
||||
|| IsGamepadButtonPressed(frame.pad, GAMEPAD_BUTTON_RIGHT_FACE_LEFT);
|
||||
frame.toggle_autoplay = frame.toggle_autoplay
|
||||
|| IsGamepadButtonPressed(frame.pad, GAMEPAD_BUTTON_MIDDLE_LEFT);
|
||||
frame.restart = frame.restart || confirm
|
||||
|
|
@ -189,6 +202,7 @@ InputState read_input(const Game& game, bool bot, const InputFrame& frame) {
|
|||
// Skills autoplay in SkillSystem; the bot doesn't need a key press.
|
||||
in.skill_concrete = false;
|
||||
in.skill_warp = false;
|
||||
in.skill_fluorescent = false;
|
||||
in.toggle_autoplay = false;
|
||||
return in;
|
||||
}
|
||||
|
|
@ -217,6 +231,7 @@ InputState read_input(const Game& game, bool bot, const InputFrame& frame) {
|
|||
in.dash = frame.dash;
|
||||
in.skill_concrete = frame.skill_concrete;
|
||||
in.skill_warp = frame.skill_warp;
|
||||
in.skill_fluorescent = frame.skill_fluorescent;
|
||||
in.toggle_autoplay = frame.toggle_autoplay;
|
||||
in.restart = frame.restart;
|
||||
return in;
|
||||
|
|
@ -254,9 +269,21 @@ int main(int argc, char** argv) {
|
|||
Game game(opts.seed, opts.level_path != nullptr ? opts.level_path
|
||||
: Floor::kDefaultPath);
|
||||
game.state = (opts.bot || opts.hiss_test || opts.room_test || opts.aoe_test
|
||||
|| opts.floor_overview || opts.plaza_test || opts.office_test)
|
||||
|| opts.floor_overview || opts.plaza_test || opts.office_test
|
||||
|| opts.blackout_test)
|
||||
? GameState::Playing : GameState::Title;
|
||||
game.config.no_player_damage = opts.no_damage;
|
||||
game.blackout_auto = opts.blackout_auto;
|
||||
if (opts.blackout_test) {
|
||||
// Dev entry: drop the agent through the screen with the chain ready.
|
||||
game.player.pos = game.blackout.screen_pos();
|
||||
game.blackout.begin(game.events);
|
||||
if (opts.blackout_reveal) {
|
||||
game.blackout.dev_reveal(game.events);
|
||||
// Step back so the QA capture shows the case before it is claimed.
|
||||
game.player.pos = game.blackout.phone(0);
|
||||
}
|
||||
}
|
||||
Presenter presenter;
|
||||
presenter.init(game.config.arena_half, game.floor);
|
||||
TraceLog(LOG_INFO, "GFX: concrete filtering = %s",
|
||||
|
|
@ -383,6 +410,7 @@ int main(int argc, char** argv) {
|
|||
input.dash = false;
|
||||
input.skill_concrete = false;
|
||||
input.skill_warp = false;
|
||||
input.skill_fluorescent = false;
|
||||
input.toggle_autoplay = false;
|
||||
input.restart = false;
|
||||
}
|
||||
|
|
@ -412,10 +440,13 @@ int main(int argc, char** argv) {
|
|||
// Only the scene renders into the post-FX target: bloom, corruption and
|
||||
// the damage flash must never tint the HUD. The default raw palette
|
||||
// draws straight to the backbuffer — no full-res render target or blit.
|
||||
const Color scene_clear = game.blackout.active()
|
||||
? Color{5, 5, 8, 255}
|
||||
: Color{24, 24, 27, 255};
|
||||
if (use_post) {
|
||||
PROF_BEGIN_CPU(profiler::Sec_Scene);
|
||||
BeginTextureMode(post_target);
|
||||
ClearBackground(Color{24, 24, 27, 255});
|
||||
ClearBackground(scene_clear);
|
||||
presenter.draw_scene(game);
|
||||
EndTextureMode();
|
||||
PROF_END_CPU(profiler::Sec_Scene);
|
||||
|
|
@ -488,7 +519,7 @@ int main(int argc, char** argv) {
|
|||
Vector2{0.0f, 0.0f}, WHITE);
|
||||
EndShaderMode();
|
||||
} else {
|
||||
ClearBackground(Color{24, 24, 27, 255});
|
||||
ClearBackground(scene_clear);
|
||||
PROF_BEGIN_CPU(profiler::Sec_Scene);
|
||||
presenter.draw_scene(game);
|
||||
PROF_END_CPU(profiler::Sec_Scene);
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ void ModelBank::init() {
|
|||
shader_ok_ = shader_.id != 0;
|
||||
if (shader_ok_) {
|
||||
loc_time_ = GetShaderLocation(shader_, "uTime");
|
||||
loc_alpha_ = GetShaderLocation(shader_, "uAlpha");
|
||||
loc_flash_ = GetShaderLocation(shader_, "uFlash");
|
||||
loc_corruption_ = GetShaderLocation(shader_, "uCorruption");
|
||||
loc_camera_ = GetShaderLocation(shader_, "uCameraPos");
|
||||
|
|
@ -181,7 +182,8 @@ void ModelBank::begin_frame(float time, float corruption, Vector3 camera_pos) {
|
|||
|
||||
void ModelBank::draw(ActorModel id, Vector3 pos, float yaw, float scale,
|
||||
Color tint, float flash, bool outline, float walk,
|
||||
float stagger, float phase, float hiss, Vector3 stretch) {
|
||||
float stagger, float phase, float hiss, Vector3 stretch,
|
||||
float alpha) {
|
||||
const Vector3 draw_scale = stretch.x > 0.0f
|
||||
? stretch : Vector3{scale, scale, scale};
|
||||
const float yaw_degrees = yaw * RAD2DEG;
|
||||
|
|
@ -215,9 +217,17 @@ void ModelBank::draw(ActorModel id, Vector3 pos, float yaw, float scale,
|
|||
SetShaderValue(shader_, loc_hiss_, &hiss_value, SHADER_UNIFORM_FLOAT);
|
||||
}
|
||||
|
||||
if (shader_ok_ && loc_alpha_ >= 0)
|
||||
SetShaderValue(shader_, loc_alpha_, &alpha, SHADER_UNIFORM_FLOAT);
|
||||
const bool translucent = alpha < 0.999f;
|
||||
if (translucent) {
|
||||
rlSetBlendMode(RL_BLEND_ALPHA);
|
||||
rlDisableDepthMask();
|
||||
}
|
||||
|
||||
// Ink silhouette: expanded back faces first, then the lit model over them.
|
||||
// One extra draw call only for the guard / future bosses — never the horde.
|
||||
if (outline && shader_ok_ && loc_outline_ >= 0) {
|
||||
if (outline && !translucent && shader_ok_ && loc_outline_ >= 0) {
|
||||
const float on = 1.0f;
|
||||
const float off = 0.0f;
|
||||
SetShaderValue(shader_, loc_outline_, &on, SHADER_UNIFORM_FLOAT);
|
||||
|
|
@ -234,6 +244,7 @@ void ModelBank::draw(ActorModel id, Vector3 pos, float yaw, float scale,
|
|||
}
|
||||
DrawModelEx(entries_[index].model, pos, Vector3{0.0f, 1.0f, 0.0f}, yaw_degrees,
|
||||
draw_scale, tint);
|
||||
if (translucent) rlEnableDepthMask();
|
||||
}
|
||||
|
||||
void ModelBank::update_animation(ActorModel id, const char* name, float dt,
|
||||
|
|
@ -320,6 +331,9 @@ float ModelBank::height(ActorModel id) {
|
|||
case ActorModel::GarbageCan: return 0.72f;
|
||||
case ActorModel::DocumentStack: return 0.06f;
|
||||
case ActorModel::LooseSheet: return 0.02f;
|
||||
case ActorModel::PhoneTable: return 1.1f;
|
||||
case ActorModel::CaseFrame: return 2.2f;
|
||||
case ActorModel::CaseGlass: return 2.0f;
|
||||
case ActorModel::ArchiveShelf: return 2.8f;
|
||||
case ActorModel::ThermoFrame: return 4.6f;
|
||||
case ActorModel::ThermoPanel: return 4.0f;
|
||||
|
|
@ -358,6 +372,9 @@ const char* ModelBank::file_name(ActorModel id) {
|
|||
case ActorModel::GarbageCan: return "assets/models/props/garbage_can.glb";
|
||||
case ActorModel::DocumentStack: return "assets/models/props/document_stack.glb";
|
||||
case ActorModel::LooseSheet: return "assets/models/props/loose_sheet.glb";
|
||||
case ActorModel::PhoneTable: return "assets/models/props/phone_table.glb";
|
||||
case ActorModel::CaseFrame: return "assets/models/props/case_frame.glb";
|
||||
case ActorModel::CaseGlass: return "assets/models/props/case_glass.glb";
|
||||
case ActorModel::ArchiveShelf: return "assets/models/props/archive_shelf.glb";
|
||||
case ActorModel::ThermoFrame: return "assets/models/props/thermo_frame.glb";
|
||||
case ActorModel::ThermoPanel: return "assets/models/props/thermo_panel.glb";
|
||||
|
|
@ -375,6 +392,7 @@ bool ModelBank::actor_from_name(const std::string& name, ActorModel& id) {
|
|||
"Hotline", "TV", "Pedestal", "Duck", "Cabinet", "Crate", "Debris", "Switch",
|
||||
"OfficeDesk", "MeetingTable", "OfficeChair", "Computer", "Plant", "Sofa",
|
||||
"FloorLamp", "Partition", "GarbageCan", "DocumentStack", "LooseSheet",
|
||||
"PhoneTable", "CaseFrame", "CaseGlass",
|
||||
"ArchiveShelf", "ThermoFrame", "ThermoPanel",
|
||||
"RoundBasic", "RoundTuned", "RoundOvercharge", "MuzzleFlash",
|
||||
};
|
||||
|
|
@ -491,6 +509,20 @@ void ModelBank::draw_fallback(ActorModel id, Vector3 pos, float yaw,
|
|||
DrawCube({0.0f, 2.0f * scale, 0.0f}, 3.7f * scale,
|
||||
4.0f * scale, 0.34f * scale, tint);
|
||||
break;
|
||||
case ActorModel::PhoneTable:
|
||||
DrawCube({0.0f, 0.8f * scale, 0.0f}, 1.2f * scale,
|
||||
0.12f * scale, 0.8f * scale, tint);
|
||||
DrawCube({0.0f, 1.0f * scale, 0.0f}, 0.5f * scale,
|
||||
0.2f * scale, 0.4f * scale, RED);
|
||||
break;
|
||||
case ActorModel::CaseFrame:
|
||||
DrawCube({0.0f, 2.0f * scale, 0.0f}, 2.0f * scale,
|
||||
0.3f * scale, 1.5f * scale, YELLOW);
|
||||
break;
|
||||
case ActorModel::CaseGlass:
|
||||
DrawCube({0.0f, 1.0f * scale, 0.0f}, 1.7f * scale,
|
||||
1.8f * scale, 1.2f * scale, Fade(SKYBLUE, 0.2f));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ enum class ActorModel {
|
|||
Hotline, TV, Pedestal, Duck, Cabinet, Crate, Debris, Switch,
|
||||
OfficeDesk, MeetingTable, OfficeChair, Computer, Plant, Sofa, FloorLamp,
|
||||
Partition, GarbageCan, DocumentStack, LooseSheet,
|
||||
PhoneTable, CaseFrame, CaseGlass, // projector-screen blackout ritual
|
||||
ArchiveShelf, ThermoFrame, ThermoPanel,
|
||||
RoundBasic, RoundTuned, RoundOvercharge, MuzzleFlash,
|
||||
Count
|
||||
|
|
@ -31,10 +32,11 @@ public:
|
|||
// `outline` adds a back-face ink silhouette (guard / bosses, not the horde).
|
||||
// `stretch` overrides the uniform scale per axis when non-zero (thermo
|
||||
// door frames scale across a threshold without growing taller).
|
||||
// `alpha` < 1 draws the model with depth-mask-free alpha blending (glass).
|
||||
void draw(ActorModel id, Vector3 pos, float yaw, float scale, Color tint,
|
||||
float flash = 0.0f, bool outline = false, float walk = 0.0f,
|
||||
float stagger = 0.0f, float phase = 0.0f, float hiss = 0.0f,
|
||||
Vector3 stretch = {0.0f, 0.0f, 0.0f});
|
||||
Vector3 stretch = {0.0f, 0.0f, 0.0f}, float alpha = 1.0f);
|
||||
|
||||
// Plays a named GLB action on a skinned model (dt in seconds, 60 fps clips).
|
||||
// blend_seconds > 0 cross-fades from the outgoing clip into the new one via
|
||||
|
|
@ -67,6 +69,7 @@ private:
|
|||
Shader shader_{};
|
||||
Texture2D ramp_{};
|
||||
int loc_time_ = -1;
|
||||
int loc_alpha_ = -1;
|
||||
int loc_flash_ = -1;
|
||||
int loc_corruption_ = -1;
|
||||
int loc_camera_ = -1;
|
||||
|
|
|
|||
|
|
@ -1099,6 +1099,68 @@ void Presenter::draw_environment(const Game& game, const ViewCull& cull) {
|
|||
}
|
||||
}
|
||||
|
||||
// Inside the projector screen the House goes dark: only the agent, the ringing
|
||||
// phone tables and (once earned) the glass case survive the blackout.
|
||||
void Presenter::draw_blackout(Game& game) {
|
||||
const BlackoutSequence& b = game.blackout;
|
||||
const Vec2 p = game.player.pos;
|
||||
const Vec2 centre = b.screen_pos();
|
||||
|
||||
DrawCube({centre.x, -0.09f, centre.y + 10.0f}, 52.0f, 0.12f, 46.0f,
|
||||
Color{17, 18, 22, 255});
|
||||
|
||||
const Vector3 cam_fwd = Vector3Normalize(
|
||||
Vector3Subtract(camera_.target, camera_.position));
|
||||
const Vector3 cam_right = Vector3Normalize(
|
||||
Vector3CrossProduct(cam_fwd, camera_.up));
|
||||
const Vector3 cam_up = Vector3CrossProduct(cam_right, cam_fwd);
|
||||
|
||||
QuadBatch glow_batch;
|
||||
const Texture2D glow_tex = spr_glow_.id != 0 ? spr_glow_ : soft_disc_;
|
||||
glow_batch.begin(glow_tex);
|
||||
|
||||
for (int i = 0; i < BlackoutSequence::kPhoneCount; ++i) {
|
||||
const Vec2 q = b.phone(i);
|
||||
const bool answered = b.phone_answered(i);
|
||||
const float pulse = 0.5f + 0.5f * std::sin(anim_time_ * 4.0f + i * 0.7f);
|
||||
const float ring_flash = answered ? 0.0f : 0.25f + 0.4f * pulse;
|
||||
models_.draw(ActorModel::PhoneTable, {q.x, 0.0f, q.y}, 0.0f, 0.78f,
|
||||
answered ? Color{80, 80, 86, 255} : WHITE, ring_flash,
|
||||
false, 0.0f, 0.0f, anim_time_ * (answered ? 0.2f : 1.2f));
|
||||
if (!answered) {
|
||||
DrawCylinder({q.x, 0.04f, q.y}, 1.5f, 1.5f, 0.012f, 14,
|
||||
Color{255, 45, 55, static_cast<unsigned char>(110 + 60 * pulse)});
|
||||
glow_batch.add_billboard({q.x, 1.35f, q.y}, 6.0f, 6.0f,
|
||||
cam_right, cam_up,
|
||||
Color{255, 80, 90, 255});
|
||||
glow_batch.add_ground({q.x, 0.02f, q.y}, 2.2f,
|
||||
Color{220, 30, 40, 120});
|
||||
}
|
||||
}
|
||||
|
||||
if (b.phase() == BlackoutPhase::CaseRevealed) {
|
||||
const Vec2 c = b.case_pos();
|
||||
models_.draw(ActorModel::CaseFrame, {c.x, 0.0f, c.y}, 0.0f, 1.5f, WHITE);
|
||||
models_.draw(ActorModel::Switch, {c.x, 0.0f, c.y}, 0.0f, 2.2f,
|
||||
WHITE, 0.0f, false, 0.0f, 0.0f, 0.0f, 0.55f);
|
||||
// Glass last, blended, with the switch visible through the panes.
|
||||
models_.draw(ActorModel::CaseGlass, {c.x, 0.0f, c.y}, 0.0f, 1.5f,
|
||||
Color{190, 225, 235, 255}, 0.0f, false, 0.0f, 0.0f, 0.0f,
|
||||
0.0f, {0.0f, 0.0f, 0.0f}, 0.30f);
|
||||
DrawCylinder({c.x, 0.06f, c.y}, 3.0f, 3.0f, 0.02f, 24,
|
||||
Color{245, 197, 24, 120});
|
||||
glow_batch.add_billboard({c.x, 1.3f, c.y}, 4.5f, 4.5f,
|
||||
cam_right, cam_up, Color{245, 197, 24, 70});
|
||||
}
|
||||
|
||||
const float player_yaw = std::atan2(game.player.facing.x,
|
||||
game.player.facing.y);
|
||||
models_.draw(ActorModel::Guard, {p.x, 0.0f, p.y}, player_yaw, 1.0f,
|
||||
WHITE, game.player.hit_flash, true);
|
||||
glow_batch.add_ground({p.x, 0.02f, p.y}, 1.1f, Color{245, 197, 24, 70});
|
||||
glow_batch.draw();
|
||||
}
|
||||
|
||||
void Presenter::draw_scene(Game& game) {
|
||||
for (int i = 0; i < game.events.count; ++i) {
|
||||
const GameEvent& e = game.events.items[i];
|
||||
|
|
@ -1110,7 +1172,14 @@ void Presenter::draw_scene(Game& game) {
|
|||
// Both skills telegraph their landing zone; only concrete kicks up
|
||||
// dust, warp uses the teal containment palette.
|
||||
const bool warp = (e.flags & static_cast<unsigned>(SkillType::Warp)) != 0;
|
||||
if (warp) {
|
||||
const bool fluorescent =
|
||||
(e.flags & static_cast<unsigned>(SkillType::Fluorescent)) != 0;
|
||||
if (fluorescent) {
|
||||
spawn_sparks(e.pos, 0.8f, Color{245, 220, 120, 255}, 20, 4.0f);
|
||||
aura_.spawn_ground({e.pos.x, 0.09f, e.pos.y},
|
||||
std::max(1.0f, e.magnitude), 1.4f, anim_time_);
|
||||
shake_ = std::max(shake_, 0.12f);
|
||||
} else if (warp) {
|
||||
spawn_sparks(e.pos, 0.6f, Color{80, 225, 205, 255}, 12, 3.0f);
|
||||
} else {
|
||||
concrete_debris_.burst(game.player.pos, 1.2f, 6);
|
||||
|
|
@ -1127,6 +1196,19 @@ void Presenter::draw_scene(Game& game) {
|
|||
anim_time_);
|
||||
spawn_sparks(e.pos, 0.9f, Color{120, 240, 220, 255}, 16, 4.5f);
|
||||
shake_ = std::max(shake_, 0.22f);
|
||||
} else if (e.type == EventType::BlackoutStart) {
|
||||
shake_ = std::max(shake_, 0.3f);
|
||||
aura_.spawn_ground({e.pos.x, 0.09f, e.pos.y}, 6.0f, 1.6f, anim_time_);
|
||||
spawn_sparks(e.pos, 1.6f, Color{255, 60, 70, 255}, 18, 4.0f);
|
||||
} else if (e.type == EventType::BlackoutPhone) {
|
||||
spawn_sparks(e.pos, 1.0f, Color{255, 70, 80, 255}, 10, 3.0f);
|
||||
shake_ = std::max(shake_, 0.06f);
|
||||
} else if (e.type == EventType::BlackoutCase) {
|
||||
aura_.spawn_ground({e.pos.x, 0.09f, e.pos.y}, 3.0f, 4.0f, anim_time_);
|
||||
spawn_sparks(e.pos, 1.6f, Color{245, 197, 24, 255}, 26, 4.5f);
|
||||
} else if (e.type == EventType::BlackoutComplete) {
|
||||
shake_ = std::max(shake_, 0.35f);
|
||||
spawn_sparks(e.pos, 1.8f, Color{255, 240, 190, 255}, 32, 5.0f);
|
||||
} else if (e.type == EventType::EnemyKilled) {
|
||||
shake_ = std::max(shake_, 0.10f);
|
||||
spawn_sparks(e.pos, 0.9f, Color{255, 60, 50, 255}, 8, 3.4f);
|
||||
|
|
@ -1224,6 +1306,7 @@ void Presenter::draw_scene(Game& game) {
|
|||
const float sx = static_cast<float>(GetRandomValue(-100, 100)) / 100.0f * shake_;
|
||||
const float sy = static_cast<float>(GetRandomValue(-100, 100)) / 100.0f * shake_;
|
||||
const Vec2 p = game.player.pos;
|
||||
const BlackoutSequence& b = game.blackout;
|
||||
// Keep the arena rim out of frame when the player hugs a wall — showing
|
||||
// the unlit floor beyond the curb breaks the contained-facility illusion.
|
||||
const float margin = 10.0f;
|
||||
|
|
@ -1233,7 +1316,13 @@ void Presenter::draw_scene(Game& game) {
|
|||
: game.config.arena_half - margin;
|
||||
const float cx = std::clamp(p.x, -bound_x, bound_x);
|
||||
const float cz = std::clamp(p.y, -bound_z, bound_z);
|
||||
if (floor_overview_) {
|
||||
if (game.blackout.active()) {
|
||||
// Wide overhead framing so the whole 5 x 4 phone grid and the agent
|
||||
// fit in one shot — the player must see every table in the dark.
|
||||
const Vec2 focus{b.screen_pos().x, b.screen_pos().y + 12.0f};
|
||||
camera_.position = {focus.x, 44.0f, focus.y + 5.0f};
|
||||
camera_.target = {focus.x, 0.0f, focus.y};
|
||||
} else if (floor_overview_) {
|
||||
camera_.position = {0.0f, Floor::kHeight * 1.23f, 0.01f};
|
||||
camera_.target = {0.0f, 0.0f, 0.0f};
|
||||
} else if (hiss_test_) {
|
||||
|
|
@ -1271,6 +1360,12 @@ void Presenter::draw_scene(Game& game) {
|
|||
Vector3CrossProduct(cam_fwd, camera_.up));
|
||||
const Vector3 cam_up = Vector3CrossProduct(cam_right, cam_fwd);
|
||||
|
||||
if (game.blackout.active()) {
|
||||
draw_blackout(game);
|
||||
EndMode3D();
|
||||
return;
|
||||
}
|
||||
|
||||
draw_environment(game, cull);
|
||||
scorch_.draw(camera_.position);
|
||||
dressing_.draw(models_, anim_time_, {cx, cz});
|
||||
|
|
|
|||
|
|
@ -69,6 +69,8 @@ public:
|
|||
private:
|
||||
void draw_environment(const Game& game, const ViewCull& cull);
|
||||
void draw_floor_environment(const Game& game, const ViewCull& cull);
|
||||
// Projector-screen pocket: black room, player, red phone tables, glass case.
|
||||
void draw_blackout(Game& game);
|
||||
void draw_initial_scene(const Game& game, const ViewCull& cull);
|
||||
void draw_office_suite(const Game& game, const ViewCull& cull);
|
||||
void spawn_sparks(Vec2 pos, float height, Color color, int count, float speed);
|
||||
|
|
|
|||
|
|
@ -39,6 +39,15 @@ void draw_skill_icon(const Game& game, SkillType type, float x, float y,
|
|||
DrawRectangle(x + 20.0f, y + 23.0f, 18.0f, 7.0f, stamp);
|
||||
DrawRectangle(x + 14.0f, y + 31.0f, 30.0f, 7.0f, stamp);
|
||||
DrawRectangle(x + 10.0f, y + 39.0f, 38.0f, 8.0f, stamp);
|
||||
} else if (type == SkillType::Fluorescent) {
|
||||
// Fluorescent tube with light rays.
|
||||
DrawRectangle(x + 22.0f, y + 26.0f, 14.0f, 16.0f, stamp);
|
||||
DrawLine(static_cast<int>(x) + 29, static_cast<int>(y) + 18,
|
||||
static_cast<int>(x) + 29, static_cast<int>(y) + 22, stamp);
|
||||
DrawLine(static_cast<int>(x) + 14, static_cast<int>(y) + 34,
|
||||
static_cast<int>(x) + 19, static_cast<int>(y) + 34, stamp);
|
||||
DrawLine(static_cast<int>(x) + 39, static_cast<int>(y) + 34,
|
||||
static_cast<int>(x) + 44, static_cast<int>(y) + 34, stamp);
|
||||
} else {
|
||||
// Concentric collapse rings.
|
||||
DrawCircleLines(x + 29.0f, y + 34.0f, 16.0f, stamp);
|
||||
|
|
@ -129,8 +138,10 @@ void draw_hud(const Game& game) {
|
|||
ui_font::draw_text(objective, px + panel_w / 2 - ow / 2, 46, 16,
|
||||
Color{232, 228, 220, 235});
|
||||
if (game.floor_banner > 0.0f) {
|
||||
const char* banner = game.has_key
|
||||
? "THRESHOLD KEY ACQUIRED" : "FLOOR CLEARED — THE HOUSE NOTICED";
|
||||
const char* banner = game.floor_banner_text != nullptr
|
||||
? game.floor_banner_text
|
||||
: (game.has_key ? "THRESHOLD KEY ACQUIRED"
|
||||
: "FLOOR CLEARED — THE HOUSE NOTICED");
|
||||
const int bw = ui_font::measure_text(banner, 18);
|
||||
ui_font::draw_text(banner, GetScreenWidth() / 2 - bw / 2, 108, 18,
|
||||
Color{245, 197, 24, 250});
|
||||
|
|
@ -179,6 +190,35 @@ void draw_hud(const Game& game) {
|
|||
ui_font::draw_text(done, 20, 70.0f, 16, Color{245, 197, 24, 255});
|
||||
}
|
||||
|
||||
// Projector-screen blackout: progress card replaces the ritual prompt.
|
||||
if (game.blackout.active()) {
|
||||
const float card_x = GetScreenWidth() / 2.0f - 230.0f;
|
||||
DrawRectangle(card_x, 84.0f, 460.0f, 78.0f, Color{8, 8, 11, 235});
|
||||
DrawRectangleLines(card_x, 84.0f, 460.0f, 78.0f,
|
||||
Color{245, 197, 24, 200});
|
||||
ui_font::draw_text("BLACKOUT - THE HOUSE IS RINGING",
|
||||
static_cast<int>(card_x) + 12, 91, 16,
|
||||
Color{245, 197, 24, 255});
|
||||
char phones[64];
|
||||
std::snprintf(phones, sizeof(phones), "PHONES ANSWERED %d / %d",
|
||||
game.blackout.answered(),
|
||||
BlackoutSequence::kPhoneCount);
|
||||
ui_font::draw_text(phones, static_cast<int>(card_x) + 12, 114, 15,
|
||||
Color{230, 226, 218, 255});
|
||||
if (game.blackout.phase() == BlackoutPhase::CaseRevealed) {
|
||||
ui_font::draw_text("LIGHT SWITCH UNGUARDED - ENTER THE CASE",
|
||||
static_cast<int>(card_x) + 12, 137, 13,
|
||||
Color{245, 197, 24, 255});
|
||||
} else {
|
||||
for (int i = 0; i < BlackoutSequence::kPhoneCount; ++i) {
|
||||
const Color dot = game.blackout.phone_answered(i)
|
||||
? Color{245, 197, 24, 255}
|
||||
: Color{90, 26, 32, 255};
|
||||
DrawRectangle(card_x + 12.0f + i * 21.0f, 142.0f, 15.0f, 9.0f, dot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Owned OoP loadout (left column).
|
||||
float oy = 84.0f;
|
||||
ui_font::draw_text("OoP LOADOUT", 20, oy, 16, Color{245, 197, 24, 235});
|
||||
|
|
@ -219,11 +259,16 @@ void draw_hud(const Game& game) {
|
|||
// label, since autoplay drives the whole SkillSystem.
|
||||
{
|
||||
constexpr float kSize = 58.0f, kGap = 22.0f;
|
||||
const float total = kSize * 2.0f + kGap;
|
||||
const bool have_fluoro = game.skill_system.fluorescent_unlocked;
|
||||
const int icon_count = have_fluoro ? 3 : 2;
|
||||
const float total = kSize * icon_count + kGap * (icon_count - 1);
|
||||
const float x0 = GetScreenWidth() / 2.0f - total / 2.0f;
|
||||
const float y = GetScreenHeight() - 110.0f;
|
||||
draw_skill_icon(game, SkillType::ConcreteCall, x0, y, "J");
|
||||
draw_skill_icon(game, SkillType::Warp, x0 + kSize + kGap, y, "K");
|
||||
if (have_fluoro)
|
||||
draw_skill_icon(game, SkillType::Fluorescent,
|
||||
x0 + 2.0f * (kSize + kGap), y, "U");
|
||||
|
||||
const SkillSystem& skills = game.skill_system;
|
||||
const char* mode = !skills.autoplay_enabled ? "OFF"
|
||||
|
|
|
|||
79
tests/blackout_test.cpp
Normal file
79
tests/blackout_test.cpp
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
// 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;
|
||||
}
|
||||
195
tools/blender/build_blackout_props.py
Normal file
195
tools/blender/build_blackout_props.py
Normal file
|
|
@ -0,0 +1,195 @@
|
|||
# tools/blender/build_blackout_props.py
|
||||
# FBC: NIGHT SHIFT — Blackout ritual props.
|
||||
#
|
||||
# Run inside Blender 5.x:
|
||||
# exec(open("/home/dandovlatov/Documents/cntrl/tools/blender/build_blackout_props.py").read())
|
||||
#
|
||||
# Three sculpted set pieces for the projector-screen blackout ritual:
|
||||
# phone_table - a desk with a ringing red hotline (the sequence nodes)
|
||||
# case_frame - the opaque plinth, corner posts and yellow Board roof
|
||||
# case_glass - the four translucent panes (drawn with alpha in the game)
|
||||
# Each exports as one GLB with one merged mesh / painted vertex colours.
|
||||
|
||||
import math
|
||||
import os
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
from mathutils import Vector
|
||||
|
||||
REPO = "/home/dandovlatov/Documents/cntrl"
|
||||
MODEL_DIR = os.path.join(REPO, "assets", "models", "props")
|
||||
BLEND_DIR = os.path.join(REPO, "assets", "blender")
|
||||
CONCEPT_DIR = os.path.join(REPO, "docs", "concept")
|
||||
for d in (MODEL_DIR, BLEND_DIR, CONCEPT_DIR):
|
||||
os.makedirs(d, exist_ok=True)
|
||||
|
||||
sys.path.insert(0, os.path.join(REPO, "tools", "blender"))
|
||||
import importlib
|
||||
import actor_kit as K
|
||||
importlib.reload(K)
|
||||
|
||||
K.clear_scene()
|
||||
P = K.PALETTE
|
||||
P.update({"plastic": "#2a2d33", "glass": "#9fc4cf",
|
||||
"concrete_lt": "#9d9c96", "brass": "#b89348"})
|
||||
|
||||
|
||||
def rect(rx, ry):
|
||||
return [(-rx, -ry), (rx, -ry), (rx, ry), (-rx, ry)]
|
||||
|
||||
|
||||
def build_phone_table():
|
||||
r = K.new_actor("PhoneTable")
|
||||
K.plate(r, "top", rect(0.62, 0.40), 0.79, 0.85, 1.0, P["plastic"])
|
||||
K.plate(r, "top_edge", rect(0.64, 0.42), 0.77, 0.80, 1.0, P["steel_dk"])
|
||||
for sx in (-1, 1):
|
||||
for sy in (-1, 1):
|
||||
K.tube(r, "leg_%d_%d" % (sx, sy),
|
||||
[(sx * 0.50, sy * 0.30, 0.02),
|
||||
(sx * 0.52, sy * 0.31, 0.79)],
|
||||
[0.045, 0.038], P["steel_dk"], sides=6)
|
||||
K.plate(r, "drawer", rect(0.42, 0.02), 0.64, 0.76, 1.0,
|
||||
P["redaction"], shift=(0, -0.40))
|
||||
K.tube(r, "drawer_pull", [(-0.12, -0.43, 0.70), (0.12, -0.43, 0.70)],
|
||||
[0.016, 0.016], P["brass"], sides=6)
|
||||
K.blob(r, "phone_base", (0, 0, 0.92), (0.27, 0.20, 0.075),
|
||||
P["hiss"], subdiv=3, seed=11, ao=0.05)
|
||||
K.tube(r, "handset",
|
||||
[(-0.28, -0.02, 1.07), (-0.15, -0.13, 1.10),
|
||||
(0.15, -0.13, 1.10), (0.28, -0.02, 1.07)],
|
||||
[0.050, 0.044, 0.044, 0.050], P["hiss_hot"], sides=10)
|
||||
K.ring(r, "dial", (0, -0.09, 0.985), 0.095, 0.014,
|
||||
P["redaction"], segments=10)
|
||||
for i in range(6):
|
||||
a = 2.0 * math.pi * i / 6
|
||||
K.crystal(r, "dial_hole_%d" % i,
|
||||
(math.cos(a) * 0.072, -0.09 + math.sin(a) * 0.072, 0.99),
|
||||
0.016, P["hiss_hot"], sides=4, seed=20 + i)
|
||||
K.crystal(r, "indicator", (0.20, -0.16, 0.995), 0.040,
|
||||
P["hiss_hot"], sides=5, seed=3)
|
||||
K.tube(r, "cord",
|
||||
[(0.28, -0.02, 1.07), (0.38, -0.20, 0.94),
|
||||
(0.22, -0.36, 0.88), (0.04, -0.30, 0.93)],
|
||||
[0.012, 0.011, 0.011, 0.011], P["redaction"], sides=5)
|
||||
return r
|
||||
|
||||
|
||||
def build_case_frame():
|
||||
r = K.new_actor("CaseFrame")
|
||||
K.plate(r, "plinth", rect(0.88, 0.66), 0.0, 0.13, 1.0,
|
||||
P["concrete_lt"], ao=0.10)
|
||||
K.plate(r, "plinth_trim", rect(0.92, 0.70), 0.10, 0.15, 1.0,
|
||||
P["brass"], ao=0.04)
|
||||
for sx in (-1, 1):
|
||||
for sy in (-1, 1):
|
||||
K.tube(r, "post_%d_%d" % (sx, sy),
|
||||
[(sx * 0.83, sy * 0.61, 0.15),
|
||||
(sx * 0.83, sy * 0.61, 1.93)],
|
||||
[0.042, 0.042], P["steel_dk"], sides=6)
|
||||
K.plate(r, "top_rim", rect(0.90, 0.68), 1.90, 1.97, 1.0,
|
||||
P["brass"], ao=0.03)
|
||||
K.plate(r, "yellow_roof", rect(0.98, 0.75), 1.97, 2.12, 0.80,
|
||||
P["board"], ao=0.02)
|
||||
K.plate(r, "roof_seal", rect(0.22, 0.045), 2.13, 2.145, 1.0,
|
||||
P["redaction"], shift=(0, -0.48), ao=0.0)
|
||||
return r
|
||||
|
||||
|
||||
def build_case_glass():
|
||||
r = K.new_actor("CaseGlass")
|
||||
K.plate(r, "pane_front", rect(0.81, 0.012), 0.16, 1.90, 1.0,
|
||||
P["glass"], shift=(0, -0.60), ao=0.0)
|
||||
K.plate(r, "pane_back", rect(0.81, 0.012), 0.16, 1.90, 1.0,
|
||||
P["glass"], shift=(0, 0.60), ao=0.0)
|
||||
K.plate(r, "pane_left", rect(0.012, 0.60), 0.16, 1.90, 1.0,
|
||||
P["glass"], shift=(-0.83, 0), ao=0.0)
|
||||
K.plate(r, "pane_right", rect(0.012, 0.60), 0.16, 1.90, 1.0,
|
||||
P["glass"], shift=(0.83, 0), ao=0.0)
|
||||
return r
|
||||
|
||||
|
||||
BUILDERS = [
|
||||
("phone_table", build_phone_table, 1400),
|
||||
("case_frame", build_case_frame, 700),
|
||||
("case_glass", build_case_glass, 200),
|
||||
]
|
||||
|
||||
exported = []
|
||||
roots = {}
|
||||
for name, builder, cap in BUILDERS:
|
||||
root = builder()
|
||||
K.merge_actor(root, name)
|
||||
tris = K.triangle_count(root)
|
||||
print("[budget] %-12s %5d tris (cap %d) %s"
|
||||
% (name, tris, cap, "OK" if tris <= cap else "OVER"))
|
||||
out = os.path.join(MODEL_DIR, name + ".glb")
|
||||
K.export_actor(root, name, out)
|
||||
roots[name] = root
|
||||
exported.append((name, tris, os.path.getsize(out)))
|
||||
|
||||
# Concept-only: make the panes see-through in the render (the game handles
|
||||
# transparency with its own uAlpha path; the exported GLB is unchanged).
|
||||
glass_concept = bpy.data.materials.new("glass_concept")
|
||||
glass_concept.use_nodes = True
|
||||
glass_concept.surface_render_method = "BLENDED"
|
||||
concept_bsdf = next(n for n in glass_concept.node_tree.nodes
|
||||
if n.type == "BSDF_PRINCIPLED")
|
||||
concept_bsdf.inputs["Alpha"].default_value = 0.16
|
||||
for pane in roots["case_glass"].children_recursive:
|
||||
if pane.type == "MESH":
|
||||
pane.data.materials.clear()
|
||||
pane.data.materials.append(glass_concept)
|
||||
|
||||
# ---- concept lineup -------------------------------------------------------
|
||||
# Assemble the case around the existing lightswitch for the composition shot.
|
||||
bpy.ops.object.select_all(action="DESELECT")
|
||||
bpy.ops.import_scene.gltf(filepath=os.path.join(MODEL_DIR, "switch.glb"))
|
||||
switch_root = bpy.context.object
|
||||
for name, x in (("phone_table", -2.4), ("case_frame", 0.6),
|
||||
("case_glass", 0.6)):
|
||||
roots[name].location.x = x
|
||||
switch_root.location = (0.6, 0, -0.16)
|
||||
switch_root.scale = (1.7, 1.7, 1.7)
|
||||
|
||||
world = bpy.data.worlds.new("BlackoutWorld")
|
||||
bpy.context.scene.world = world
|
||||
world.use_nodes = True
|
||||
bg = next(n for n in world.node_tree.nodes if n.type == "BACKGROUND")
|
||||
bg.inputs["Color"].default_value = (*K.rgb("#08090c"), 1.0)
|
||||
bg.inputs["Strength"].default_value = 0.6
|
||||
|
||||
for name, loc, power, col in (
|
||||
("Key", (-3, -7, 7), 1800, "#eef2ff"),
|
||||
("PhoneRed", (-4, -1, 3), 900, "#ff3b46"),
|
||||
("BoardYellow", (3, -2, 6), 1400, "#f5c518"),
|
||||
):
|
||||
data = bpy.data.lights.new(name, "AREA")
|
||||
data.energy = power
|
||||
data.shape = "DISK"
|
||||
data.size = 6
|
||||
data.color = K.rgb(col)
|
||||
obj = bpy.data.objects.new(name, data)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
obj.location = loc
|
||||
obj.rotation_euler = (Vector((0, 0, 1)) - Vector(loc)).to_track_quat("-Z", "Y").to_euler()
|
||||
|
||||
cam_data = bpy.data.cameras.new("BlackoutCam")
|
||||
cam = bpy.data.objects.new("BlackoutCam", cam_data)
|
||||
bpy.context.scene.collection.objects.link(cam)
|
||||
cam.location = (0.4, -9.5, 4.2)
|
||||
cam.rotation_euler = (Vector((0.6, 0, 1.1)) - cam.location).to_track_quat("-Z", "Y").to_euler()
|
||||
cam_data.lens = 42
|
||||
scene = bpy.context.scene
|
||||
scene.camera = cam
|
||||
engines = [i.identifier for i in bpy.types.RenderSettings.bl_rna.properties["engine"].enum_items]
|
||||
scene.render.engine = "BLENDER_EEVEE_NEXT" if "BLENDER_EEVEE_NEXT" in engines else engines[0]
|
||||
scene.render.resolution_x = 1200
|
||||
scene.render.resolution_y = 560
|
||||
scene.render.image_settings.file_format = "PNG"
|
||||
scene.render.filepath = os.path.join(CONCEPT_DIR, "blackout_props_lineup.png")
|
||||
bpy.ops.render.render(write_still=True)
|
||||
|
||||
bpy.ops.wm.save_as_mainfile(filepath=os.path.join(BLEND_DIR, "fbc_blackout_props.blend"))
|
||||
print("[done] blackout props:", ", ".join("%s(%d tris)" % (n, t)
|
||||
for n, t, _ in exported))
|
||||
Loading…
Add table
Reference in a new issue