FBC: NIGHT SHIFT - added spatial paper gating and skill-gated concrete debris
This commit is contained in:
parent
97eb311e91
commit
ab46114632
8 changed files with 220 additions and 99 deletions
|
|
@ -13,10 +13,18 @@ enum class EventType {
|
||||||
TierUp,
|
TierUp,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Opt-in surface effects for an area detonation. Paper is spatial-gated by the
|
||||||
|
// presenter (only dressing props inside the blast produce paper); concrete is
|
||||||
|
// requested explicitly by skills that shatter the floor.
|
||||||
|
enum DetonationFlag : unsigned {
|
||||||
|
kDetonateConcrete = 1u << 0,
|
||||||
|
};
|
||||||
|
|
||||||
struct GameEvent {
|
struct GameEvent {
|
||||||
EventType type = EventType::EnemyHit;
|
EventType type = EventType::EnemyHit;
|
||||||
Vec2 pos{};
|
Vec2 pos{};
|
||||||
float magnitude = 0.0f;
|
float magnitude = 0.0f;
|
||||||
|
unsigned flags = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct EventQueue {
|
struct EventQueue {
|
||||||
|
|
@ -24,8 +32,9 @@ struct EventQueue {
|
||||||
GameEvent items[kCapacity];
|
GameEvent items[kCapacity];
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
void push(EventType type, Vec2 pos, float magnitude = 0.0f) {
|
void push(EventType type, Vec2 pos, float magnitude = 0.0f,
|
||||||
if (count < kCapacity) items[count++] = {type, pos, magnitude};
|
unsigned flags = 0) {
|
||||||
|
if (count < kCapacity) items[count++] = {type, pos, magnitude, flags};
|
||||||
}
|
}
|
||||||
void clear() { count = 0; }
|
void clear() { count = 0; }
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,7 @@ void WeaponSystem::update(float dt, const Player& player, EnemySystem& enemies,
|
||||||
proto.life = def.projectile_life;
|
proto.life = def.projectile_life;
|
||||||
proto.homing = def.homing;
|
proto.homing = def.homing;
|
||||||
proto.source = w.type;
|
proto.source = w.type;
|
||||||
|
proto.evolved = w.evolved;
|
||||||
proto.pierce = player.stats.pierce;
|
proto.pierce = player.stats.pierce;
|
||||||
|
|
||||||
bool fired = false;
|
bool fired = false;
|
||||||
|
|
@ -206,7 +207,11 @@ void WeaponSystem::update(float dt, const Player& player, EnemySystem& enemies,
|
||||||
events.push(EventType::EnemyHit, e2.pos, p.damage);
|
events.push(EventType::EnemyHit, e2.pos, p.damage);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
events.push(EventType::AreaDetonation, p.pos, p.aoe_radius);
|
const unsigned flags =
|
||||||
|
(p.source == WeaponType::Charge && p.evolved)
|
||||||
|
? kDetonateConcrete : 0u;
|
||||||
|
events.push(EventType::AreaDetonation, p.pos, p.aoe_radius,
|
||||||
|
flags);
|
||||||
consumed = true;
|
consumed = true;
|
||||||
} else {
|
} else {
|
||||||
e.hp -= p.damage * e.mods.damage_taken_mult;
|
e.hp -= p.damage * e.mods.damage_taken_mult;
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ struct Projectile {
|
||||||
float aoe_radius = 0.0f;
|
float aoe_radius = 0.0f;
|
||||||
int pierce = 0;
|
int pierce = 0;
|
||||||
WeaponType source = WeaponType::Spin;
|
WeaponType source = WeaponType::Spin;
|
||||||
|
bool evolved = false;
|
||||||
bool alive = true;
|
bool alive = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
16
src/main.cpp
16
src/main.cpp
|
|
@ -287,12 +287,18 @@ int main(int argc, char** argv) {
|
||||||
}
|
}
|
||||||
if (opts.aoe_test) {
|
if (opts.aoe_test) {
|
||||||
aoe_clock += GetFrameTime();
|
aoe_clock += GetFrameTime();
|
||||||
if (aoe_clock >= 1.6f) {
|
if (aoe_clock >= 1.8f) {
|
||||||
aoe_clock = 0.0f;
|
aoe_clock = 0.0f;
|
||||||
const Vec2 spots[] = {{-82.0f, 46.0f}, {-70.0f, 34.0f},
|
struct Blast { Vec2 pos; float radius; unsigned flags; };
|
||||||
{-76.0f, 58.0f}, {-64.0f, 46.0f}};
|
static const Blast kBlasts[] = {
|
||||||
game.events.push(EventType::AreaDetonation,
|
{{-82.0f, 46.0f}, 4.5f, 0u},
|
||||||
spots[aoe_seq++ % 4], 4.5f);
|
{{4.0f, -8.0f}, 3.2f, kDetonateConcrete},
|
||||||
|
{{-70.0f, 34.0f}, 4.0f, kDetonateConcrete},
|
||||||
|
};
|
||||||
|
const Blast& b = kBlasts[aoe_seq++ % 3];
|
||||||
|
game.player.pos = b.pos;
|
||||||
|
game.events.push(EventType::AreaDetonation, b.pos, b.radius,
|
||||||
|
b.flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -143,6 +143,85 @@ void PaperDebris::draw(Vector3 camera_pos) const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConcreteDebris::init() {
|
||||||
|
chunks_.reserve(kCapacity);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConcreteDebris::clear() {
|
||||||
|
chunks_.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConcreteDebris::burst(Vec2 center, float radius, int count) {
|
||||||
|
for (int i = 0; i < count && static_cast<int>(chunks_.size()) < kCapacity;
|
||||||
|
++i) {
|
||||||
|
ConcreteChunk c;
|
||||||
|
const float a = range(0.0f, 6.2831853f);
|
||||||
|
const float d = range(0.2f, radius * 0.9f);
|
||||||
|
c.pos = {center.x + std::cos(a) * d, 0.09f,
|
||||||
|
center.y + std::sin(a) * d};
|
||||||
|
const float spread = range(1.8f, 4.8f) * (1.0f + radius * 0.12f);
|
||||||
|
c.vel = {std::cos(a) * spread, range(2.6f, 6.2f),
|
||||||
|
std::sin(a) * spread};
|
||||||
|
c.yaw = range(0.0f, 360.0f);
|
||||||
|
c.pitch = range(-35.0f, 35.0f);
|
||||||
|
c.roll = range(-35.0f, 35.0f);
|
||||||
|
c.spin_y = range(-360.0f, 360.0f);
|
||||||
|
c.spin_x = range(-280.0f, 280.0f);
|
||||||
|
c.age = 0.0f;
|
||||||
|
c.life = range(0.9f, 1.5f);
|
||||||
|
c.size = range(0.22f, 0.52f);
|
||||||
|
c.shade = static_cast<unsigned char>(range(72.0f, 138.0f));
|
||||||
|
chunks_.push_back(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConcreteDebris::update(float dt) {
|
||||||
|
for (std::size_t i = 0; i < chunks_.size();) {
|
||||||
|
ConcreteChunk& c = chunks_[i];
|
||||||
|
c.age += dt;
|
||||||
|
c.vel.y -= 11.0f * dt;
|
||||||
|
c.vel.x *= 0.982f;
|
||||||
|
c.vel.z *= 0.982f;
|
||||||
|
c.pos.x += c.vel.x * dt;
|
||||||
|
c.pos.y += c.vel.y * dt;
|
||||||
|
c.pos.z += c.vel.z * dt;
|
||||||
|
c.yaw += c.spin_y * dt;
|
||||||
|
c.pitch += c.spin_x * dt;
|
||||||
|
if (c.pos.y <= 0.09f) {
|
||||||
|
c.pos.y = 0.09f;
|
||||||
|
c.vel.y *= -0.22f;
|
||||||
|
c.vel.x *= 0.55f;
|
||||||
|
c.vel.z *= 0.55f;
|
||||||
|
if (std::abs(c.vel.y) < 0.4f) c.age += dt * 2.5f;
|
||||||
|
}
|
||||||
|
if (c.age > c.life) {
|
||||||
|
chunks_[i] = chunks_.back();
|
||||||
|
chunks_.pop_back();
|
||||||
|
} else {
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConcreteDebris::draw(Vector3 camera_pos) const {
|
||||||
|
for (const ConcreteChunk& c : chunks_) {
|
||||||
|
const float dx = c.pos.x - camera_pos.x;
|
||||||
|
const float dz = c.pos.z - camera_pos.z;
|
||||||
|
if (dx * dx + dz * dz > 62.0f * 62.0f) continue;
|
||||||
|
const float fade = 1.0f - c.age / c.life;
|
||||||
|
Color tint{c.shade, c.shade, static_cast<unsigned char>(c.shade + 4),
|
||||||
|
static_cast<unsigned char>(255.0f * std::min(1.0f, fade * 2.5f))};
|
||||||
|
rlPushMatrix();
|
||||||
|
rlTranslatef(c.pos.x, c.pos.y, c.pos.z);
|
||||||
|
rlRotatef(c.roll, 0.0f, 0.0f, 1.0f);
|
||||||
|
rlRotatef(c.pitch, 1.0f, 0.0f, 0.0f);
|
||||||
|
rlRotatef(c.yaw, 0.0f, 1.0f, 0.0f);
|
||||||
|
DrawCube({0.0f, 0.0f, 0.0f}, c.size, c.size * 0.55f, c.size * 0.8f,
|
||||||
|
tint);
|
||||||
|
rlPopMatrix();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ScorchDecals::add(Vec2 pos, float radius) {
|
void ScorchDecals::add(Vec2 pos, float radius) {
|
||||||
items_[head_] = {pos, radius, static_cast<float>(GetRandomValue(0, 1000))};
|
items_[head_] = {pos, radius, static_cast<float>(GetRandomValue(0, 1000))};
|
||||||
head_ = (head_ + 1) % kCapacity;
|
head_ = (head_ + 1) % kCapacity;
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,36 @@ struct ScorchDecal {
|
||||||
float seed = 0.0f;
|
float seed = 0.0f;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ConcreteChunk {
|
||||||
|
Vector3 pos{};
|
||||||
|
Vector3 vel{};
|
||||||
|
float yaw = 0.0f;
|
||||||
|
float pitch = 0.0f;
|
||||||
|
float roll = 0.0f;
|
||||||
|
float spin_y = 0.0f;
|
||||||
|
float spin_x = 0.0f;
|
||||||
|
float age = 0.0f;
|
||||||
|
float life = 1.0f;
|
||||||
|
float size = 0.30f;
|
||||||
|
unsigned char shade = 90;
|
||||||
|
};
|
||||||
|
|
||||||
|
class ConcreteDebris {
|
||||||
|
public:
|
||||||
|
static constexpr int kCapacity = 120;
|
||||||
|
|
||||||
|
void init();
|
||||||
|
void clear();
|
||||||
|
int count() const { return static_cast<int>(chunks_.size()); }
|
||||||
|
|
||||||
|
void burst(Vec2 center, float radius, int count);
|
||||||
|
void update(float dt);
|
||||||
|
void draw(Vector3 camera_pos) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<ConcreteChunk> chunks_;
|
||||||
|
};
|
||||||
|
|
||||||
class ScorchDecals {
|
class ScorchDecals {
|
||||||
public:
|
public:
|
||||||
static constexpr int kCapacity = 40;
|
static constexpr int kCapacity = 40;
|
||||||
|
|
|
||||||
|
|
@ -203,6 +203,71 @@ void Presenter::init(float arena_half) {
|
||||||
Color{190, 186, 164, 12});
|
Color{190, 186, 164, 12});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Painted walkway lines + survey grid.
|
||||||
|
b.add_box({-12.0f, 0.012f, 0.0f}, {0.18f, 0.024f, arena * 2.0f}, Color{150, 147, 138, 255});
|
||||||
|
b.add_box({12.0f, 0.012f, 0.0f}, {0.18f, 0.024f, arena * 2.0f}, Color{150, 147, 138, 255});
|
||||||
|
b.add_box({0.0f, 0.012f, -12.0f}, {arena * 2.0f, 0.024f, 0.18f}, Color{150, 147, 138, 255});
|
||||||
|
b.add_box({0.0f, 0.012f, 12.0f}, {arena * 2.0f, 0.024f, 0.18f}, Color{150, 147, 138, 255});
|
||||||
|
for (const float cross : {-80.0f, -40.0f, 40.0f, 80.0f}) {
|
||||||
|
b.add_box({cross, 0.011f, 0.0f}, {0.12f, 0.022f, arena * 2.0f}, Color{112, 110, 104, 255});
|
||||||
|
b.add_box({0.0f, 0.011f, cross}, {arena * 2.0f, 0.022f, 0.12f}, Color{112, 110, 104, 255});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stains.
|
||||||
|
const float stains[][4] = {
|
||||||
|
{-9.0f, -14.0f, 1.8f, 0.7f}, {8.0f, -11.0f, 1.2f, 0.5f},
|
||||||
|
{-16.0f, 4.0f, 2.2f, 0.6f}, {12.5f, 12.0f, 1.6f, 0.8f},
|
||||||
|
{-5.0f, 18.0f, 1.4f, 0.5f}, {17.0f, -3.0f, 1.9f, 0.7f},
|
||||||
|
{-19.0f, -8.0f, 1.5f, 0.6f}, {3.0f, -20.0f, 2.1f, 0.7f},
|
||||||
|
};
|
||||||
|
for (const auto& st : stains) {
|
||||||
|
b.add_cylinder({st[0], 0.016f, st[1]}, st[2], st[2], 0.012f, 8,
|
||||||
|
Color{28, 12, 14, static_cast<unsigned char>(55 * st[3])});
|
||||||
|
}
|
||||||
|
// Scraps.
|
||||||
|
const float scraps[][2] = {
|
||||||
|
{-7.5f, -9.0f}, {-6.8f, -9.6f}, {5.5f, -15.0f}, {9.5f, 6.5f},
|
||||||
|
{10.2f, 7.1f}, {-14.0f, 11.5f}, {15.5f, -9.0f}, {-17.0f, -13.0f},
|
||||||
|
{2.0f, 20.0f}, {-3.0f, -17.0f}, {12.0f, 19.0f}, {-11.0f, 1.5f},
|
||||||
|
};
|
||||||
|
for (int i = 0; i < 12; ++i) {
|
||||||
|
const float x = scraps[i][0], z = scraps[i][1];
|
||||||
|
b.add_box({x, 0.022f, z}, {0.28f, 0.012f, 0.38f},
|
||||||
|
(i % 3 == 0) ? Color{90, 20, 26, 255} : Color{198, 192, 176, 255});
|
||||||
|
}
|
||||||
|
// Far stains.
|
||||||
|
const float far_stains[][4] = {
|
||||||
|
{-38.0f, -28.0f, 2.6f, 0.7f}, {42.0f, 21.0f, 3.1f, 0.6f},
|
||||||
|
{-58.0f, 38.0f, 2.2f, 0.8f}, {28.0f, -51.0f, 3.4f, 0.5f},
|
||||||
|
{71.0f, -22.0f, 2.8f, 0.6f}, {-72.0f, -68.0f, 3.6f, 0.7f},
|
||||||
|
{16.0f, 62.0f, 2.4f, 0.7f}, {-24.0f, -79.0f, 3.0f, 0.6f},
|
||||||
|
{83.0f, 74.0f, 2.7f, 0.7f}, {4.0f, -38.0f, 2.0f, 0.8f},
|
||||||
|
};
|
||||||
|
for (const auto& st : far_stains) {
|
||||||
|
b.add_cylinder({st[0], 0.016f, st[1]}, st[2], st[2] * 1.3f, 0.012f, 8,
|
||||||
|
Color{26, 12, 14, static_cast<unsigned char>(48 * st[3])});
|
||||||
|
}
|
||||||
|
// Far scraps.
|
||||||
|
const float far_scraps[][2] = {
|
||||||
|
{-35.0f, -33.0f}, {-33.6f, -34.2f}, {37.0f, 32.0f}, {38.4f, 31.1f},
|
||||||
|
{-60.0f, 12.0f}, {-58.8f, 13.4f}, {52.0f, -44.0f}, {53.2f, -45.1f},
|
||||||
|
{-48.0f, -56.0f}, {-46.5f, -57.2f}, {66.0f, 28.0f}, {64.7f, 29.5f},
|
||||||
|
{-77.0f, -26.0f}, {-75.6f, -27.5f}, {22.0f, 70.0f}, {20.8f, 71.4f},
|
||||||
|
};
|
||||||
|
for (std::size_t i = 0; i < 16; ++i) {
|
||||||
|
b.add_box({far_scraps[i][0], 0.022f, far_scraps[i][1]}, {0.34f, 0.012f, 0.44f},
|
||||||
|
(i % 4 == 0) ? Color{90, 20, 26, 255} : Color{198, 192, 176, 255});
|
||||||
|
}
|
||||||
|
// Cross lines.
|
||||||
|
for (const float cross : {-40.0f, 40.0f}) {
|
||||||
|
b.add_box({cross, 0.03f, 0.0f}, {0.09f, 0.03f, 110.0f}, Color{20, 20, 24, 255});
|
||||||
|
b.add_box({0.0f, 0.03f, cross}, {110.0f, 0.03f, 0.09f}, Color{20, 20, 24, 255});
|
||||||
|
}
|
||||||
|
// Red lines.
|
||||||
|
for (const float x : {-8.6f, 8.6f}) {
|
||||||
|
b.add_box({x, 0.03f, 0.0f}, {0.09f, 0.03f, 34.0f}, Color{20, 20, 24, 255});
|
||||||
|
}
|
||||||
|
|
||||||
static_env_mesh_ = b.to_mesh();
|
static_env_mesh_ = b.to_mesh();
|
||||||
UploadMesh(&static_env_mesh_, false);
|
UploadMesh(&static_env_mesh_, false);
|
||||||
static_env_model_ = LoadModelFromMesh(static_env_mesh_);
|
static_env_model_ = LoadModelFromMesh(static_env_mesh_);
|
||||||
|
|
@ -211,6 +276,7 @@ void Presenter::init(float arena_half) {
|
||||||
aura_.init();
|
aura_.init();
|
||||||
dressing_.init();
|
dressing_.init();
|
||||||
debris_.init();
|
debris_.init();
|
||||||
|
concrete_debris_.init();
|
||||||
scorch_.clear();
|
scorch_.clear();
|
||||||
damage_numbers_.reserve(64);
|
damage_numbers_.reserve(64);
|
||||||
sparks_.reserve(160);
|
sparks_.reserve(160);
|
||||||
|
|
@ -219,11 +285,13 @@ void Presenter::init(float arena_half) {
|
||||||
void Presenter::reset() {
|
void Presenter::reset() {
|
||||||
dressing_.reset();
|
dressing_.reset();
|
||||||
debris_.clear();
|
debris_.clear();
|
||||||
|
concrete_debris_.clear();
|
||||||
scorch_.clear();
|
scorch_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Presenter::shutdown() {
|
void Presenter::shutdown() {
|
||||||
debris_.clear();
|
debris_.clear();
|
||||||
|
concrete_debris_.clear();
|
||||||
scorch_.clear();
|
scorch_.clear();
|
||||||
aura_.shutdown();
|
aura_.shutdown();
|
||||||
concrete_.shutdown();
|
concrete_.shutdown();
|
||||||
|
|
@ -250,19 +318,6 @@ void Presenter::draw_environment(const Game& game) {
|
||||||
arena * 2.0f + 40.0f, Color{43, 43, 47, 255});
|
arena * 2.0f + 40.0f, Color{43, 43, 47, 255});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Painted walkway lines.
|
|
||||||
const Color line{150, 147, 138, 255};
|
|
||||||
DrawCube({-12.0f, 0.012f, 0.0f}, 0.18f, 0.024f, arena * 2.0f, line);
|
|
||||||
DrawCube({12.0f, 0.012f, 0.0f}, 0.18f, 0.024f, arena * 2.0f, line);
|
|
||||||
DrawCube({0.0f, 0.012f, -12.0f}, arena * 2.0f, 0.024f, 0.18f, line);
|
|
||||||
DrawCube({0.0f, 0.012f, 12.0f}, arena * 2.0f, 0.024f, 0.18f, line);
|
|
||||||
// Fainter survey grid divides the expanded slab into facility sectors.
|
|
||||||
for (const float cross : {-80.0f, -40.0f, 40.0f, 80.0f}) {
|
|
||||||
DrawCube({cross, 0.011f, 0.0f}, 0.12f, 0.022f, arena * 2.0f,
|
|
||||||
Color{112, 110, 104, 255});
|
|
||||||
DrawCube({0.0f, 0.011f, cross}, arena * 2.0f, 0.022f, 0.12f,
|
|
||||||
Color{112, 110, 104, 255});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Signal-red carpet runners: deep pile, worn lanes and panel seams.
|
// Signal-red carpet runners: deep pile, worn lanes and panel seams.
|
||||||
const Color carpet{112, 12, 22, 255};
|
const Color carpet{112, 12, 22, 255};
|
||||||
|
|
@ -349,61 +404,8 @@ void Presenter::draw_environment(const Game& game) {
|
||||||
|
|
||||||
// Spilled toner / scorched stains and redacted paper scraps break up the
|
// Spilled toner / scorched stains and redacted paper scraps break up the
|
||||||
// otherwise uniform concrete without touching the tactical lanes.
|
// otherwise uniform concrete without touching the tactical lanes.
|
||||||
const float stains[][4] = {
|
|
||||||
{-9.0f, -14.0f, 1.8f, 0.7f}, {8.0f, -11.0f, 1.2f, 0.5f},
|
|
||||||
{-16.0f, 4.0f, 2.2f, 0.6f}, {12.5f, 12.0f, 1.6f, 0.8f},
|
|
||||||
{-5.0f, 18.0f, 1.4f, 0.5f}, {17.0f, -3.0f, 1.9f, 0.7f},
|
|
||||||
{-19.0f, -8.0f, 1.5f, 0.6f}, {3.0f, -20.0f, 2.1f, 0.7f},
|
|
||||||
};
|
|
||||||
for (const auto& s : stains) {
|
|
||||||
DrawCylinder({s[0], 0.016f, s[1]}, s[2], s[2], 0.012f, 10,
|
|
||||||
Color{28, 12, 14, static_cast<unsigned char>(55 * s[3])});
|
|
||||||
}
|
|
||||||
const float scraps[][2] = {
|
|
||||||
{-7.5f, -9.0f}, {-6.8f, -9.6f}, {5.5f, -15.0f}, {9.5f, 6.5f},
|
|
||||||
{10.2f, 7.1f}, {-14.0f, 11.5f}, {15.5f, -9.0f}, {-17.0f, -13.0f},
|
|
||||||
{2.0f, 20.0f}, {-3.0f, -17.0f}, {12.0f, 19.0f}, {-11.0f, 1.5f},
|
|
||||||
};
|
|
||||||
for (int i = 0; i < 12; ++i) {
|
|
||||||
const float x = scraps[i][0], z = scraps[i][1];
|
|
||||||
DrawCube({x, 0.022f, z}, 0.28f, 0.012f, 0.38f,
|
|
||||||
(i % 3 == 0) ? Color{90, 20, 26, 255} : Color{198, 192, 176, 255});
|
|
||||||
}
|
|
||||||
for (const float x : {-8.6f, 8.6f}) {
|
|
||||||
DrawCube({x, 0.03f, 0.0f}, 0.09f, 0.03f, 34.0f,
|
|
||||||
Color{20, 20, 24, 255});
|
|
||||||
}
|
|
||||||
// The same scuff language continues across the expanded slab so the far
|
// The same scuff language continues across the expanded slab so the far
|
||||||
// sectors carry detail when the camera follows the player out of the hub.
|
// sectors carry detail when the camera follows the player out of the hub.
|
||||||
const float far_stains[][4] = {
|
|
||||||
{-38.0f, -28.0f, 2.6f, 0.7f}, {42.0f, 21.0f, 3.1f, 0.6f},
|
|
||||||
{-58.0f, 38.0f, 2.2f, 0.8f}, {28.0f, -51.0f, 3.4f, 0.5f},
|
|
||||||
{71.0f, -22.0f, 2.8f, 0.6f}, {-72.0f, -68.0f, 3.6f, 0.7f},
|
|
||||||
{16.0f, 62.0f, 2.4f, 0.7f}, {-24.0f, -79.0f, 3.0f, 0.6f},
|
|
||||||
{83.0f, 74.0f, 2.7f, 0.7f}, {4.0f, -38.0f, 2.0f, 0.8f},
|
|
||||||
};
|
|
||||||
for (const auto& s : far_stains) {
|
|
||||||
DrawCylinder({s[0], 0.016f, s[1]}, s[2], s[2] * 1.3f, 0.012f, 11,
|
|
||||||
Color{26, 12, 14, static_cast<unsigned char>(48 * s[3])});
|
|
||||||
}
|
|
||||||
const float far_scraps[][2] = {
|
|
||||||
{-35.0f, -33.0f}, {-33.6f, -34.2f}, {37.0f, 32.0f}, {38.4f, 31.1f},
|
|
||||||
{-60.0f, 12.0f}, {-58.8f, 13.4f}, {52.0f, -44.0f}, {53.2f, -45.1f},
|
|
||||||
{-48.0f, -56.0f}, {-46.5f, -57.2f}, {66.0f, 28.0f}, {64.7f, 29.5f},
|
|
||||||
{-77.0f, -26.0f}, {-75.6f, -27.5f}, {22.0f, 70.0f}, {20.8f, 71.4f},
|
|
||||||
};
|
|
||||||
for (std::size_t i = 0; i < std::size(far_scraps); ++i) {
|
|
||||||
DrawCube({far_scraps[i][0], 0.022f, far_scraps[i][1]}, 0.34f, 0.012f,
|
|
||||||
0.44f,
|
|
||||||
(i % 4 == 0) ? Color{90, 20, 26, 255}
|
|
||||||
: Color{198, 192, 176, 255});
|
|
||||||
}
|
|
||||||
for (const float cross : {-40.0f, 40.0f}) {
|
|
||||||
DrawCube({cross, 0.03f, 0.0f}, 0.09f, 0.03f, 110.0f,
|
|
||||||
Color{20, 20, 24, 255});
|
|
||||||
DrawCube({0.0f, 0.03f, cross}, 110.0f, 0.03f, 0.09f,
|
|
||||||
Color{20, 20, 24, 255});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Perimeter curbs (the textured versions live in ConcreteMaterial).
|
// Perimeter curbs (the textured versions live in ConcreteMaterial).
|
||||||
if (concrete_fallback) {
|
if (concrete_fallback) {
|
||||||
|
|
@ -425,20 +427,6 @@ void Presenter::draw_environment(const Game& game) {
|
||||||
|
|
||||||
// Low partitions mark the new room without blocking the overhead camera:
|
// Low partitions mark the new room without blocking the overhead camera:
|
||||||
// a north wall, two side walls and a south wall split by a wide entrance.
|
// a north wall, two side walls and a south wall split by a wide entrance.
|
||||||
const Color partition{58, 60, 64, 255};
|
|
||||||
DrawCube({room.cx, 0.85f, rz1}, room.hx * 2.0f, 1.7f, 0.45f, partition);
|
|
||||||
DrawCube({rx0, 0.75f, room.cz}, 0.45f, 1.5f, room.hz * 2.0f, partition);
|
|
||||||
DrawCube({rx1, 0.75f, room.cz}, 0.45f, 1.5f, room.hz * 2.0f, partition);
|
|
||||||
const float south_span = room.hx - 5.0f;
|
|
||||||
DrawCube({room.cx - (room.hx + 5.0f) * 0.5f, 0.65f, rz0}, south_span,
|
|
||||||
1.3f, 0.45f, partition);
|
|
||||||
DrawCube({room.cx + (room.hx + 5.0f) * 0.5f, 0.65f, rz0}, south_span,
|
|
||||||
1.3f, 0.45f, partition);
|
|
||||||
for (float x = rx0 + 4.0f; x < rx1; x += 8.0f) {
|
|
||||||
DrawCube({x, 1.46f, rz1}, 1.1f, 0.12f, 0.5f, Color{198, 192, 176, 255});
|
|
||||||
}
|
|
||||||
DrawCube({room.cx, 1.02f, rz0 + 0.26f}, 4.6f, 0.32f, 0.08f,
|
|
||||||
Color{245, 197, 24, 255});
|
|
||||||
|
|
||||||
|
|
||||||
// Fluorescent strips live at curb height — the tactical camera sits above
|
// Fluorescent strips live at curb height — the tactical camera sits above
|
||||||
|
|
@ -478,15 +466,6 @@ void Presenter::draw_environment(const Game& game) {
|
||||||
}
|
}
|
||||||
DrawCube({0.0f, 2.85f, door_z - 0.2f}, 3.7f, 5.1f, 0.1f,
|
DrawCube({0.0f, 2.85f, door_z - 0.2f}, 3.7f, 5.1f, 0.1f,
|
||||||
Color{190, 28, 38, 255}); // Hiss glow bleeding through
|
Color{190, 28, 38, 255}); // Hiss glow bleeding through
|
||||||
for (int i = 0; i < 10; ++i) {
|
|
||||||
const float x0 = -2.31f + i * 0.462f;
|
|
||||||
DrawCube({x0, 0.045f, arena - 0.6f}, 0.23f, 0.055f, 1.1f,
|
|
||||||
(i % 2 == 0) ? Color{198, 153, 13, 255} : Color{20, 20, 22, 255});
|
|
||||||
}
|
|
||||||
DrawCube({-10.0f, 2.4f, door_z - 0.2f}, 1.7f, 0.52f, 0.12f,
|
|
||||||
Color{46, 170, 76, 255});
|
|
||||||
DrawCube({10.0f, 2.4f, door_z - 0.2f}, 1.7f, 0.52f, 0.12f,
|
|
||||||
Color{46, 170, 76, 255});
|
|
||||||
DrawCube({0.0f, 1.45f, arena + 0.5f}, 38.0f, 0.12f, 0.3f,
|
DrawCube({0.0f, 1.45f, arena + 0.5f}, 38.0f, 0.12f, 0.3f,
|
||||||
Color{120, 42, 44, 255});
|
Color{120, 42, 44, 255});
|
||||||
|
|
||||||
|
|
@ -668,8 +647,17 @@ void Presenter::draw_scene(Game& game) {
|
||||||
Vector3 origins[16];
|
Vector3 origins[16];
|
||||||
const int destroyed = dressing_.destroy_in_radius(
|
const int destroyed = dressing_.destroy_in_radius(
|
||||||
e.pos, radius, origins, static_cast<int>(std::size(origins)));
|
e.pos, radius, origins, static_cast<int>(std::size(origins)));
|
||||||
|
if (destroyed > 0) {
|
||||||
debris_.burst(e.pos, 0.9f, radius, origins, destroyed,
|
debris_.burst(e.pos, 0.9f, radius, origins, destroyed,
|
||||||
std::min(36, 10 + static_cast<int>(radius * 5.0f) + destroyed * 3));
|
std::min(36, 8 + static_cast<int>(radius * 3.0f)
|
||||||
|
+ destroyed * 3));
|
||||||
|
}
|
||||||
|
if (e.flags & kDetonateConcrete) {
|
||||||
|
concrete_debris_.burst(
|
||||||
|
e.pos, radius,
|
||||||
|
std::min(28, 12 + static_cast<int>(radius * 3.0f)));
|
||||||
|
spawn_sparks(e.pos, 0.25f, Color{170, 166, 158, 255}, 10, 3.4f);
|
||||||
|
}
|
||||||
scorch_.add(e.pos, radius * 0.6f);
|
scorch_.add(e.pos, radius * 0.6f);
|
||||||
aura_.spawn_ground({e.pos.x, 0.09f, e.pos.y}, radius * 1.6f,
|
aura_.spawn_ground({e.pos.x, 0.09f, e.pos.y}, radius * 1.6f,
|
||||||
1.7f, anim_time_);
|
1.7f, anim_time_);
|
||||||
|
|
@ -716,6 +704,7 @@ void Presenter::draw_scene(Game& game) {
|
||||||
[](const Spark& s) { return s.age > s.life; }),
|
[](const Spark& s) { return s.age > s.life; }),
|
||||||
sparks_.end());
|
sparks_.end());
|
||||||
debris_.update(frame_dt, game.corruption.value());
|
debris_.update(frame_dt, game.corruption.value());
|
||||||
|
concrete_debris_.update(frame_dt);
|
||||||
|
|
||||||
const float sx = static_cast<float>(GetRandomValue(-100, 100)) / 100.0f * shake_;
|
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 float sy = static_cast<float>(GetRandomValue(-100, 100)) / 100.0f * shake_;
|
||||||
|
|
@ -845,6 +834,7 @@ void Presenter::draw_scene(Game& game) {
|
||||||
}
|
}
|
||||||
|
|
||||||
debris_.draw(camera_.position);
|
debris_.draw(camera_.position);
|
||||||
|
concrete_debris_.draw(camera_.position);
|
||||||
|
|
||||||
EndMode3D();
|
EndMode3D();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,7 @@ private:
|
||||||
CorruptionAura aura_;
|
CorruptionAura aura_;
|
||||||
Dressing dressing_;
|
Dressing dressing_;
|
||||||
PaperDebris debris_;
|
PaperDebris debris_;
|
||||||
|
ConcreteDebris concrete_debris_;
|
||||||
ScorchDecals scorch_;
|
ScorchDecals scorch_;
|
||||||
Mesh static_env_mesh_{};
|
Mesh static_env_mesh_{};
|
||||||
Model static_env_model_{};
|
Model static_env_model_{};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue