dreamstalker / rehlds

Reverse-engineered HLDS
GNU General Public License v3.0
625 stars 165 forks source link

Minor refactor ( add BoundsIntersect function ) #986

Closed justgo97 closed 9 months ago

justgo97 commented 9 months ago

Inspired by https://github.com/DrBeef/Lambda1VR/blob/master/Projects/Android/jni/src/Xash3D/xash3d/engine/server/sv_world.c

s1lentq commented 9 months ago

https://github.com/dreamstalker/rehlds/blob/5ec8c29185a960ae31b090de735f8399a16b3042/rehlds/engine/sv_user.cpp#L586-L599

You could use it here too like this

    fmin = check->v.absmin;
    fmax = check->v.absmax;

    if (check->v.flags & FL_CLIENT)
    {
        // trying to get interpolated values
        SV_GetTrueMinMax(e - 1, &fmin, &fmax);
    }

    if (!BoundsIntersect(pmove_mins, pmove_maxs, fmin, fmax))
        continue;
justgo97 commented 9 months ago

https://github.com/dreamstalker/rehlds/blob/5ec8c29185a960ae31b090de735f8399a16b3042/rehlds/engine/sv_user.cpp#L586-L599

You could use it here too like this

  fmin = check->v.absmin;
  fmax = check->v.absmax;

  if (check->v.flags & FL_CLIENT)
  {
      // trying to get interpolated values
      SV_GetTrueMinMax(e - 1, &fmin, &fmax);
  }

  if (!BoundsIntersect(pmove_mins, pmove_maxs, fmin, fmax))
      continue;

Done, Nice catch