Fix geometry collision traps and implement authentic sector morphing
This commit is contained in:
1 parent
cd63921ea4
commit
b9353f552c
16 files changed
+1470
-131
No files matched your search
+17
-3
@@ -130,7 +130,8 @@ void step_combat_and_world(
|
||||
std::vector<SimEvent>& events,
|
||||
bool& out_race_over,
|
||||
int& out_winner_id,
|
||||
float dt) {
|
||||
float dt,
|
||||
std::vector<ProjectileTrace>* out_projectile_traces) {
|
||||
|
||||
// 1. Recovery craft state machine & weapon firing per craft
|
||||
for (size_t i = 0; i < crafts.size(); ++i) {
|
||||
@@ -284,13 +285,23 @@ void step_combat_and_world(
|
||||
particles.push_back({pr.pos, Vec3(0, 0, 0), 0.14f, Vec4(1.0f, 0.95f, 0.4f, 0.9f), 0.06f, 0.06f});
|
||||
}
|
||||
|
||||
Vec3 prev_pos = pr.pos;
|
||||
pr.pos += pr.vel * dt;
|
||||
if (out_projectile_traces != nullptr) {
|
||||
int owner_player = -1;
|
||||
if (pr.owner_id >= 0 && pr.owner_id < static_cast<int>(crafts.size()) &&
|
||||
crafts[pr.owner_id].is_human) {
|
||||
owner_player = crafts[pr.owner_id].player_index;
|
||||
}
|
||||
out_projectile_traces->push_back({prev_pos, pr.pos, owner_player, pr.is_missile});
|
||||
}
|
||||
|
||||
// World/Column/Ground impact
|
||||
float gy = level.sample_height_world(pr.pos.x, pr.pos.z);
|
||||
int ix = static_cast<int>(std::floor(pr.pos.x));
|
||||
int iz = static_cast<int>(std::floor(pr.pos.z));
|
||||
if (pr.pos.y <= gy ||
|
||||
level.is_cell_solid_at_y(static_cast<int>(std::floor(pr.pos.x)),
|
||||
static_cast<int>(std::floor(pr.pos.z)), pr.pos.y)) {
|
||||
level.is_cell_solid_at_point(ix, iz, pr.pos.x, pr.pos.z, pr.pos.y, 0.10f)) {
|
||||
pr.active = false;
|
||||
if (pr.is_missile) {
|
||||
spawn_explosion(particles, pr.pos, 0.9f);
|
||||
@@ -367,6 +378,9 @@ void step_combat_and_world(
|
||||
|
||||
// 3. Pickups collection & respawn
|
||||
for (auto& pk : pickups) {
|
||||
if (!pk.group_unlocked) {
|
||||
continue;
|
||||
}
|
||||
if (!pk.active) {
|
||||
pk.respawn_timer -= dt;
|
||||
if (pk.respawn_timer <= 0.0f) pk.active = true;
|
||||
|
||||
Reference in new issue
Block a user