Add pitstop audio cue, original explosions/smoke, authentic HUD, and Modern lighting/shadows
This commit is contained in:
1 parent
3a377b0534
commit
197bfbc973
21 files changed
+1927
-246
No files matched your search
+175
-5
@@ -671,25 +671,47 @@ int main() {
|
||||
p1.vel = Vec3(0, 0, 0);
|
||||
};
|
||||
|
||||
// Fuel bay (49.0, 79.0): recharges only fuel + emits Refuel sound
|
||||
// Fuel bay (49.0, 79.0): recharges only fuel, updates on_pit_mask/pit_fill_ratio & emits PitComplete on 100%
|
||||
p1.fuel = 20.0f;
|
||||
p1.shield = 20.0f;
|
||||
p1.ammo = 20.0f;
|
||||
p1.refuel_sound_cd = 0.0f;
|
||||
place_p1(49.0f, 79.0f);
|
||||
psim.clear_events();
|
||||
bool saw_refuel_sfx = false;
|
||||
float first_fill = 1.0f;
|
||||
float mid_fill = 0.0f;
|
||||
bool saw_pit_complete = false;
|
||||
for (int t = 0; t < 60; ++t) {
|
||||
psim.step(CraftInput{}, CraftInput{}, dt);
|
||||
if (t == 0) {
|
||||
CHECK(p1.on_pit_mask == 2u);
|
||||
CHECK(p1.active_recharge_mask == 2u);
|
||||
first_fill = p1.pit_fill_ratio;
|
||||
}
|
||||
if (t == 59) {
|
||||
mid_fill = p1.pit_fill_ratio;
|
||||
}
|
||||
for (const auto& ev : psim.events()) {
|
||||
if (ev.sound == sim::SimSoundCue::Refuel) saw_refuel_sfx = true;
|
||||
if (ev.sound == sim::SimSoundCue::PitComplete) saw_pit_complete = true;
|
||||
}
|
||||
psim.clear_events();
|
||||
}
|
||||
CHECK(p1.fuel > 70.0f);
|
||||
CHECK(p1.shield == 20.0f);
|
||||
CHECK(p1.ammo == 20.0f);
|
||||
CHECK(saw_refuel_sfx);
|
||||
CHECK(mid_fill > first_fill && mid_fill < 1.0f);
|
||||
|
||||
// Continue on Fuel bay until full -> PitComplete emitted & active_recharge_mask clears while on_pit_mask stays 2
|
||||
for (int t = 0; t < 70; ++t) {
|
||||
psim.step(CraftInput{}, CraftInput{}, dt);
|
||||
for (const auto& ev : psim.events()) {
|
||||
if (ev.sound == sim::SimSoundCue::PitComplete) saw_pit_complete = true;
|
||||
}
|
||||
psim.clear_events();
|
||||
}
|
||||
CHECK(p1.fuel >= p1.max_fuel - 0.5f);
|
||||
CHECK(p1.on_pit_mask == 2u);
|
||||
CHECK(p1.active_recharge_mask == 0u);
|
||||
CHECK(saw_pit_complete);
|
||||
|
||||
// Ammo bay (49.0, 85.0): recharges only ammo
|
||||
p1.fuel = 20.0f;
|
||||
@@ -760,5 +782,153 @@ int main() {
|
||||
}
|
||||
std::cout << "[PASS] Authentic pitstop Fuel/Shield/Ammo chargers verified across all 6 tracks\n";
|
||||
|
||||
// 9. Original Explosions, Volumetric Smoke Trails, Wreck Plumes & Steam Vents
|
||||
{
|
||||
// 9a. Unguided missile smoke contrail + exhaust glow
|
||||
{
|
||||
sim::RaceSetup ms;
|
||||
ms.mode = sim::GameMode::SingleRace;
|
||||
ms.track_number = 1;
|
||||
ms.num_ai = 0;
|
||||
ms.fuel_enabled = false;
|
||||
sim::RaceSim msim;
|
||||
CHECK(msim.start_race(lvl1, ms));
|
||||
for (int t = 0; t < 200; ++t) msim.step(CraftInput{}, CraftInput{}, dt);
|
||||
|
||||
auto& p1 = msim.crafts_mut()[0];
|
||||
p1.lock_progress = 0.0f;
|
||||
p1.lock_target_id = -1;
|
||||
CraftInput fire;
|
||||
fire.fire_missile = true;
|
||||
msim.step(fire, CraftInput{}, dt);
|
||||
for (int t = 0; t < 10; ++t) msim.step(CraftInput{}, CraftInput{}, dt);
|
||||
|
||||
bool saw_smoke = false, saw_glow = false;
|
||||
for (const auto& pb : msim.particles()) {
|
||||
if (pb.kind == sim::ParticleKind::Smoke) saw_smoke = true;
|
||||
if (pb.kind == sim::ParticleKind::AdditiveGlow) saw_glow = true;
|
||||
}
|
||||
CHECK(saw_smoke && saw_glow);
|
||||
}
|
||||
|
||||
// 9b. Multi-layer explosion FX evolution (expanding smoke, falling debris) + kMaxParticles cap
|
||||
{
|
||||
sim::RaceSetup es;
|
||||
es.mode = sim::GameMode::DeathMatch;
|
||||
es.track_number = 1;
|
||||
es.num_ai = 1;
|
||||
es.fuel_enabled = false;
|
||||
sim::RaceSim esim;
|
||||
CHECK(esim.start_race(lvl1, es));
|
||||
for (int t = 0; t < 200; ++t) esim.step(CraftInput{}, CraftInput{}, dt);
|
||||
|
||||
auto& p1 = esim.crafts_mut()[0];
|
||||
auto& tgt = esim.crafts_mut()[1];
|
||||
tgt.curr_pose.pos = p1.curr_pose.pos + p1.forward_dir() * 4.0f;
|
||||
tgt.prev_pose = tgt.curr_pose;
|
||||
tgt.shield = 1.0f;
|
||||
p1.lock_progress = 1.0f;
|
||||
p1.lock_target_id = tgt.id;
|
||||
|
||||
CraftInput fire;
|
||||
fire.fire_missile = true;
|
||||
for (int t = 0; t < 20 && tgt.recovery_state == sim::RecoveryState::Active; ++t) {
|
||||
esim.step(fire, CraftInput{}, dt);
|
||||
fire.fire_missile = false;
|
||||
}
|
||||
CHECK(tgt.recovery_state == sim::RecoveryState::CallingRepair);
|
||||
|
||||
float max_smoke0 = 0.0f;
|
||||
float min_debris_vy0 = 1e9f;
|
||||
bool has_fireball = false, has_smoke = false, has_debris = false;
|
||||
for (const auto& pb : esim.particles()) {
|
||||
if (pb.kind == sim::ParticleKind::Fireball) has_fireball = true;
|
||||
if (pb.kind == sim::ParticleKind::Smoke) {
|
||||
has_smoke = true;
|
||||
max_smoke0 = std::max(max_smoke0, pb.size);
|
||||
}
|
||||
if (pb.kind == sim::ParticleKind::Debris) {
|
||||
has_debris = true;
|
||||
min_debris_vy0 = std::min(min_debris_vy0, pb.vel.y);
|
||||
}
|
||||
}
|
||||
CHECK(has_fireball && has_smoke && has_debris);
|
||||
|
||||
for (int t = 0; t < 6; ++t) esim.step(CraftInput{}, CraftInput{}, dt);
|
||||
float max_smoke1 = 0.0f;
|
||||
float min_debris_vy1 = 1e9f;
|
||||
for (const auto& pb : esim.particles()) {
|
||||
if (pb.kind == sim::ParticleKind::Smoke) max_smoke1 = std::max(max_smoke1, pb.size);
|
||||
if (pb.kind == sim::ParticleKind::Debris) min_debris_vy1 = std::min(min_debris_vy1, pb.vel.y);
|
||||
}
|
||||
CHECK(max_smoke1 > max_smoke0);
|
||||
CHECK(min_debris_vy1 < min_debris_vy0);
|
||||
|
||||
// Wreck plume continues emitting Fireball & Smoke long after initial explosion fades
|
||||
for (int t = 0; t < 55; ++t) esim.step(CraftInput{}, CraftInput{}, dt);
|
||||
CHECK(tgt.recovery_state != sim::RecoveryState::Active);
|
||||
bool wreck_fire = false, wreck_smoke = false;
|
||||
for (int t = 0; t < 25; ++t) {
|
||||
esim.step(CraftInput{}, CraftInput{}, dt);
|
||||
for (const auto& pb : esim.particles()) {
|
||||
if (pb.kind == sim::ParticleKind::Fireball) wreck_fire = true;
|
||||
if (pb.kind == sim::ParticleKind::Smoke) wreck_smoke = true;
|
||||
}
|
||||
}
|
||||
CHECK(wreck_fire && wreck_smoke);
|
||||
|
||||
// Rapid wall-missile spam stays within kMaxParticles
|
||||
for (int t = 0; t < 35; ++t) {
|
||||
p1.missile_cd = 0.0f;
|
||||
p1.ammo = p1.max_ammo;
|
||||
CraftInput spam;
|
||||
spam.fire_missile = true;
|
||||
esim.step(spam, CraftInput{}, dt);
|
||||
}
|
||||
CHECK(esim.particles().size() <= sim::RaceSim::kMaxParticles);
|
||||
}
|
||||
|
||||
// 9c. Damaged craft smoke trail & Level 4 continuous steam vent
|
||||
{
|
||||
assets::LevelData lvl4;
|
||||
CHECK(lvl4.load(vfs, 4));
|
||||
sim::RaceSetup ss;
|
||||
ss.mode = sim::GameMode::SingleRace;
|
||||
ss.track_number = 4;
|
||||
ss.num_ai = 0;
|
||||
ss.fuel_enabled = false;
|
||||
sim::RaceSim ssim;
|
||||
CHECK(ssim.start_race(lvl4, ss));
|
||||
for (int t = 0; t < 200; ++t) ssim.step(CraftInput{}, CraftInput{}, dt);
|
||||
|
||||
auto& p1 = ssim.crafts_mut()[0];
|
||||
p1.shield = p1.max_shield * 0.15f;
|
||||
for (int t = 0; t < 15; ++t) ssim.step(CraftInput{}, CraftInput{}, dt);
|
||||
bool damaged_smoke = false;
|
||||
for (const auto& pb : ssim.particles()) {
|
||||
if (pb.kind == sim::ParticleKind::Smoke) damaged_smoke = true;
|
||||
}
|
||||
CHECK(damaged_smoke);
|
||||
|
||||
// Restore full shield, trigger Level 4 group 6 steam vents via (11.5, 77.5)
|
||||
p1.shield = p1.max_shield;
|
||||
for (int t = 0; t < 80; ++t) ssim.step(CraftInput{}, CraftInput{}, dt); // let old smoke expire
|
||||
p1.curr_pose.pos = Vec3(11.5f, ssim.level().sample_height_world(11.5f, 77.5f) + 0.30f, 77.5f);
|
||||
p1.prev_pose = p1.curr_pose;
|
||||
p1.vel = Vec3(0, 0, 0);
|
||||
ssim.step(CraftInput{}, CraftInput{}, dt);
|
||||
CHECK(!ssim.particles().empty());
|
||||
|
||||
// After 1.5s (> 1.15s initial puff lifetime), continuous steam vent still emits Smoke
|
||||
for (int t = 0; t < 90; ++t) ssim.step(CraftInput{}, CraftInput{}, dt);
|
||||
bool continuous_steam = false;
|
||||
for (const auto& pb : ssim.particles()) {
|
||||
if (pb.kind == sim::ParticleKind::Smoke) continuous_steam = true;
|
||||
}
|
||||
CHECK(continuous_steam);
|
||||
}
|
||||
}
|
||||
std::cout << "[PASS] Original explosions, smoke trails, wreck plumes & steam vents validated\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user