mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
- removed some C cruft from compat.h.
This commit is contained in:
parent
0bcb37860a
commit
6a305748ff
3 changed files with 2 additions and 20 deletions
|
@ -833,28 +833,10 @@ static FORCE_INLINE CONSTEXPR uint64_t B_UNBUF64(void const * const buf) { retur
|
|||
|
||||
#define ABSTRACT_DECL static FORCE_INLINE WARN_UNUSED_RESULT CONSTEXPR
|
||||
|
||||
#ifdef __cplusplus
|
||||
template <typename T, typename X, typename Y> ABSTRACT_DECL T clamp(T in, X min, Y max) { return in <= (T) min ? (T) min : (in >= (T) max ? (T) max : in); }
|
||||
template <typename T, typename X, typename Y> ABSTRACT_DECL T clamp2(T in, X min, Y max) { return in >= (T) max ? (T) max : (in <= (T) min ? (T) min : in); }
|
||||
using std::min;
|
||||
using std::max;
|
||||
# define fclamp clamp
|
||||
# define fclamp2 clamp2
|
||||
#else
|
||||
// Clamp <in> to [<min>..<max>]. The case in <= min is handled first.
|
||||
ABSTRACT_DECL int32_t clamp(int32_t in, int32_t min, int32_t max) { return in <= min ? min : (in >= max ? max : in); }
|
||||
ABSTRACT_DECL double fclamp(double in, double min, double max) { return in <= min ? min : (in >= max ? max : in); }
|
||||
// Clamp <in> to [<min>..<max>]. The case in >= max is handled first.
|
||||
ABSTRACT_DECL int32_t clamp2(int32_t in, int32_t min, int32_t max) { return in >= max ? max : (in <= min ? min : in); }
|
||||
ABSTRACT_DECL double fclamp2(double in, double min, double max) { return in >= max ? max : (in <= min ? min : in); }
|
||||
|
||||
#ifndef min
|
||||
# define min(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
#ifndef max
|
||||
# define max(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
////////// Mathematical operations //////////
|
||||
|
||||
|
|
|
@ -1515,7 +1515,7 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr)
|
|||
m->head.nam, m->cframe, m->nframe, m->numframes, m->interpol);
|
||||
#endif
|
||||
|
||||
m->interpol = fclamp(m->interpol, 0.f, 1.f);
|
||||
m->interpol = clamp(m->interpol, 0.f, 1.f);
|
||||
m->cframe = clamp(m->cframe, 0, m->numframes-1);
|
||||
m->nframe = clamp(m->nframe, 0, m->numframes-1);
|
||||
}
|
||||
|
|
|
@ -1074,7 +1074,7 @@ double CalcSmoothRatio(ClockTicks totalclk, ClockTicks ototalclk, int realgameti
|
|||
ratio = (0.5 + (totalclk - ototalclk)) / (120 / realgameticspersec);
|
||||
}
|
||||
|
||||
result = fclamp2(ratio * MaxSmoothRatio, 0., MaxSmoothRatio);
|
||||
result = clamp2(ratio * MaxSmoothRatio, 0., MaxSmoothRatio);
|
||||
|
||||
if (cl_debugintrpl)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue