FBC: NIGHT SHIFT - scaled the floor plan, opened up interiors and added thermo door thresholds

This commit is contained in:
dandovlatov 2026-11-24 05:31:19 +04:00
parent 893ea48a95
commit 4657d17cb1
17 changed files with 360 additions and 71 deletions

View file

@ -32,7 +32,9 @@ Art is tracked in `docs/ENV_ENHANCEMENT.md` (S0–S16). The floor is now a
room (Blender-built desks, computers, chairs, meeting table, plants, sofas,
lamps and partitions); see `src/render/layout.hpp` for the shared anchors.
**Playable Floor 01 (Security & Administration)** is now the default run layout:
the 160 × 120 m walled blockout from `docs/MAP_FLOW.md` — Security Gate →
the walled blockout from `docs/MAP_FLOW.md`, authored in 160 × 120 m map space
and scaled by `Floor::kScale` (1.5) to a live 240 × 180 m, with Control-style
thermo thresholds between the main rooms — Security Gate →
Central Plaza (the original hub scene: carpet, pillars, OoPs) → Projector Room →
Office Suite (full S16 GLB office kit, right of Silos) → Silos → Threshold
Stairwell, plus four side rooms — with real wall collision, room-local spawning,

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -67,16 +67,18 @@ Floor plate **160 × 120 m at 6 px/m**; grid 10 m. Room schedule (SVG lines 117
| # | Room | Size (m) | Role (per legend / MAP_FLOW §3) |
|---|---|---|---|
| 1 | Security Gate / Checkpoint | 48 × 26 | Spawn, turnstiles, guard desk, Clearance 01 barrier, first radio line, no combat initially |
| 2 | Central Plaza | 94 × 42 | Hub: red carpet cross, pillar grid, TV / Hotline / Duck / Pedestal OoPs, debris, Hiss spill; first horde arena |
| 3 | Projector Room / Briefing | 26 × 42 | Hiss briefing reel; **Projector OoP ritual → run skill**; seating rows |
| 4 | Office Suite | 76 × 36 | Repurposed S16 open-plan GLB kit (desks, computers, chairs, partitions, meeting table, sofas, lamps, plants, cabinets, crates) on a teal island |
| 5 | Silos | 52 × 36 | Storage vaults / world objects; **Threshold Key vault**; some guarded by a Hiss Brute |
| 6 | Threshold Stairwell | 26 × 6 | Red hazard door above Silos; key consumed; floor jump → motel → L2 |
| A | Records Archive | 14 × 34 | Side: records / lore / key chance |
| B | Locker Room | 16 × 32 | Side: shard greed |
| C | Janitor Closet | 40 × 18 | Side: Ahti chore flavour |
| D | Security Booth | 46 × 26 | Side: world-object cache |
Live sizes include `Floor::kScale` (1.5); authored map sizes are 2/3 of these.
| 1 | Security Gate / Checkpoint | 144 × 39 | Spawn, records-archive shelf aisles (no collision), guard desk, Clearance 01 barrier, first radio line, no combat initially |
| 2 | Central Plaza | 141 × 63 | Hub: red carpet cross, four-pillar grid, TV / Hotline / Duck / Pedestal OoPs, debris, Hiss spill; first horde arena |
| 3 | Projector Room / Briefing | 39 × 63 | Hiss briefing reel; **Projector OoP ritual → run skill**; seating rows |
| 4 | Office Suite | 114 × 54 | Repurposed S16 open-plan GLB kit (desks, computers, chairs, partitions, meeting table, sofas, lamps, plants, cabinets, crates) on a teal island |
| 5 | Silos | 78 × 54 | Storage vaults / world objects; **Threshold Key vault**; some guarded by a Hiss Brute |
| 6 | Threshold Stairwell | 39 × 9 | Red hazard door above Silos; key consumed; floor jump → motel → L2 |
| A | Records Archive | 21 × 51 | Side: records / lore / key chance |
| B | Locker Room | 24 × 48 | Side: shard greed |
| C | Janitor Closet | 42 × 27 | Side: Ahti chore flavour |
| D | Security Booth | 24 × 36 | Side: world-object cache |
**Intended route** is explicitly drawn and labelled: **1 → 2 → 3 → 4 → 5 → 6** (SVG arrows at lines 78–82; legend at 127–131). The design notes add:
- Gate has three exits but only one is **lit**; others open with clearance/keys (`MAP_FLOW.md:90-91`).
@ -144,9 +146,9 @@ All 10 rooms are hardcoded; dimensions match the SVG exactly. World bounds are d
**Corridors** (visual floor slabs, `floor.cpp:46-55`): 8 — Gate↔Plaza, Plaza↔Projector, Plaza↔Silos, Plaza↔Office, Silos↔Office, Office↔Projector, Projector↔Archive, Silos↔Stairwell.
**Props** (`floor.cpp:108-125`): 6 turnstiles, 6 pillars, 1 screen + 4 seats (Projector), 6 silos, 11 shelves (side rooms), 1 hazard door, 1 key. `PropKind::Desk` and `PropKind::MeetingTable` exist in the enum but are never placed. Only pillars participate in collision; all other props and both the key and hazard door are visual only.
**Props** (`floor.cpp:119-146`): 9 archive shelf rows (Gate, visual only), 4 pillars (blocking), 1 screen + 4 seats (Projector), 6 silos, 11 shelves (side rooms), 1 hazard door, 1 key. `PropKind::Desk` and `PropKind::MeetingTable` exist in the enum but are never placed. Only walls and pillars participate in collision; all other props, the thermo thresholds and both the key and hazard door are visual only.
**Spawns:** player at `to_world(80,13)` = world `(0,47)` inside the Gate (`floor.hpp:60`). Enemies use `Floor::spawn_near()` (`floor.cpp:186-207`), constrained to **the player's current room** (32 polar tries at 22–34 m, then 24 in-room tries, then a resolve fallback). No fixed enemy spawn points or "enemy rooms".
**Spawns:** player at `to_world(80,13)` = world `(0,70.5)` inside the Gate (`floor.hpp:60`). Enemies use `Floor::spawn_near()`, constrained to **the player's current room** (32 polar tries at 22–34 m × `Floor::kScale`, then 24 in-room tries, then a resolve fallback). No fixed enemy spawn points or "enemy rooms".
**Key → door → floor jump** (`game.cpp:206-230`): key at map (55,106) = world (−25,−46) in Silos, picked up at radius 3.0. Door trigger at map (29,117) = world (−51,−57) in the Stairwell, radius 4.0, requiring `has_key` + Stairwell room. On success: `corruption.floor_cleared()` (+0.35 corruption), `++floor_number`, `++floor_clears`, clear enemies/pickups/buffs/rituals, respawn at Gate. **The geometry never changes.**

View file

@ -61,25 +61,32 @@ See `docs/maps/floor_01_security.svg` (and `.png`) for the 2D plan.
Floor plate: **160 x 120 m**, 6 px per metre. Intended route is **1 -> 2 -> 3 ->
4 -> 5 -> 6**; side rooms are optional detours.
1. **Security Gate / Checkpoint** (48 x 26 m) — spawn. Turnstiles, a guard desk,
the Clearance 01 barrier. First radio line, first redaction pickup. No combat
for the first few seconds; teaches move + Evade.
2. **Central Plaza** (94 x 42 m) — the big open centre of the floor, carrying the
*original hub scene*: red carpet cross, the pillar grid, TV / Hotline / Duck /
Pedestal OoPs, drifting debris and a Hiss spill. Six solid pillars give cover
without turning it into a maze. This is the first real horde arena.
3. **Projector Room / Briefing** (26 x 42 m) — right of the plaza. A Hiss briefing
All rooms below are authored in the original 160 x 120 m map space and scaled
by `Floor::kScale` (1.5) at runtime, so the live floor is 240 x 180 m and each
room has 2.25x its authored area. Room-to-room thresholds carry Control-style
thermo door frames with retracted panels; they are walkable and never gate the
critical path.
1. **Security Gate / Checkpoint** (144 x 39 m) — spawn. Records-archive shelf
aisles (set dressing only), a guard desk, the Clearance 01 barrier. First
radio line, first redaction pickup. No combat for the first few seconds;
teaches move + Evade.
2. **Central Plaza** (141 x 63 m) — the big open centre of the floor, carrying the
*original hub scene*: red carpet cross, a four-pillar grid, TV / Hotline /
Duck / Pedestal OoPs, drifting debris and a Hiss spill. This is the first real
horde arena.
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.
4. **Office Suite** (76 x 36 m) — directly **right of the Silos**, the repurposed
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
island. A wide right-hand chamber that reads as the "previous level" brought
into Floor 01.
5. **Silos** (52 x 36 m) — storage vaults at the top left, where "different
5. **Silos** (78 x 54 m) — storage vaults at the top left, where "different
objects live": the director scatters §4.6 world objects here, some guarded by
a Hiss Brute. Threshold Key vault is here.
6. **Threshold Stairwell** (26 x 6 m) — red hazard door above the Silos; key
6. **Threshold Stairwell** (39 x 9 m) — red hazard door above the Silos; key
consumed, floor jump, motel, then L2.
Side rooms: **Records Archive** (key chance / lore), **Locker Room** (shard

View file

@ -3,6 +3,7 @@
#include "core/rng.hpp"
#include "game/corruption.hpp"
#include "game/enemies.hpp"
#include "game/floor.hpp"
#include "game/player.hpp"
// RoR2 combat director, verbatim structure:
@ -32,8 +33,8 @@ struct DirectorConfig {
float burst_fraction = 0.92f; // bank this full -> release a squad
int burst_count = 3; // cards in that squad
float credit_cap = 240.0f;
float spawn_radius_min = 22.0f;
float spawn_radius_max = 34.0f;
float spawn_radius_min = 22.0f * Floor::kScale;
float spawn_radius_max = 34.0f * Floor::kScale;
};
class Director {

View file

@ -31,7 +31,7 @@ std::vector<Span> segments(float a0, float a1, const std::vector<Span>& gaps) {
Floor::Floor() {
rooms_ = {
{"SECURITY GATE", rect_from_map(56, 0, 104, 26), RoomKind::Gate, 1},
{"SECURITY GATE", rect_from_map(40, 0, 136, 26), RoomKind::Gate, 1},
{"CENTRAL PLAZA", rect_from_map(18, 30, 112, 72), RoomKind::Plaza, 2},
{"PROJECTOR ROOM",rect_from_map(116, 30, 142, 72), RoomKind::Projector, 3},
{"OFFICE SUITE", rect_from_map(70, 76, 146, 112), RoomKind::OfficeSuite, 4},
@ -39,8 +39,8 @@ Floor::Floor() {
{"THRESHOLD STAIRWELL", rect_from_map(16, 114, 42, 120), RoomKind::Stairwell, 6},
{"RECORDS ARCHIVE", rect_from_map(146, 34, 160, 68), RoomKind::Side, 0, 0},
{"LOCKER ROOM", rect_from_map(0, 36, 16, 68), RoomKind::Side, 0, 1},
{"JANITOR CLOSET", rect_from_map(6, 4, 46, 22), RoomKind::Side, 0, 2},
{"SECURITY BOOTH", rect_from_map(110, 0, 156, 26), RoomKind::Side, 0, 3},
{"JANITOR CLOSET", rect_from_map(6, 4, 34, 22), RoomKind::Side, 0, 2},
{"SECURITY BOOTH", rect_from_map(142, 2, 158, 26), RoomKind::Side, 0, 3},
};
corridors_ = {
@ -52,21 +52,25 @@ Floor::Floor() {
rect_from_map(116, 72, 132, 76),
rect_from_map(142, 46, 146, 54),
rect_from_map(24, 112, 36, 114),
rect_from_map(104, 14, 110, 18),
rect_from_map(46, 14, 56, 18),
rect_from_map(136, 14, 142, 18),
rect_from_map(34, 14, 40, 18),
rect_from_map(16, 46, 18, 54),
};
auto hwall = [&](float y, float x0, float x1, std::vector<Span> gaps,
float h = 3.2f) {
for (const Span& s : segments(x0, x1, gaps)) {
walls_.push_back({rect_from_map(s.first, y - 0.35f, s.second, y + 0.35f), h});
const Vec2 a = to_world(s.first, y), b = to_world(s.second, y);
walls_.push_back({{std::min(a.x, b.x), a.y - 0.35f,
std::max(a.x, b.x), a.y + 0.35f}, h});
}
};
auto vwall = [&](float x, float y0, float y1, std::vector<Span> gaps,
float h = 3.2f) {
for (const Span& s : segments(y0, y1, gaps)) {
walls_.push_back({rect_from_map(x - 0.35f, s.first, x + 0.35f, s.second), h});
const Vec2 a = to_world(x, s.first), b = to_world(x, s.second);
walls_.push_back({{a.x - 0.35f, std::min(a.y, b.y),
a.x + 0.35f, std::max(a.y, b.y)}, h});
}
};
auto room_walls = [&](float x0, float y0, float x1, float y1,
@ -78,7 +82,7 @@ Floor::Floor() {
vwall(x1, y0, y1, std::move(right));
};
room_walls(56, 0, 104, 26, {{76, 84}}, {{72, 88}}, {{14, 18}}, {{14, 18}});
room_walls(40, 0, 136, 26, {{76, 84}}, {{72, 88}}, {{14, 18}}, {{14, 18}});
room_walls(18, 30, 112, 72, {{72, 88}}, {{34, 50}, {76, 100}},
{{46, 54}}, {{44, 56}});
room_walls(116, 30, 142, 72, {}, {{116, 132}}, {{44, 56}}, {{46, 54}});
@ -87,8 +91,8 @@ Floor::Floor() {
room_walls(16, 114, 42, 120, {{24, 36}}, {}, {}, {});
room_walls(146, 34, 160, 68, {}, {}, {{46, 54}}, {});
room_walls(0, 36, 16, 68, {}, {}, {}, {{46, 54}});
room_walls(6, 4, 46, 22, {}, {}, {}, {{14, 18}});
room_walls(110, 0, 156, 26, {}, {}, {{14, 18}}, {});
room_walls(6, 4, 34, 22, {}, {}, {}, {{14, 18}});
room_walls(142, 2, 158, 26, {}, {}, {{14, 18}}, {});
hwall(0, 0, 160, {{76, 84}}, 4.2f);
hwall(120, 0, 160, {}, 4.2f);
@ -102,25 +106,25 @@ Floor::Floor() {
walls_.push_back({rect_from_map(x0, y0, x1, y1), 3.2f,
static_cast<int>(id)});
};
door_wall(DoorId::Janitor, 46, 14, 56, 18);
door_wall(DoorId::Booth, 104, 14, 110, 18);
door_wall(DoorId::Janitor, 34, 14, 40, 18);
door_wall(DoorId::Booth, 136, 14, 142, 18);
door_wall(DoorId::Locker, 16, 46, 18, 54);
// The central plaza keeps the original hub's pillar grid: real collision,
// not just set dressing.
const float pillars[][2] = {
{47,38},{83,38},{47,64},{83,64},{65,36},{65,66},
};
const float pillars[][2] = {{47,38},{83,38},{47,64},{83,64}};
for (const auto& p : pillars) {
walls_.push_back({rect_from_map(p[0] - 1.3f, p[1] - 1.3f,
p[0] + 1.3f, p[1] + 1.3f), 4.0f});
const Vec2 c = to_world(p[0], p[1]);
walls_.push_back({{c.x - 1.3f, c.y - 1.3f, c.x + 1.3f, c.y + 1.3f}, 4.0f});
}
auto add = [&](PropKind kind, float mx, float my, float w, float d, float h) {
props_.push_back({kind, to_world(mx, my), w, d, h});
};
for (float x : {64.0f, 70.0f, 76.0f, 82.0f, 88.0f, 94.0f})
add(PropKind::Turnstile, x, 12.0f, 0.8f, 14.0f, 1.4f);
// Records archive aisles: steel shelf rows are set dressing only, so the
// gate stays free to move through. Collision lives in walls_ alone.
for (float x : {50.0f, 60.0f, 70.0f, 76.0f, 82.0f, 88.0f, 98.0f, 110.0f, 122.0f})
add(PropKind::ArchiveShelf, x, 12.0f, 14.1f, 0.92f, 2.8f);
for (const auto& p : pillars) add(PropKind::Pillar, p[0], p[1], 2.6f, 2.6f, 4.0f);
add(PropKind::Screen, 129, 69, 24.0f, 0.8f, 9.0f);
for (float y : {38.0f, 46.0f, 54.0f, 62.0f})

View file

@ -35,7 +35,7 @@ struct FloorRoom {
int side_index = -1; // 0..3 for the four side rooms
};
enum class PropKind { Turnstile, Desk, MeetingTable, Screen, Seat, Silo, Shelf, HazardDoor, Key, Pillar };
enum class PropKind { Turnstile, Desk, MeetingTable, Screen, Seat, Silo, Shelf, ArchiveShelf, HazardDoor, Key, Pillar };
struct FloorProp {
PropKind kind = PropKind::Desk;
@ -52,14 +52,22 @@ class Floor {
public:
Floor();
static constexpr float kWidth = 160.0f;
static constexpr float kHeight = 120.0f;
// Authored map coordinates stay in the original 160 x 120 space; one
// scale turns the whole facility into a more spacious arena. Wall
// thickness and prop sizes remain in metres, so scaling adds no geometry.
static constexpr float kScale = 1.5f;
static constexpr float kMapWidth = 160.0f;
static constexpr float kMapHeight = 120.0f;
static constexpr float kWidth = kMapWidth * kScale;
static constexpr float kHeight = kMapHeight * kScale;
static constexpr int kSideRoomCount = 4;
static Vec2 to_world(float map_x, float map_y) {
return {map_x - kWidth * 0.5f, kHeight * 0.5f - map_y};
static constexpr Vec2 to_world(float map_x, float map_y) {
return {(map_x - kMapWidth * 0.5f) * kScale,
(kMapHeight * 0.5f - map_y) * kScale};
}
static Vec2 to_map(Vec2 p) {
return {p.x + kWidth * 0.5f, kHeight * 0.5f - p.y};
static constexpr Vec2 to_map(Vec2 p) {
return {p.x / kScale + kMapWidth * 0.5f,
kMapHeight * 0.5f - p.y / kScale};
}
Vec2 spawn() const { return to_world(80.0f, 13.0f); }

View file

@ -2,6 +2,7 @@
#include "core/math.hpp"
#include "game/buffs.hpp"
#include "game/floor.hpp"
#include "game/enemies.hpp"
#include "game/player.hpp"
@ -29,17 +30,17 @@ enum class RitualType { TV, Lightswitch, Projector };
constexpr int kRitualTypeCount = 3;
struct RitualSystem {
static constexpr Vec2 kTVPos = {13.0f, 17.0f};
static constexpr Vec2 kTVPos = Floor::to_world(93.0f, 43.0f);
static constexpr float kTVRadius = 5.0f;
static constexpr float kTVDuration = 60.0f;
// L1's signature beat: the briefing reel in the Projector Room. Map
// (129, 60) -> world (49, -2), in front of the projection screen.
static constexpr Vec2 kProjectorPos = {49.0f, -2.0f};
// L1's signature beat: the briefing reel in the Projector Room, in front
// of the projection screen.
static constexpr Vec2 kProjectorPos = Floor::to_world(129.0f, 60.0f);
static constexpr float kProjectorRadius = 4.0f;
static constexpr float kProjectorDuration = 20.0f;
static constexpr Vec2 kLightSwitchPos = {0.0f, -8.0f};
static constexpr Vec2 kLightSwitchPos = Floor::to_world(80.0f, 68.0f);
static constexpr float kSwitchRadius = 3.0f;
static constexpr float kSwitchObjectsRingRadius = 2.5f;
static constexpr int kSwitchObjectsRequired = 3;

View file

@ -210,7 +210,9 @@ 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) {
float stagger, float phase, float hiss, Vector3 stretch) {
const Vector3 draw_scale = stretch.x > 0.0f
? stretch : Vector3{scale, scale, scale};
const float yaw_degrees = yaw * RAD2DEG;
const int index = static_cast<int>(id);
if (index < 0 || index >= static_cast<int>(ActorModel::Count)) return;
@ -250,7 +252,7 @@ void ModelBank::draw(ActorModel id, Vector3 pos, float yaw, float scale,
SetShaderValue(shader_, loc_outline_, &on, SHADER_UNIFORM_FLOAT);
rlSetCullFace(RL_CULL_FACE_FRONT);
DrawModelEx(entries_[index].model, pos, Vector3{0.0f, 1.0f, 0.0f}, yaw_degrees,
Vector3{scale, scale, scale}, tint);
draw_scale, tint);
rlSetCullFace(RL_CULL_FACE_BACK);
SetShaderValue(shader_, loc_outline_, &off, SHADER_UNIFORM_FLOAT);
}
@ -260,7 +262,7 @@ void ModelBank::draw(ActorModel id, Vector3 pos, float yaw, float scale,
SetShaderValue(shader_, loc_flash_, &f, SHADER_UNIFORM_FLOAT);
}
DrawModelEx(entries_[index].model, pos, Vector3{0.0f, 1.0f, 0.0f}, yaw_degrees,
Vector3{scale, scale, scale}, tint);
draw_scale, tint);
}
void ModelBank::update_animation(ActorModel id, const char* name, float dt,
@ -374,6 +376,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::ArchiveShelf: return 2.8f;
case ActorModel::ThermoFrame: return 4.6f;
case ActorModel::ThermoPanel: return 4.0f;
case ActorModel::RoundBasic: return 0.4f;
case ActorModel::RoundTuned: return 0.5f;
case ActorModel::RoundOvercharge: return 0.6f;
@ -409,6 +414,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::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";
case ActorModel::RoundBasic: return "assets/models/projectile_1.glb";
case ActorModel::RoundTuned: return "assets/models/projectile_2.glb";
case ActorModel::RoundOvercharge: return "assets/models/projectile_3.glb";
@ -504,6 +512,21 @@ void ModelBank::draw_fallback(ActorModel id, Vector3 pos, float yaw,
case ActorModel::MuzzleFlash:
DrawSphere({0.0f, 0.0f, 0.0f}, 0.22f * scale, tint);
break;
case ActorModel::ArchiveShelf:
DrawCube({0.0f, 1.4f * scale, 0.0f}, 14.1f * scale,
2.8f * scale, 0.92f * scale, tint);
break;
case ActorModel::ThermoFrame:
for (const float sx : {-3.85f, 3.85f})
DrawCube({sx * scale, 2.3f * scale, 0.0f}, 0.3f * scale,
4.6f * scale, 1.2f * scale, tint);
DrawCube({0.0f, 4.3f * scale, 0.0f}, 8.0f * scale,
0.55f * scale, 1.2f * scale, tint);
break;
case ActorModel::ThermoPanel:
DrawCube({0.0f, 2.0f * scale, 0.0f}, 3.7f * scale,
4.0f * scale, 0.34f * scale, tint);
break;
default:
break;
}

View file

@ -10,6 +10,7 @@ enum class ActorModel {
Hotline, TV, Pedestal, Duck, Cabinet, Crate, Debris, Switch,
OfficeDesk, MeetingTable, OfficeChair, Computer, Plant, Sofa, FloorLamp,
Partition, GarbageCan, DocumentStack, LooseSheet,
ArchiveShelf, ThermoFrame, ThermoPanel,
RoundBasic, RoundTuned, RoundOvercharge, MuzzleFlash,
Count
};
@ -26,9 +27,12 @@ public:
// Draws one actor. `flash` is a 0..1 hit flash; `yaw` rotates around Y.
// `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).
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);
float stagger = 0.0f, float phase = 0.0f, float hiss = 0.0f,
Vector3 stretch = {0.0f, 0.0f, 0.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

View file

@ -55,8 +55,9 @@ float actor_flash(float timer, float scale) {
class ViewCull {
public:
void init(const Camera3D& camera, float aspect) {
void init(const Camera3D& camera, float aspect, float max_depth = 180.0f) {
cam_ = camera.position;
max_depth_ = max_depth;
forward_ = Vector3Normalize(
Vector3Subtract(camera.target, camera.position));
right_ = Vector3CrossProduct(forward_, Vector3{0.0f, 1.0f, 0.0f});
@ -71,13 +72,14 @@ public:
bool visible(float x, float y, float z, float radius) const {
const Vector3 d{x - cam_.x, y - cam_.y, z - cam_.z};
const float depth = Vector3DotProduct(d, forward_);
if (depth < -radius || depth > 180.0f + radius) return false;
if (depth < -radius || depth > max_depth_ + radius) return false;
return std::abs(Vector3DotProduct(d, right_)) <= depth * tan_x_ + radius
&& std::abs(Vector3DotProduct(d, up_)) <= depth * tan_y_ + radius;
}
private:
Vector3 cam_{};
float max_depth_ = 180.0f;
Vector3 forward_{};
Vector3 right_{};
Vector3 up_{};
@ -321,12 +323,13 @@ void Presenter::init(float arena_half, const Floor& floor) {
if (floor_mode_) {
// Room identity is now a low-strength tint in concrete.fs instead of
// opaque plates: the PBR concrete stays visible under every room.
for (float x = -80.0f; x <= 80.0f; x += 10.0f) {
b.add_box({x, 0.037f, 0.0f}, {0.06f, 0.007f, 120.0f},
const float gx = Floor::kWidth * 0.5f, gz = Floor::kHeight * 0.5f;
for (float x = -gx; x <= gx; x += 15.0f) {
b.add_box({x, 0.037f, 0.0f}, {0.06f, 0.007f, Floor::kHeight},
Color{34, 34, 39, 255});
}
for (float z = -60.0f; z <= 60.0f; z += 10.0f) {
b.add_box({0.0f, 0.037f, z}, {160.0f, 0.007f, 0.06f},
for (float z = -gz; z <= gz; z += 15.0f) {
b.add_box({0.0f, 0.037f, z}, {Floor::kWidth, 0.007f, 0.06f},
Color{34, 34, 39, 255});
}
} else {
@ -648,6 +651,11 @@ void Presenter::draw_floor_environment(const Game& game, const ViewCull& cull) {
case PropKind::Shelf:
DrawCube({p.pos.x, p.h * 0.5f + 0.05f, p.pos.y}, p.w, p.h, p.d, shelf);
break;
case PropKind::ArchiveShelf:
models_.draw(ActorModel::ArchiveShelf,
{p.pos.x, 0.0f, p.pos.y}, 1.5707963f,
p.w / 14.1f, WHITE);
break;
case PropKind::HazardDoor:
DrawCube({p.pos.x, p.h * 0.5f + 0.05f, p.pos.y}, p.w, p.h, p.d,
Color{160, 32, 40, 255});
@ -679,8 +687,8 @@ void Presenter::draw_floor_environment(const Game& game, const ViewCull& cull) {
// stripe; once stamped they read as open frames with a green threshold.
struct DoorVisual { DoorId id; Vec2 a, b; };
const DoorVisual door_visuals[] = {
{DoorId::Janitor, Floor::to_world(46, 14), Floor::to_world(56, 18)},
{DoorId::Booth, Floor::to_world(104, 14), Floor::to_world(110, 18)},
{DoorId::Janitor, Floor::to_world(34, 14), Floor::to_world(40, 18)},
{DoorId::Booth, Floor::to_world(136, 14), Floor::to_world(142, 18)},
{DoorId::Locker, Floor::to_world(16, 46), Floor::to_world(18, 54)},
};
for (const DoorVisual& d : door_visuals) {
@ -703,6 +711,35 @@ void Presenter::draw_floor_environment(const Game& game, const ViewCull& cull) {
}
}
// Control-style thermo thresholds at the four main room connections.
// Frames are scaled across the gap only; panels stay 4 m tall and sit
// retracted into the jambs, so the passage is always walkable.
struct ThermoDoor { Vec2 center; float span; float yaw; };
const ThermoDoor thermo[] = {
{Floor::to_world(80, 28), 16.0f * Floor::kScale, 0.0f},
{Floor::to_world(114, 50), 12.0f * Floor::kScale, 1.5707963f},
{Floor::to_world(42, 74), 16.0f * Floor::kScale, 0.0f},
{Floor::to_world(88, 74), 24.0f * Floor::kScale, 0.0f},
};
auto thermo_prop = [&](ActorModel id, float x, float z, float yaw,
Vector3 stretch) {
models_.draw(id, {x, 0.0f, z}, yaw, 1.0f, WHITE, 0.0f, false,
0.0f, 0.0f, 0.0f, 0.0f, stretch);
};
for (const ThermoDoor& d : thermo) {
if (!cull.visible(d.center.x, 2.3f, d.center.y, d.span * 0.5f + 1.0f))
continue;
thermo_prop(ActorModel::ThermoFrame, d.center.x, d.center.y, d.yaw,
{d.span / 8.0f, 1.0f, 1.0f});
for (const float side : {-1.0f, 1.0f}) {
const float off = side * d.span * 0.6f;
thermo_prop(ActorModel::ThermoPanel,
d.center.x + std::cos(d.yaw) * off,
d.center.y - std::sin(d.yaw) * off,
d.yaw, {d.span * 0.5f / 3.7f, 1.0f, 1.0f});
}
}
// Ritual anchors: TV and Light Switch are in the Plaza; the Projector is
// in the Projector Room (Floor 01's signature OoP ritual).
if (cull.visible(RitualSystem::kTVPos.x, 1.0f, RitualSystem::kTVPos.y, 2.5f))
@ -1198,7 +1235,7 @@ void Presenter::draw_scene(Game& game) {
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_) {
camera_.position = {0.0f, 148.0f, 0.01f};
camera_.position = {0.0f, Floor::kHeight * 1.23f, 0.01f};
camera_.target = {0.0f, 0.0f, 0.0f};
} else if (hiss_test_) {
camera_.position = {0.0f, 3.4f, 3.2f};
@ -1211,7 +1248,8 @@ void Presenter::draw_scene(Game& game) {
camera_.fovy = tuning_.fov;
ViewCull cull;
cull.init(camera_, static_cast<float>(GetScreenWidth())
/ static_cast<float>(std::max(1, GetScreenHeight())));
/ static_cast<float>(std::max(1, GetScreenHeight())),
Floor::kWidth * 2.0f);
if (tier_wave_pending_) {
// Reusable scene wave: also callable for boss entrances / events.
aura_.spawn_ground({p.x, 0.09f, p.y}, 11.0f, 2.6f, anim_time_);

View file

@ -0,0 +1,95 @@
# tools/blender/build_archive_shelf.py
# FBC: NIGHT SHIFT — records archive shelf row for the Security Gate refit.
#
# Run headlessly:
# blender --background --factory-startup --python tools/blender/build_archive_shelf.py
#
# One merged mesh / one material, painted-vertex path via actor_kit. The row is
# 14 m long along local X, 0.9 m deep along local Y and 2.8 m tall along Z.
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")
os.makedirs(MODEL_DIR, exist_ok=True)
os.makedirs(BLEND_DIR, 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({"folder_tan": "#c8b99b", "folder_red": "#7d2028",
"folder_blue": "#3b4a5e", "folder_paper": "#b5b0a3"})
def box(root, name, cx, cy, z0, dx, dy, dz, value, ao=0.06):
hw, hd = dx * 0.5, dy * 0.5
return K.plate(root, name,
[(-hw, -hd), (hw, -hd), (hw, hd), (-hw, hd)],
z0, z0 + dz, 1.0, value, shift=(cx, cy), ao=ao)
def build_archive_shelf():
r = K.new_actor("ArchiveShelf")
length, depth, height = 14.0, 0.92, 2.8
bays = 5
bay_len = length / bays
levels = (0.28, 0.96, 1.64, 2.32)
folders = (P["folder_tan"], P["folder_blue"], P["folder_red"],
P["redaction"], P["folder_paper"])
for i in range(bays + 1):
x = -length * 0.5 + i * bay_len
box(r, "upright_%d" % i, x, 0.0, 0.0, 0.10, depth, height,
P["steel_dk"], ao=0.12)
for b in range(bays):
cx = -length * 0.5 + (b + 0.5) * bay_len
for li, z in enumerate(levels):
box(r, "board_%d_%d" % (b, li), cx, 0.0, z,
bay_len - 0.12, depth - 0.06, 0.055, P["steel"], ao=0.10)
for k in range(3):
fx = cx - bay_len * 0.30 + k * bay_len * 0.30
dz = 0.30 + 0.035 * ((b + k + li) % 3)
box(r, "file_%d_%d_%d" % (b, li, k), fx, 0.0, z + 0.055,
bay_len * 0.25, depth - 0.18, dz,
folders[(b * 2 + k + li) % len(folders)], ao=0.04)
box(r, "label", length * 0.5 - 0.09, 0.0, 2.08, 0.035, depth * 0.7,
0.48, P["board"], ao=0.0)
return r
root = build_archive_shelf()
tris = K.triangle_count(root)
K.merge_actor(root, "ArchiveShelf")
path = os.path.join(MODEL_DIR, "archive_shelf.glb")
K.export_actor(root, "ArchiveShelf", path)
bpy.ops.wm.save_as_mainfile(
filepath=os.path.join(BLEND_DIR, "fbc_archive_shelf.blend"))
print("[archive_shelf] %d tris -> %s (%d bytes)" %
(tris, path, os.path.getsize(path)))
scene = bpy.context.scene
scene.render.engine = "BLENDER_WORKBENCH"
scene.display.shading.light = "STUDIO"
scene.display.shading.color_type = "VERTEX"
scene.render.resolution_x = 960
scene.render.resolution_y = 540
cam_data = bpy.data.cameras.new("ShelfPreview")
cam = bpy.data.objects.new("ShelfPreview", cam_data)
scene.collection.objects.link(cam)
cam.location = (12.0, -15.0, 8.0)
cam.rotation_euler = (Vector((0.0, 0.0, 1.4)) - cam.location).to_track_quat(
"-Z", "Y").to_euler()
scene.camera = cam
scene.render.filepath = "/tmp/opencode/archive_shelf.png"
bpy.ops.render.render(write_still=True)

View file

@ -0,0 +1,104 @@
# tools/blender/build_thermo_door.py
# FBC: NIGHT SHIFT — Control-style thermo door kit for room thresholds.
#
# Run headlessly:
# blender --background --factory-startup --python tools/blender/build_thermo_door.py
#
# Two GLBs: a fixed frame and one symmetric sliding panel (drawn twice, one
# per side, so retracted panels cost two draw calls). Both use the repo's
# one-mesh / painted-vertex path via actor_kit.
import math
import os
import sys
import bpy
from mathutils import Euler, Vector
REPO = "/home/dandovlatov/Documents/cntrl"
MODEL_DIR = os.path.join(REPO, "assets", "models", "props")
BLEND_DIR = os.path.join(REPO, "assets", "blender")
os.makedirs(MODEL_DIR, exist_ok=True)
os.makedirs(BLEND_DIR, 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 = dict(K.PALETTE)
P.update({"hazard": "#f5c518"})
def box(root, name, cx, cy, z0, dx, dy, dz, value, ao=0.06):
hw, hd = dx * 0.5, dy * 0.5
return K.plate(root, name,
[(-hw, -hd), (hw, -hd), (hw, hd), (-hw, hd)],
z0, z0 + dz, 1.0, value, shift=(cx, cy), ao=ao)
def place(obj, rot=(0.0, 0.0, 0.0), offset=(0.0, 0.0, 0.0)):
mat = Euler(rot).to_matrix()
shift = Vector(offset)
for v in obj.data.vertices:
v.co = shift + mat @ v.co
obj.data.update()
return obj
def build_frame():
r = K.new_actor("ThermoFrame")
for sx in (-1, 1):
box(r, "jamb_%d" % sx, sx * 3.85, 0.0, 0.0, 0.30, 1.20, 4.60,
P["steel_dk"], 0.10)
box(r, "track_%d" % sx, sx * 3.62, 0.0, 0.12, 0.10, 0.90, 4.20,
P["redaction"], 0.02)
box(r, "lintel", 0.0, 0.0, 4.05, 8.0, 1.20, 0.55, P["steel_dk"], 0.08)
box(r, "sill", 0.0, 0.0, 0.0, 8.0, 1.20, 0.16, P["steel"], 0.08)
for sx in (-1, 1):
for i in range(8):
box(r, "chev_%d_%d" % (sx, i), sx * 3.85, -0.61, 0.35 + i * 0.5,
0.22, 0.02, 0.18,
P["hazard"] if i % 2 == 0 else P["redaction"], 0.0)
box(r, "plate", 0.0, -0.61, 4.12, 2.2, 0.02, 0.32, P["hazard"], 0.0)
for i in range(5):
box(r, "plate_bar_%d" % i, -0.8 + i * 0.4, -0.63, 4.2,
0.18, 0.02, 0.10, P["redaction"], 0.0)
return r
def build_panel():
r = K.new_actor("ThermoPanel")
for sx in (-1, 1):
box(r, "edge_%d" % sx, sx * 1.76, 0.0, 0.0, 0.18, 0.34, 4.0,
P["steel_dk"], 0.10)
box(r, "top", 0.0, 0.0, 3.82, 3.7, 0.34, 0.18, P["steel_dk"], 0.08)
box(r, "bottom", 0.0, 0.0, 0.0, 3.7, 0.34, 0.18, P["steel_dk"], 0.08)
box(r, "face", 0.0, -0.18, 0.18, 3.34, 0.03, 3.64, P["hiss_dull"], 0.06)
box(r, "seam", 0.0, -0.205, 0.20, 0.05, 0.02, 3.55, P["redaction"], 0.0)
box(r, "band", 0.0, -0.21, 1.78, 3.20, 0.02, 0.50, P["hazard"], 0.0)
for i in range(7):
box(r, "band_bar_%d" % i, -1.32 + i * 0.44, -0.225, 1.76,
0.16, 0.02, 0.54, P["redaction"], 0.0)
ring = K.ring(r, "lock_ring", (0, 0, 0), 0.44, 0.055,
P["steel"], segments=16)
place(ring, rot=(math.pi / 2, 0, 0), offset=(0, -0.235, 2.65))
disc = K.plate(r, "lock_disc", K.octagon(0.34), -0.02, 0.02, 1.0,
P["hiss"], ao=0.0)
place(disc, rot=(math.pi / 2, 0, 0), offset=(0, -0.25, 2.65))
return r
for name, fn, builder in (("ThermoFrame", "thermo_frame.glb", build_frame),
("ThermoPanel", "thermo_panel.glb", build_panel)):
root = builder()
tris = K.triangle_count(root)
K.merge_actor(root, name)
path = os.path.join(MODEL_DIR, fn)
K.export_actor(root, name, path)
print("[%s] %d tris -> %s (%d bytes)" %
(name, tris, path, os.path.getsize(path)))
bpy.ops.wm.save_as_mainfile(
filepath=os.path.join(BLEND_DIR, "fbc_thermo_door.blend"))