From c79dda69d6e603500a5681430172b5152041af0a Mon Sep 17 00:00:00 2001 From: xolatile Date: Thu, 17 Jul 2025 23:28:55 +0200 Subject: Big changed mentioned in IRC channel... --- src/engine/physics.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/engine/physics.cpp') diff --git a/src/engine/physics.cpp b/src/engine/physics.cpp index 6e78863..e1cd04d 100644 --- a/src/engine/physics.cpp +++ b/src/engine/physics.cpp @@ -13,7 +13,7 @@ static int clipcacheversion = -2; static inline clipplanes &getclipplanes(const cube &c, const ivec &o, int size, bool collide = true, int offset = 0) { clipplanes &p = clipcache[int(&c - worldroot)&(MAXCLIPPLANES-1)]; - if(p.owner != &c || p.version != clipcacheversion+offset) + if(p.owner != &c || p.version != clipcacheversion+offset) { p.owner = &c; p.version = clipcacheversion+offset; @@ -359,8 +359,8 @@ ShadowRayCache *newshadowraycache() { return new ShadowRayCache; } void freeshadowraycache(ShadowRayCache *&cache) { delete cache; cache = NULL; } -void resetshadowraycache(ShadowRayCache *cache) -{ +void resetshadowraycache(ShadowRayCache *cache) +{ cache->version++; if(!cache->version) { @@ -839,7 +839,7 @@ static inline bool clampcollide(const clipplanes &p, const E &entvol, const plan } return false; } - + template static bool fuzzycollideplanes(physent *d, const vec &dir, float cutoff, const cube &c, const ivec &co, int size) // collide with deformed cube geometry { @@ -1213,7 +1213,7 @@ bool trystepdown(physent *d, vec &dir, float step, float xy, float z, bool init stepfloor.normalize(); if(d->physstate >= PHYS_SLOPE && d->floor != stepfloor) { - // prevent alternating step-down/step-up states if player would keep bumping into the same floor + // prevent alternating step-down/step-up states if player would keep bumping into the same floor vec stepped(d->o); d->o.z -= 0.5f; d->zmargin = -0.5f; @@ -1493,14 +1493,14 @@ bool droptofloor(vec &o, float radius, float height) { static struct dropent : physent { - dropent() - { - type = ENT_BOUNCE; + dropent() + { + type = ENT_BOUNCE; vel = vec(0, 0, -1); } } d; d.o = o; - if(!insideworld(d.o)) + if(!insideworld(d.o)) { if(d.o.z < worldsize) return false; d.o.z = worldsize - 1e-3f; @@ -1525,16 +1525,16 @@ float dropheight(entity &e) switch(e.type) { case ET_PARTICLES: - case ET_MAPMODEL: return 0.0f; + case ET_MAPMODEL: + return 0.0f; default: - if(e.type >= ET_GAMESPECIFIC) return entities::dropheight(e); return 4.0f; } } void dropenttofloor(entity *e) { - droptofloor(e->o, 1.0f, dropheight(*e)); + droptofloor(e->o, 1.0f, 4.0f); } void phystest() -- cgit v1.2.3