From 61e5bcef2629e2d68b805a956a96fff264d4f74d Mon Sep 17 00:00:00 2001 From: untodesu Date: Sat, 28 Jun 2025 01:59:49 +0500 Subject: Restructure dependencies and update to C++20 - Nuked static_assert from almost everywhere in the project - Nuked binary dependency support. Might add one later though - Separated dependency headers into a separate include subdirectory - Grafted a thirdpartylegalnotices.txt generator from RITEG - Pushed development snapshot version to 2126 (26th week of 2025) --- game/shared/collision.cc | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'game/shared/collision.cc') diff --git a/game/shared/collision.cc b/game/shared/collision.cc index af880ab..dd51dd5 100644 --- a/game/shared/collision.cc +++ b/game/shared/collision.cc @@ -13,10 +13,11 @@ #include "shared/velocity.hh" #include "shared/voxel_registry.hh" -static int vgrid_collide(const Dimension* dimension, int d, CollisionComponent& collision, TransformComponent& transform, VelocityComponent& velocity, voxel_surface& touch_surface) +static int vgrid_collide(const Dimension* dimension, int d, CollisionComponent& collision, TransformComponent& transform, + VelocityComponent& velocity, voxel_surface& touch_surface) { const auto move = globals::fixed_frametime * velocity.value[d]; - const auto move_sign = cxpr::sign(move); + const auto move_sign = vx::sign(move); const auto& ref_aabb = collision.aabb; const auto current_aabb = ref_aabb.push(transform.local); @@ -26,14 +27,14 @@ static int vgrid_collide(const Dimension* dimension, int d, CollisionComponent& next_aabb.max[d] += move; local_pos lpos_min; - lpos_min.x = cxpr::floor(next_aabb.min.x); - lpos_min.y = cxpr::floor(next_aabb.min.y); - lpos_min.z = cxpr::floor(next_aabb.min.z); + lpos_min.x = vx::floor(next_aabb.min.x); + lpos_min.y = vx::floor(next_aabb.min.y); + lpos_min.z = vx::floor(next_aabb.min.z); local_pos lpos_max; - lpos_max.x = cxpr::ceil(next_aabb.max.x); - lpos_max.y = cxpr::ceil(next_aabb.max.y); - lpos_max.z = cxpr::ceil(next_aabb.max.z); + lpos_max.x = vx::ceil(next_aabb.max.x); + lpos_max.y = vx::ceil(next_aabb.max.y); + lpos_max.z = vx::ceil(next_aabb.max.z); // Other axes const int u = (d + 1) % 3; @@ -108,7 +109,7 @@ static int vgrid_collide(const Dimension* dimension, int d, CollisionComponent& if(latch_touch != voxel_touch::NOTHING) { if(latch_touch == voxel_touch::BOUNCE) { - const auto move_distance = cxpr::abs(current_aabb.min[d] - next_aabb.min[d]); + const auto move_distance = vx::abs(current_aabb.min[d] - next_aabb.min[d]); const auto threshold = 2.0f * globals::fixed_frametime; if(move_distance > threshold) { @@ -150,7 +151,7 @@ void CollisionComponent::fixed_update(Dimension* dimension) auto vertical_move = vgrid_collide(dimension, 1, collision, transform, velocity, surface); if(dimension->entities.any_of(entity)) { - if(vertical_move == cxpr::sign(dimension->get_gravity())) { + if(vertical_move == vx::sign(dimension->get_gravity())) { dimension->entities.emplace_or_replace(entity, GroundedComponent { surface }); } else { dimension->entities.remove(entity); -- cgit