cntrl/src/render/presenter.hpp
dandovlatov da0d157e29 Add PUSH skill on L: radial knockback and stagger with rebuilt rubble
PUSH is a fourth always-available active skill bound to L (gamepad RT).
It shoves visible enemies in a 6 m radius outward, damages them and holds
them in a 0.55 s stagger that stops chasing and attacks. Autoplay toggling
moves to Tab so the new key is free.

The effect reuses the rock-debris pool via a new radial burst variant and
the shattered-concrete GLB rebuilt in Blender: broken slabs, raised
splinters, bent rebar and Hiss cracks. Warm rings, ground pulse, sparks
and tumbling GLB shards carry the shockwave; stagger feeds the actor recoil
shader. HUD, docs and skill tests updated.
2026-11-25 04:22:37 +04:00

155 lines
5.1 KiB
C++

#pragma once
#include <vector>
#include "raylib.h"
#include "game/game.hpp"
#include "render/aura.hpp"
#include "render/camera_tuning.hpp"
#include "render/concrete.hpp"
#include "render/debris.hpp"
#include "render/dressing.hpp"
#include "render/models.hpp"
#include "render/shadow_map.hpp"
// The hybrid look: brutalist 3D diorama + low-poly Blender actors.
// This is the only place that knows how the sim is drawn (ART_DIRECTION.md).
// Actor GLBs come from tools/blender/build_enemies.py; if they are missing the
// presenter falls back to primitive shapes so the game never shows 2D cards.
struct DamageNumber {
Vec2 pos{};
float value = 0.0f;
float age = 0.0f;
};
struct Spark {
Vector3 pos{};
Vector3 vel{};
Color color{};
float age = 0.0f;
float life = 0.5f;
float size = 0.12f;
};
struct RoundTrail {
Vector3 pos{};
Color color{};
float age = 0.0f;
float life = 0.22f;
float size = 0.2f;
};
// Presentation-only expanding/contracting ground rings: landing telegraphs,
// dust puffs and the teal implosion left behind when a WARP field collapses.
struct SkillRing {
Vec2 pos{};
float radius = 1.0f;
float end_radius = 1.0f;
float age = 0.0f;
float life = 0.5f;
float height = 0.14f;
float spin = 0.0f; // DrawCircle3D's rotation angle (rings are symmetric)
Color color{};
};
// PUSH's GLB rubble: the same shattered-concrete model the CALL heap uses,
// flung outward as a one-shot presentation effect (no simulation state).
struct PushShard {
Vector3 pos{};
Vector3 vel{};
float yaw = 0.0f;
float spin = 0.0f;
float size = 0.0f;
float age = 0.0f;
float life = 0.0f;
};
class ViewCull;
class Presenter {
public:
void init(float arena_half, const class Floor& floor);
void shutdown();
// Draws the 3D scene and world-anchored text. Call inside BeginDrawing()
// (main.cpp renders into a texture first so post FX can run over the frame).
void draw_scene(Game& game);
void draw_shadow_map(const Game& game, bool enabled);
void set_hiss_test(bool on) { hiss_test_ = on; }
void set_floor_overview(bool on) { floor_overview_ = on; }
// Called by the graphics menu (later phase) after settings change.
void apply_graphics_settings();
// Presentation-only reset: revives dressing and clears transient FX on R.
void reset();
CameraTuning& camera_tuning() { return tuning_; }
float damage_flash() const { return damage_flash_; }
int debris_count() const { return debris_.count() + concrete_debris_.count(); }
int dressing_count() const { return dressing_.alive_count(); }
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);
// Close-range, world-anchored placards replace the old task HUD.
void draw_blackout_labels(const 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);
void spawn_skill_ring(Vec2 pos, float radius, float end_radius, float life,
Color color, float spin = 0.0f,
float height = 0.14f);
void spawn_push_shards(Vec2 center, float radius);
// Skills shake nearby shelves/tables/garbage cans into paper + rock debris
// without destroying the props (presentation-only).
void shed_surface_debris(Vec2 center, float radius);
Camera3D camera_{};
CameraTuning tuning_;
Texture2D soft_disc_{}; // projectile glow fallback
Texture2D spr_glow_{}; // projectile glow sprite
ModelBank models_;
ConcreteMaterial concrete_;
ShadowMap shadow_map_;
bool shadows_active_ = false;
CorruptionAura aura_;
Dressing dressing_;
PaperDebris debris_;
ConcreteDebris concrete_debris_;
ScorchDecals scorch_;
Model static_env_model_{};
bool static_env_ready_ = false;
float shake_ = 0.0f;
float damage_flash_ = 0.0f;
float anim_time_ = 0.0f;
float player_yaw_ = 0.0f;
float player_walk_ = 0.0f; // smoothed locomotion weight for the agent clips
float dash_pose_ = 0.0f; // presentation-only hold for the Dash pose
float dash_prev_ = 0.0f; // previous dash timer, for rising-edge detection
float fire_pose_ = 0.0f; // brief fire clip hold
float muzzle_flash_ = 0.0f;
float trail_clock_ = 0.0f;
Vector3 muzzle_flash_pos_{};
float muzzle_flash_yaw_ = 0.0f;
int muzzle_flash_tier_ = 0;
bool player_running_ = false; // hysteresis latch for Idle <-> Run
bool hiss_test_ = false;
bool floor_mode_ = false;
bool floor_overview_ = false;
bool shadow_pass_ = false;
bool tier_wave_pending_ = false;
Vec2 last_player_pos_{};
std::vector<DamageNumber> damage_numbers_;
std::vector<Spark> sparks_;
std::vector<RoundTrail> trails_;
std::vector<SkillRing> skill_rings_;
std::vector<PushShard> push_shards_;
};