mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 01:11:44 +00:00
Use clamp in mact LIMITCONTROL macro
git-svn-id: https://svn.eduke32.com/eduke32@7216 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
81d0632099
commit
0a84672121
1 changed files with 5 additions and 14 deletions
|
@ -36,6 +36,10 @@ Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
|
|||
|
||||
#ifndef control_private_h_
|
||||
#define control_private_h_
|
||||
|
||||
#include "compat.h"
|
||||
#include "keyboard.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -85,21 +89,8 @@ extern "C" {
|
|||
|
||||
#define BUTTONSET(x, value) (CONTROL_ButtonState |= ((uint64_t)value << ((uint64_t)(x))))
|
||||
#define BUTTONCLEAR(x) (CONTROL_ButtonState &= ~((uint64_t)1 << ((uint64_t)(x))))
|
||||
|
||||
#define BUTTONHELDSET(x, value) (CONTROL_ButtonHeldState |= (uint64_t)(value << ((uint64_t)(x))))
|
||||
|
||||
#define LIMITCONTROL(x) \
|
||||
{ \
|
||||
if ((*x) > MAXCONTROLVALUE) \
|
||||
{ \
|
||||
(*x) = MAXCONTROLVALUE; \
|
||||
} \
|
||||
if ((*x) < -MAXCONTROLVALUE) \
|
||||
{ \
|
||||
(*x) = -MAXCONTROLVALUE; \
|
||||
} \
|
||||
}
|
||||
#define SGN(x) (((x) > 0) ? 1 : ((x) < 0) ? -1 : 0)
|
||||
#define LIMITCONTROL(x) (*x = clamp(*x, -MAXCONTROLVALUE, MAXCONTROLVALUE))
|
||||
|
||||
//****************************************************************************
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue