Make bettercam/puppycam respect NO_CAM_COLLISION

This commit is contained in:
MysterD 2020-09-25 21:40:59 -07:00
parent 47fca44582
commit 7af6e308a4
2 changed files with 9 additions and 3 deletions

View File

@ -851,7 +851,11 @@ void find_surface_on_ray_list(struct SurfaceNode *list, Vec3f orig, Vec3f dir, f
// Reject surface if out of vertical bounds
if (list->surface->lowerY > top || list->surface->upperY < bottom)
continue;
// Reject no-cam collision surfaces
if (gCheckingSurfaceCollisionsForCamera && (list->surface->flags & SURFACE_FLAG_NO_CAM_COLLISION))
continue;
// Check intersection between the ray and this surface
if ((hit = ray_surface_intersect(orig, dir, dir_length, list->surface, chk_hit_pos, &length)) != 0)
{
@ -921,7 +925,7 @@ void find_surface_on_ray(Vec3f orig, Vec3f dir, struct Surface **hit_surface, Ve
}
// increase collision checking precision (normally 1)
f32 precision = 5;
f32 precision = 3;
// Get cells we cross using DDA
if (absx(dir[0]) >= absx(dir[2]))

View File

@ -10,6 +10,7 @@
#include "engine/surface_collision.h"
#include "pc/configfile.h"
#include "pc/controller/controller_mouse.h"
#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
//quick and dirty fix for some older MinGW.org mingwrt
#else
@ -18,7 +19,7 @@
#define NEW_CAM_BOUNDING_BOX_RAYS 4
#define NEW_CAM_BOUNDING_BOX_HRADIUS 250
#define NEW_CAM_BOUNDING_BOX_VRADIUS 50
#define NEW_CAM_BOUNDING_BOX_VRADIUS 100
/**
Quick explanation of the camera modes
@ -527,6 +528,7 @@ static void newcam_collision(void) {
camdir[2] = newcam_pos[2]-newcam_lookat[2];
find_surface_on_ray(newcam_pos_target, camdir, &surf, hitpos);
newcam_coldist = sqrtf((newcam_pos_target[0] - hitpos[0]) * (newcam_pos_target[0] - hitpos[0]) + (newcam_pos_target[1] - hitpos[1]) * (newcam_pos_target[1] - hitpos[1]) + (newcam_pos_target[2] - hitpos[2]) * (newcam_pos_target[2] - hitpos[2]));
if (surf) {