diff --git a/README.md b/README.md index 760f9e2..408da01 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ You are a nameless FBC worker who never resonated. Your Objects of Power have a - **Move-only combat** — WASD + dash, four auto-firing OoPs. Press `J`/`K`/`L` to steer CONCRETE CALL, WARP and PUSH (`U` for FLUORESCENT once earned); `Tab` toggles autoplay. - **Rituals as rewards** — complete an OoP's ritual and it becomes a permanent skill for the run (Mega Man structure, Control skin). -- **Three Beacons** — aged grey monuments; walk within 2.5 m to ignite one in a bright red Hiss wave. The third fires a placeholder event, pending design. +- **Three Beacons → Hissed Floppy Disk** — walk within 2.5 m to ignite each grey monument; the third unseals the Security Booth (red door → green), where a corrupted FBC disk grants a permanent run buff: +15% Evade and a damaging data trail on every dash. - **Projector blackout** — walk into the screen, answer twenty red phones in the dark, claim FLUORESCENT. - **Corruption clock** — Risk of Rain 2-style scaling; level-up offers roll as real-time HUD stamps, never pausing the run. - **Built, not kitbashed** — rigged/animated Blender agent, sculpted low-poly enemies and props, one seamless 2K concrete PBR set, hard shadows and half-res bloom. @@ -22,7 +22,7 @@ cmake -B build && cmake --build build -j6 ./build/cntrl --seed 42 --shadows off # compare lighting ``` -C++23 (GCC 13+) and OpenGL/X11 headers; raylib 6.2 is fetched by CMake. Automated captures: `--screenshot /tmp/shot.png --screenshot-at 8`. Dev QA: `--skill-test` (staged CALL/WARP casts for VFX captures), `--floor-overview`, `--beacon-test`, `--plaza-test`, `--bot`, `--no-damage`, `--trace all`; full flag list in `src/main.cpp`. F12 saves a screenshot. +C++23 (GCC 13+) and OpenGL/X11 headers; raylib 6.2 is fetched by CMake. Automated captures: `--screenshot /tmp/shot.png --screenshot-at 8`. Dev QA: `--skill-test` (staged CALL/WARP casts for VFX captures), `--floor-overview`, `--beacon-test`, `--door-test` (sealed Booth), `--disk-test` (Beacons lit, Disk claimed), `--plaza-test`, `--bot`, `--no-damage`, `--trace all`; full flag list in `src/main.cpp`. F12 saves a screenshot. ## Title screen & options @@ -71,7 +71,7 @@ J/K/L/U presses are remembered while that skill cools down; the HUD stamp shows ## Status -Pre-alpha vertical slice: playable Floor 01, four OoPs, four enemy archetypes, rituals, side rooms, and the Beacon objective. Still open: six more floors, bosses, audio and meta progression. The third-Beacon event is deliberately a placeholder until its design is settled. +Pre-alpha vertical slice: playable Floor 01, four OoPs, four enemy archetypes, rituals, side rooms, the Beacon objective and its Hissed Floppy Disk reward. Still open: six more floors, bosses, audio and meta progression. ## IP note diff --git a/assets/blender/fbc_floppy_disk.blend b/assets/blender/fbc_floppy_disk.blend new file mode 100644 index 0000000..a93b810 Binary files /dev/null and b/assets/blender/fbc_floppy_disk.blend differ diff --git a/assets/levels/floor01.json b/assets/levels/floor01.json index f22ac4e..130df70 100644 --- a/assets/levels/floor01.json +++ b/assets/levels/floor01.json @@ -5169,6 +5169,20 @@ "y": 0, "scale": 1, "destructible": true + }, + { + "kind": "Decor", + "pos": [154, 12], + "w": 0.9, + "d": 0.9, + "h": 1.2, + "solid": false, + "model": "FloppyDisk", + "yaw": 0, + "room_kind": "", + "y": 0, + "scale": 1.6, + "destructible": false } ], "rituals": [ diff --git a/assets/models/props/floppy_disk.glb b/assets/models/props/floppy_disk.glb new file mode 100644 index 0000000..12c5e1f Binary files /dev/null and b/assets/models/props/floppy_disk.glb differ diff --git a/src/game/enemies.hpp b/src/game/enemies.hpp index d04507d..c85284f 100644 --- a/src/game/enemies.hpp +++ b/src/game/enemies.hpp @@ -36,6 +36,8 @@ struct Enemy { EnemyType type = EnemyType::HissStaff; // Set by WARP at cast time so late arrivals don't join a locked crowd. int warp_mark = 0; + // Set by the Hissed Floppy Disk trail so one Evade hits an enemy once. + int dash_mark = 0; EnemyMods mods{}; // Transient buffs/debuffs, recomputed each tick }; diff --git a/src/game/game.cpp b/src/game/game.cpp index c9f3747..e8c9e27 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -5,6 +5,20 @@ namespace { +// Hissed Floppy Disk: a short, weak damage trail along the Evade path. +constexpr float kDiskTrailRadius = 1.15f; +constexpr float kDiskTrailDamage = 8.0f; + +float distance_to_segment(Vec2 p, Vec2 a, Vec2 b) { + const Vec2 ab = b - a; + const float len2 = length_sq(ab); + if (len2 < 1e-6f) return distance(p, a); + const Vec2 ap = p - a; + float t = (ap.x * ab.x + ap.y * ab.y) / len2; + t = t < 0.0f ? 0.0f : (t > 1.0f ? 1.0f : t); + return distance(p, a + ab * t); +} + std::vector roll_offers(Game& g) { std::vector pool; // New weapons @@ -174,7 +188,12 @@ void Game::update(const InputState& in, float dt) { events.push(EventType::TierUp, player.pos, static_cast(last_tier_)); } + const Vec2 prev_pos = player.pos; + const float prev_dash_timer = player.dash_timer; player_update(player, in, dt, floor); + if (player.hissed_disk && player.dash_timer > 0.0f && prev_dash_timer <= 0.0f) { + ++player.dash_seq; // a fresh Evade starts a new trail hit generation + } if (blackout.active()) { // Skills cannot target anything in the pocket, but key presses still @@ -202,6 +221,7 @@ void Game::update(const InputState& in, float dt) { } director.update(dt, corruption, run_time, player, enemy_system, rng, config.max_enemies, floor); + if (player.hissed_disk) dash_trail_pass(prev_pos); 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); @@ -260,11 +280,29 @@ void Game::beacon_pass() { const int before = beacons.active_count(); beacons.update(player.pos, events); if (beacons.active_count() == before) return; - // The event that fires on the third beacon is still being designed; for - // now the only consequence is a HUD banner and an event-queue entry. floor_banner = beacons.complete() ? 4.0f : 3.0f; - floor_banner_text = beacons.complete() - ? "ALL BEACONS ACTIVE" : "BEACON ACTIVATED"; + if (beacons.complete()) { + // The Beacons are the key to the last sealed room. The Projector + // clearance opens the two lesser side rooms; the Booth stays shut + // until all three monuments burn so this reward is earned, not found. + floor.unlock_door(static_cast(DoorId::Booth)); + floor_banner_text = "ALL BEACONS ACTIVE - SECURITY BOOTH UNSEALED"; + } else { + floor_banner_text = "BEACON ACTIVATED"; + } +} + +void Game::dash_trail_pass(Vec2 prev_pos) { + if (!player.hissed_disk || player.dash_timer <= 0.0f) return; + for (Enemy& e : enemy_system.enemies) { + if (e.dash_mark == player.dash_seq) continue; + if (distance_to_segment(e.pos, prev_pos, player.pos) + > kDiskTrailRadius + e.radius) continue; + e.dash_mark = player.dash_seq; + const float applied = kDiskTrailDamage * e.mods.damage_taken_mult; + e.hp -= applied; + events.push(EventType::EnemyHit, e.pos, applied); + } } void Game::grant_ritual_skill() { @@ -279,10 +317,11 @@ void Game::grant_ritual_skill() { } // A ritual reward is not limited by the normal level-up offer cap. weapon_system.weapons.push_back({WeaponType::Projector, 1, false, 0.0f}); - // The briefing stamp is also the side-quest reward that opens the sealed - // side doors — the greed-vs-clock detours now have a reason to exist. + // The briefing stamp opens the two lesser side rooms. The Security Booth + // is deliberately left sealed — lighting all three Beacons is its key. clearance = std::max(clearance, 2); - floor.unlock_all_doors(); + floor.unlock_door(static_cast(DoorId::Janitor)); + floor.unlock_door(static_cast(DoorId::Locker)); } void Game::side_room_pass() { @@ -311,12 +350,22 @@ void Game::side_room_pass() { player.hp = std::min(player.stats.max_hp, player.hp + 25.0f); side_banner_text = "JANITOR CLOSET — Ahti left a first-aid kit (+HP)"; break; - case 3: // Security Booth — contained world objects - for (int i = 0; i < 2; ++i) { - buff_system.spawn_world_object(player.pos + Vec2{static_cast(i) * 1.5f, 0.0f}, - rng); + case 3: // Security Booth — the Beacon-gated Hissed Floppy Disk + if (beacons.complete() && !player.hissed_disk) { + // Mega Man reward + RoR2-style permanent item: a flat Evade + // buff and a damaging data trail for the rest of the run. + player.hissed_disk = true; + player.stats.dash_cooldown_mult *= 0.85f; + side_banner_text = + "SECURITY BOOTH — HISSED FLOPPY DISK (EVADE +15% / DISK TRAIL)"; + events.push(EventType::ShardCollected, player.pos, 1.0f); + } else { + for (int i = 0; i < 2; ++i) { + buff_system.spawn_world_object( + player.pos + Vec2{static_cast(i) * 1.5f, 0.0f}, rng); + } + side_banner_text = "SECURITY BOOTH — world-object cache"; } - side_banner_text = "SECURITY BOOTH — world-object cache"; break; default: break; } diff --git a/src/game/game.hpp b/src/game/game.hpp index 5cbcbaa..cd3d273 100644 --- a/src/game/game.hpp +++ b/src/game/game.hpp @@ -89,6 +89,7 @@ private: void beacon_pass(); void side_room_pass(); void grant_ritual_skill(); + void dash_trail_pass(Vec2 prev_pos); std::uint64_t seed_ = 0; int last_tier_ = 0; diff --git a/src/game/player.hpp b/src/game/player.hpp index 7a830dc..4150846 100644 --- a/src/game/player.hpp +++ b/src/game/player.hpp @@ -44,6 +44,8 @@ struct Player { PlayerMods mods{}; // Transient buffs/debuffs (player channel, §4.5) float dash_timer = 0.0f; // remaining dash burst float dash_cooldown = 0.0f; // time until dash is available again + int dash_seq = 0; // generation token: one trail hit per enemy per dash + bool hissed_disk = false; // permanent run reward from the Security Booth float hit_flash = 0.0f; // presentation: red flash timer float iframe_timer = 0.0f; // brief global i-frame after taking a hit diff --git a/src/level/asset_catalog.cpp b/src/level/asset_catalog.cpp index 4bf3a9a..7a5a874 100644 --- a/src/level/asset_catalog.cpp +++ b/src/level/asset_catalog.cpp @@ -83,6 +83,7 @@ const char* actor_model_path(const std::string& name) { if (name == "ThermoPanel") return "assets/models/props/thermo_panel.glb"; if (name == "BodyPile") return "assets/models/props/body_pile.glb"; if (name == "Beacon") return "assets/models/props/beacon.glb"; + if (name == "FloppyDisk") return "assets/models/props/floppy_disk.glb"; return nullptr; } diff --git a/src/main.cpp b/src/main.cpp index b7b134a..235d78a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -64,6 +64,8 @@ struct Options { bool plaza_test = false; // --plaza-test: start in the central plaza bool office_test = false; // --office-test: start in the office suite bool beacon_test = false; // --beacon-test: stand on the first beacon + bool disk_test = false; // --disk-test: beacons lit, start in the Booth + bool door_test = false; // --door-test: stand at the sealed Booth door 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 @@ -148,6 +150,10 @@ Options parse_options(int argc, char** argv) { opts.office_test = true; } else if (std::strcmp(argv[i], "--beacon-test") == 0) { opts.beacon_test = true; + } else if (std::strcmp(argv[i], "--disk-test") == 0) { + opts.disk_test = true; + } else if (std::strcmp(argv[i], "--door-test") == 0) { + opts.door_test = true; } else if (std::strcmp(argv[i], "--blackout-test") == 0) { opts.blackout_test = true; } else if (std::strcmp(argv[i], "--blackout-auto") == 0) { @@ -355,7 +361,8 @@ int main(int argc, char** argv) { : Floor::kDefaultPath); game.state = (opts.bot || opts.hiss_test || opts.room_test || opts.aoe_test || opts.skill_test || opts.floor_overview || opts.plaza_test - || opts.office_test || opts.beacon_test || opts.blackout_test) + || opts.office_test || opts.beacon_test || opts.disk_test || opts.door_test + || opts.blackout_test) ? GameState::Playing : GameState::Title; game.config.no_player_damage = opts.no_damage; game.blackout_auto = opts.blackout_auto; @@ -408,6 +415,26 @@ int main(int argc, char** argv) { game.enemy_system.clear(); } + if (opts.door_test) { + game.player.pos = Floor::to_world(128.0f, 16.0f); + game.enemy_system.clear(); + } + + if (opts.disk_test) { + // QA entry: light all three beacons, unseal the Booth and stand in it + // so the Disk claim, HUD stamp and GLB can be captured in one frame. + for (const auto& b : game.beacons.beacons()) + game.beacons.update(b.pos, game.events); + game.floor.unlock_door(static_cast(DoorId::Booth)); + for (const FloorRoom& r : game.floor.rooms()) { + if (r.side_index != 3) continue; + game.player.pos = {(r.rect.x0 + r.rect.x1) * 0.5f, + (r.rect.z0 + r.rect.z1) * 0.5f}; + break; + } + game.enemy_system.clear(); + } + if (opts.aoe_test) { game.player.pos = {-70.0f, 46.0f}; game.enemy_system.clear(); diff --git a/src/render/models.cpp b/src/render/models.cpp index e686f13..0898837 100644 --- a/src/render/models.cpp +++ b/src/render/models.cpp @@ -443,6 +443,7 @@ float ModelBank::height(ActorModel id) { case ActorModel::CaseFrame: return 2.2f; case ActorModel::CaseGlass: return 2.0f; case ActorModel::Beacon: return 7.1f; + case ActorModel::FloppyDisk: return 1.2f; case ActorModel::ArchiveShelf: return 2.8f; case ActorModel::ThermoFrame: return 4.6f; case ActorModel::ThermoPanel: return 4.0f; @@ -486,6 +487,7 @@ const char* ModelBank::file_name(ActorModel id) { case ActorModel::CaseFrame: return "assets/models/props/case_frame.glb"; case ActorModel::CaseGlass: return "assets/models/props/case_glass.glb"; case ActorModel::Beacon: return "assets/models/props/beacon.glb"; + case ActorModel::FloppyDisk: return "assets/models/props/floppy_disk.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"; @@ -505,7 +507,7 @@ bool ModelBank::actor_from_name(const std::string& name, ActorModel& id) { "OfficeDesk", "MeetingTable", "OfficeChair", "Computer", "Plant", "Sofa", "FloorLamp", "Partition", "GarbageCan", "DocumentStack", "LooseSheet", "PhoneTable", "CaseFrame", "CaseGlass", - "Beacon", "ArchiveShelf", "ThermoFrame", "ThermoPanel", "BodyPile", + "Beacon", "FloppyDisk", "ArchiveShelf", "ThermoFrame", "ThermoPanel", "BodyPile", "RoundBasic", "RoundTuned", "RoundOvercharge", "MuzzleFlash", }; static_assert(sizeof(kNames) / sizeof(kNames[0]) diff --git a/src/render/models.hpp b/src/render/models.hpp index 937f9c5..22fe31f 100644 --- a/src/render/models.hpp +++ b/src/render/models.hpp @@ -16,6 +16,7 @@ enum class ActorModel { Partition, GarbageCan, DocumentStack, LooseSheet, PhoneTable, CaseFrame, CaseGlass, // projector-screen blackout ritual Beacon, // walk-to-activate objective + FloppyDisk, // Hissed Floppy Disk — Security Booth OoP reward ArchiveShelf, ThermoFrame, ThermoPanel, BodyPile, RoundBasic, RoundTuned, RoundOvercharge, MuzzleFlash, Count diff --git a/src/render/presenter.cpp b/src/render/presenter.cpp index dec160f..c381d5a 100644 --- a/src/render/presenter.cpp +++ b/src/render/presenter.cpp @@ -722,18 +722,30 @@ void Presenter::draw_floor_environment(const Game& game, const ViewCull& cull) { DrawCube({p.pos.x - 0.2f, p.h - 0.45f, p.pos.y - (p.d * 0.5f + 0.25f)}, 0.8f, 0.12f, 0.04f, Color{232, 228, 216, 255}); break; - case PropKind::Decor: - DrawCube({p.pos.x, p.h * 0.5f + 0.05f, p.pos.y}, p.w, p.h, p.d, - Color{128, 126, 122, 255}); + case PropKind::Decor: { + // Authored OoP outfits (e.g. the Hissed Floppy Disk in the + // Security Booth) carry a model name; everything else in this + // bucket stays the cheap unmodelled cube. + ActorModel model = ActorModel::Crate; + if (!p.model.empty() && models_.actor_from_name(p.model, model)) { + const float bob = std::sin(anim_time_ * 1.6f + p.pos.x * 0.13f) + * 0.02f; + models_.draw(model, {p.pos.x, p.y + bob, p.pos.y}, p.yaw, + p.scale, WHITE); + } else { + DrawCube({p.pos.x, p.h * 0.5f + 0.05f, p.pos.y}, p.w, p.h, p.d, + Color{128, 126, 122, 255}); + } break; + } case PropKind::Beacon: // Drawn from game.beacons below so the activated tint is shared. break; } } - // Clearance-gated doors. Locked openings are solid slabs with a red - // stripe; once stamped they read as open frames with a green floor strip. + // Clearance-gated doors. Locked openings get full concrete leaves with a + // red status bar; stamped doors park the leaves and light the sill green. for (const level::Door& d : floor.data().doors) { const level::Rect world_rect = level::to_world_rect(floor.data(), d.rect); const Vec2 a{world_rect.x0, world_rect.y0}; @@ -743,17 +755,41 @@ void Presenter::draw_floor_environment(const Game& game, const ViewCull& cull) { const float w = std::fabs(b.x - a.x); const float depth = std::fabs(b.y - a.y); if (!cull.visible(cx, 1.6f, cz, std::max(w, depth) * 0.5f + 1.0f)) continue; + const bool along_x = w >= depth; + const float span = along_x ? w : depth; + const float thick = along_x ? depth : w; + auto leaf = [&](float along, float length, float height, float y, + Color color) { + DrawCube(along_x ? Vector3{cx + along, y, cz} + : Vector3{cx, y, cz + along}, + along_x ? length : thick, height, + along_x ? thick : length, color); + }; + + // Fixed frame, always present: two jambs and a header. + for (const float side : {-1.0f, 1.0f}) { + leaf(side * span * 0.5f, 0.24f, 3.5f, 1.75f, + Color{74, 80, 86, 255}); + } + leaf(0.0f, span + 0.24f, 0.26f, 3.45f, Color{58, 62, 68, 255}); + if (floor.door_open(static_cast(d.id))) { - DrawCube({cx, 0.07f, cz}, w, 0.06f, depth, - Color{70, 210, 120, 255}); - for (const float sx : {-w * 0.5f, w * 0.5f}) { - DrawCube({cx + sx, 1.6f, cz}, 0.18f, 3.2f, 0.18f, - Color{120, 130, 124, 255}); + // Leaves retracted into the jambs, green status bar and lit sill. + for (const float side : {-1.0f, 1.0f}) { + leaf(side * (span * 0.5f - 0.14f), 0.28f, 3.1f, 1.55f, + Color{92, 104, 96, 255}); } + leaf(0.0f, span * 0.92f, 0.16f, 2.45f, Color{70, 210, 120, 255}); + leaf(0.0f, span, 0.06f, 0.07f, Color{52, 180, 104, 220}); } else { - DrawCube({cx, 1.6f, cz}, w, 3.2f, depth, Color{96, 26, 32, 255}); - DrawCube({cx, 2.4f, cz}, w, 0.14f, depth + 0.2f, - Color{200, 40, 50, 255}); + // Solid slab: two dark leaves, a hot seam and a red status bar. + for (const float side : {-1.0f, 1.0f}) { + leaf(side * span * 0.25f, span * 0.49f, 3.1f, 1.55f, + Color{52, 54, 60, 255}); + } + leaf(0.0f, 0.10f, 3.1f, 1.55f, Color{150, 28, 36, 255}); + leaf(0.0f, span * 0.92f, 0.16f, 2.45f, Color{220, 48, 58, 255}); + leaf(0.0f, span, 0.06f, 0.07f, Color{170, 26, 34, 200}); } } diff --git a/src/render/ui.cpp b/src/render/ui.cpp index 1d8ad72..bd833fc 100644 --- a/src/render/ui.cpp +++ b/src/render/ui.cpp @@ -174,9 +174,14 @@ void draw_hud(const Game& game, bool show_dev_ui) { ui_font::draw_text(room_line, px + panel_w / 2 - rw / 2, 22, 17, Color{245, 197, 24, 245}); char objective[80]; - std::snprintf(objective, sizeof(objective), - "OBJECTIVE: ACTIVATE THE BEACONS (%d/%d)", - game.beacons.active_count(), BeaconSystem::kCount); + if (game.beacons.complete() && !game.player.hissed_disk) { + std::snprintf(objective, sizeof(objective), + "OBJECTIVE: ENTER THE SECURITY BOOTH (OoP)"); + } else { + std::snprintf(objective, sizeof(objective), + "OBJECTIVE: ACTIVATE THE BEACONS (%d/%d)", + game.beacons.active_count(), BeaconSystem::kCount); + } const int ow = ui_font::measure_text(objective, 16); ui_font::draw_text(objective, px + panel_w / 2 - ow / 2, 46, 16, Color{232, 228, 220, 235}); @@ -245,6 +250,11 @@ void draw_hud(const Game& game, bool show_dev_ui) { } oy += 21.0f; } + if (game.player.hissed_disk) { + ui_font::draw_text("HISSED FLOPPY DISK [EVADE +15% / DISK TRAIL]", 20, oy, + 16, Color{78, 201, 176, 245}); + oy += 21.0f; + } // Pending offers (real-time progression). if (!game.pending_offers.empty()) { diff --git a/tests/beacon_test.cpp b/tests/beacon_test.cpp index 042a6cc..27abcf9 100644 --- a/tests/beacon_test.cpp +++ b/tests/beacon_test.cpp @@ -1,6 +1,8 @@ #include "game/beacon.hpp" #include "game/floor.hpp" +#include "game/game.hpp" +#include #include namespace { @@ -54,6 +56,50 @@ int main() { check(beacons.active_count() == 0 && !beacons.complete(), "reset clears beacon progress"); + // Beacons gate the Security Booth, which holds the Hissed Floppy Disk. + Game game(1234); + check(!game.floor.door_open(static_cast(DoorId::Booth)), + "Security Booth starts sealed"); + InputState in{}; + for (const auto& b : game.beacons.beacons()) { + game.player.pos = b.pos + Vec2{2.2f, 0.0f}; + game.update(in, 1.0f / 60.0f); + } + check(game.beacons.complete(), "the game lights all three beacons"); + check(game.floor.door_open(static_cast(DoorId::Booth)), + "the third beacon unseals the Security Booth"); + check(!game.player.hissed_disk, "the disk still needs a booth visit"); + + const FloorRoom* booth = nullptr; + for (const FloorRoom& r : game.floor.rooms()) { + if (r.side_index == 3) booth = &r; + } + check(booth != nullptr, "Security Booth room exists"); + if (booth != nullptr) { + game.player.pos = {(booth->rect.x0 + booth->rect.x1) * 0.5f, + (booth->rect.z0 + booth->rect.z1) * 0.5f}; + game.update(in, 1.0f / 60.0f); + } + check(game.player.hissed_disk, "entering the booth claims the disk"); + check(std::fabs(game.player.stats.dash_cooldown_mult - 0.85f) < 1e-5f, + "the disk grants a 15% Evade cooldown buff"); + + // One Evade through an enemy deals the trail damage exactly once. + game.enemy_system.clear(); + game.enemy_system.spawn(EnemyType::HissStaff, + game.player.pos + Vec2{1.0f, 0.0f}, game.corruption); + const float hp_before = game.enemy_system.enemies[0].hp; + in.dash = true; + in.move_x = 1.0f; + in.move_y = 0.0f; + game.update(in, 1.0f / 60.0f); + check(game.enemy_system.enemies[0].hp < hp_before, + "Evade damages an enemy passed through"); + const float hp_after_one = game.enemy_system.enemies[0].hp; + for (int i = 0; i < 6; ++i) game.update(in, 1.0f / 60.0f); + check(game.enemy_system.enemies[0].hp == hp_after_one, + "one Evade hits an enemy only once"); + if (failures == 0) std::printf("beacon tests passed\n"); else std::printf("%d failures\n", failures); return failures == 0 ? 0 : 1; diff --git a/tools/blender/build_floppy_disk.py b/tools/blender/build_floppy_disk.py new file mode 100644 index 0000000..978ce39 --- /dev/null +++ b/tools/blender/build_floppy_disk.py @@ -0,0 +1,180 @@ +# tools/blender/build_floppy_disk.py +# FBC: NIGHT SHIFT — Hissed Floppy Disk (Security Booth OoP reward). +# +# Run inside Blender 5.x: +# exec(open("/home/dandovlatov/Documents/cntrl/tools/blender/build_floppy_disk.py").read()) +# +# A 3.5" FBC issue disk, corrupted by the Hiss: dark shell, steel shutter, +# redacted label, black-red rot growths and hot fissures. Exports as one GLB +# with one merged mesh / material and painted COLOR_0, same path as the props. + +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") +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", "label": "#c8c4b4", "board_dk": "#8a6c12"}) + +# In Blender the disk faces -Y (engine +Z after glTF Y-up conversion). Parts +# are authored standing up: local XY is the face, local Z becomes thickness. +FACE_ROT = (math.pi / 2, 0.0, 0.0) +FACE_OFFSET = (0.0, 0.025, 0.86) + + +def place(obj, rot=FACE_ROT, offset=FACE_OFFSET): + 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 face(root, name, outline, z0, z1, value, ao=0.05): + """A flat plate on the disk face, extruded in local Z (world thickness).""" + return place(K.plate(root, name, outline, z0, z1, 1.0, value, ao=ao)) + + +def build_disk(): + r = K.new_actor("HissedFloppyDisk") + + # Low plinth: the OoP sits on a plinth like the Pedestal and Duck. + K.loft(r, "plinth", [ + {"z": 0.0, "r": (0.38, 0.32), "n": 10}, + {"z": 0.06, "r": (0.42, 0.35), "n": 10}, + {"z": 0.40, "r": (0.36, 0.30), "n": 10, "fold": (0.02, 5)}, + {"z": 0.46, "r": (0.40, 0.33), "n": 10}, + ], P["concrete"], ao=0.14) + K.plate(r, "plinth_top", K.octagon(0.34, 0.28), 0.46, 0.50, 0.98, + P["redaction"]) + K.ring(r, "plinth_seal", (0.0, 0.0, 0.08), 0.40, 0.016, + P["hiss_dull"], segments=12) + + # Shell: chamfered top-right corner, the classic 3.5" silhouette. + shell = [(-0.30, -0.30), (0.30, -0.30), (0.30, 0.19), + (0.19, 0.30), (-0.30, 0.30)] + face(r, "shell", shell, 0.0, 0.052, P["plastic"], ao=0.09) + + # Steel shutter across the top, slightly proud of the shell. + face(r, "shutter", [(-0.23, 0.09), (0.23, 0.09), + (0.23, 0.30), (-0.23, 0.30)], + 0.052, 0.066, P["steel"]) + face(r, "shutter_slot", [(-0.17, 0.24), (0.12, 0.24), + (0.12, 0.27), (-0.17, 0.27)], + 0.066, 0.070, P["redaction"], ao=0.0) + + # Paper label with two redaction bars (FBC form, not a consumer brand). + face(r, "label", [(-0.25, -0.26), (0.25, -0.26), + (0.25, 0.04), (-0.25, 0.04)], + 0.052, 0.057, P["label"]) + face(r, "label_bar_a", [(-0.21, -0.09), (0.17, -0.09), + (0.17, -0.055), (-0.21, -0.055)], + 0.057, 0.060, P["redaction"], ao=0.0) + face(r, "label_bar_b", [(-0.21, -0.18), (0.08, -0.18), + (0.08, -0.145), (-0.21, -0.145)], + 0.057, 0.060, P["redaction"], ao=0.0) + face(r, "label_stamp", [(-0.21, 0.005), (-0.10, 0.005), + (-0.10, 0.030), (-0.21, 0.030)], + 0.057, 0.061, P["board_dk"], ao=0.0) + + # Write-protect notch, bottom-left. + face(r, "write_protect", [(-0.30, -0.30), (-0.23, -0.30), + (-0.23, -0.24), (-0.30, -0.24)], + 0.052, 0.058, P["redaction"], ao=0.0) + + # Hiss rot: black-red growths breaking out of the shell corners + a hot + # fissure crawling across the label. Painted into the same vertex colours. + for i, (x, z, tilt_v, size) in enumerate([ + (-0.29, 1.11, (0.4, 0.2, 0.6), 0.13), + (0.27, 1.09, (-0.3, 0.4, -0.5), 0.11), + (0.15, 0.61, (0.2, -0.4, 0.3), 0.09), + (-0.24, 0.63, (-0.5, 0.1, -0.2), 0.08), + ]): + K.crystal(r, "rot_%d" % i, (x, -0.04, z), size, + P["hiss"] if i % 2 == 0 else P["hiss_dull"], + sides=5, seed=70 + i, tilt=tilt_v) + for i, pts in enumerate([ + [(-0.13, -0.04, 0.60), (-0.05, -0.05, 0.77), + (0.02, -0.05, 0.90), (0.11, -0.04, 1.06)], + [(0.20, -0.04, 0.68), (0.26, -0.05, 0.82), (0.22, -0.04, 0.98)], + ]): + K.tube(r, "fissure_%d" % i, pts, [0.014, 0.017, 0.013, 0.010][:len(pts)], + P["hiss_hot"], sides=5) + K.blob(r, "rot_mass", (0.29, 0.06, 0.73), (0.10, 0.05, 0.13), + P["hiss_dull"], subdiv=1, warp=0.34, seed=9, smooth=False, ao=0.04) + return r + + +root = build_disk() +K.merge_actor(root, "HissedFloppyDisk") +tris = K.triangle_count(root) +CAP = 700 +print("[budget] HissedFloppyDisk %d tris (cap %d) %s" + % (tris, CAP, "OK" if tris <= CAP else "OVER")) +if tris > CAP: + raise RuntimeError("HissedFloppyDisk triangle budget exceeded: %d" % tris) + +out_glb = os.path.join(MODEL_DIR, "floppy_disk.glb") +K.export_actor(root, "HissedFloppyDisk", out_glb) +print("[export] %s (%d bytes)" % (out_glb, os.path.getsize(out_glb))) + +# Concept render: one centred disc against the House dark, Hiss fill + teal rim. +world = bpy.data.worlds.new("FloppyWorld") +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("#0d0f12"), 1.0) +bg.inputs["Strength"].default_value = 0.9 + +for name, loc, power, col in ( + ("Key", (-2, -8, 9), 2200, "#eef2ff"), + ("HissFill", (7, -2, 4), 1200, "#ff3b46"), + ("Rim", (0, 6, 5), 900, "#4ec9b0"), +): + 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, 0.85)) - Vector(loc)).to_track_quat( + "-Z", "Y").to_euler() + +cam_data = bpy.data.cameras.new("FloppyCam") +cam = bpy.data.objects.new("FloppyCam", cam_data) +bpy.context.scene.collection.objects.link(cam) +cam.location = (1.6, -4.2, 2.2) +cam.rotation_euler = (Vector((0, 0, 0.85)) - cam.location).to_track_quat( + "-Z", "Y").to_euler() +cam_data.lens = 55 +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 = 900 +scene.render.resolution_y = 900 +scene.render.image_settings.file_format = "PNG" +scene.render.filepath = os.path.join(CONCEPT_DIR, "floppy_disk_lineup.png") +bpy.ops.render.render(write_still=True) + +bpy.ops.wm.save_as_mainfile(filepath=os.path.join(BLEND_DIR, "fbc_floppy_disk.blend")) +print("[done] Hissed Floppy Disk: %d tris, %s" % (tris, out_glb))