mirror of
https://github.com/GTAmodding/re3.git
synced 2025-07-14 03:34:08 +00:00
shadows done
This commit is contained in:
parent
ad1920bc6f
commit
b4ecb3e3da
20 changed files with 2412 additions and 60 deletions
|
@ -178,3 +178,120 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
|
|||
|
||||
#define max(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#define min(a, b) (((a) < (b)) ? (a) : (b))
|
||||
|
||||
|
||||
#define STRINGIFY(x) #x
|
||||
#define STR(x) STRINGIFY(x)
|
||||
#define CONCAT_(x,y) x##y
|
||||
#define CONCAT(x,y) CONCAT_(x,y)
|
||||
|
||||
// Tweaking stuff for debugmenu
|
||||
#define TWEAKPATH ___tw___TWEAKPATH
|
||||
#define SETTWEAKPATH(path) static const char *___tw___TWEAKPATH = path;
|
||||
#define TWEAKFUNC(v) static CTweakFunc CONCAT(___tw___tweak, __COUNTER__)(&v, STR(v), TWEAKPATH);
|
||||
#define TWEAKFUNCN(v, name) static CTweakFunc CONCAT(___tw___tweak, __COUNTER__)(&v, name, TWEAKPATH);
|
||||
#define TWEAKBOOL(v) static CTweakBool CONCAT(___tw___tweak, __COUNTER__)(&v, STR(v), TWEAKPATH);
|
||||
#define TWEAKBOOLN(v, name) static CTweakBool CONCAT(___tw___tweak, __COUNTER__)(&v, name, TWEAKPATH);
|
||||
#define TWEAKINT32(v, lower, upper, step) static CTweakInt32 CONCAT(___tw___tweak, __COUNTER__)(&v, STR(v), lower, upper, step, TWEAKPATH);
|
||||
#define TWEAKINT32N(v, lower, upper, step, name) static CTweakInt32 CONCAT(___tw___tweak, __COUNTER__)(&v, name, lower, upper, step, TWEAKPATH);
|
||||
#define TWEAKUINT32(v, lower, upper, step) static CTweakUInt32 CONCAT(___tw___tweak, __COUNTER__)(&v, STR(v), lower, upper, step, TWEAKPATH);
|
||||
#define TWEAKUINT32N(v, lower, upper, step, name) static CTweakUInt32 CONCAT(___tw___tweak, __COUNTER__)(&v, name, lower, upper, step, TWEAKPATH);
|
||||
#define TWEAKINT16(v, lower, upper, step) static CTweakInt16 CONCAT(___tw___tweak, __COUNTER__)(&v, STR(v), lower, upper, step, TWEAKPATH);
|
||||
#define TWEAKINT16N(v, lower, upper, step, name) static CTweakInt16 CONCAT(___tw___tweak, __COUNTER__)(&v, name, lower, upper, step, TWEAKPATH);
|
||||
#define TWEAKUINT16(v, lower, upper, step) static CTweakUInt16 CONCAT(___tw___tweak, __COUNTER__)(&v, STR(v), lower, upper, step, TWEAKPATH);
|
||||
#define TWEAKUINT16N(v, lower, upper, step, name) static CTweakUInt16 CONCAT(___tw___tweak, __COUNTER__)(&v, name, lower, upper, step, TWEAKPATH);
|
||||
#define TWEAKINT8(v, lower, upper, step) static CTweakInt8 CONCAT(___tw___tweak, __COUNTER__)(&v, STR(v), lower, upper, step, TWEAKPATH);
|
||||
#define TWEAKINT8N(v, lower, upper, step, name) static CTweakInt8 CONCAT(___tw___tweak, __COUNTER__)(&v, name, lower, upper, step, TWEAKPATH);
|
||||
#define TWEAKUINT8(v, lower, upper, step) static CTweakUInt8 CONCAT(___tw___tweak, __COUNTER__)(&v, STR(v), lower, upper, step, TWEAKPATH);
|
||||
#define TWEAKUINT8N(v, lower, upper, step, name) static CTweakUInt8 CONCAT(___tw___tweak, __COUNTER__)(&v, name, lower, upper, step, TWEAKPATH);
|
||||
#define TWEAKFLOAT(v, lower, upper, step) static CTweakFloat CONCAT(___tw___tweak, __COUNTER__)(&v, STR(v), lower, upper, step, TWEAKPATH);
|
||||
#define TWEAKFLOATN(v, lower, upper, step, name) static CTweakFloat CONCAT(___tw___tweak, __COUNTER__)(&v, name, lower, upper, step, TWEAKPATH);
|
||||
#define TWEAKSWITCH(v, lower, upper, str, f) static CTweakSwitch CONCAT(___tw___tweak, __COUNTER__)(&v, STR(v), lower, upper, str, f, TWEAKPATH);
|
||||
#define TWEAKSWITCHN(v, lower, upper, str, f, name) static CTweakSwitch CONCAT(___tw___tweak, __COUNTER__)(&v, name, lower, upper, str, f, TWEAKPATH);
|
||||
|
||||
// interface
|
||||
class CTweakVar
|
||||
{
|
||||
public:
|
||||
virtual void AddDBG(const char *path) = 0;
|
||||
};
|
||||
|
||||
class CTweakVars
|
||||
{
|
||||
public:
|
||||
static void Add(CTweakVar *var);
|
||||
static void AddDBG(const char *path);
|
||||
};
|
||||
|
||||
class CTweakFunc : public CTweakVar
|
||||
{
|
||||
const char *m_pPath, *m_pVarName;
|
||||
void (*m_pFunc)();
|
||||
public:
|
||||
CTweakFunc(void (*pFunc)(), const char *strName, const char *strPath) :
|
||||
m_pFunc(pFunc), m_pVarName(strName), m_pPath(strPath)
|
||||
{
|
||||
CTweakVars::Add(this);
|
||||
}
|
||||
|
||||
void AddDBG(const char *path);
|
||||
};
|
||||
|
||||
class CTweakBool : public CTweakVar
|
||||
{
|
||||
const char *m_pPath, *m_pVarName;
|
||||
bool *m_pBoolVar;
|
||||
public:
|
||||
CTweakBool(bool *pBool, const char *strName, const char *strPath) :
|
||||
m_pBoolVar(pBool), m_pVarName(strName), m_pPath(strPath)
|
||||
{
|
||||
CTweakVars::Add(this);
|
||||
}
|
||||
|
||||
void AddDBG(const char *path);
|
||||
};
|
||||
|
||||
class CTweakSwitch : public CTweakVar
|
||||
{
|
||||
const char *m_pPath, *m_pVarName;
|
||||
void *m_pIntVar;
|
||||
int32 m_nMin, m_nMax;
|
||||
const char **m_aStr;
|
||||
void (*m_pFunc)();
|
||||
public:
|
||||
CTweakSwitch(void *pInt, const char *strName, int32 nMin, int32 nMax, const char **aStr, void (*pFunc)(), const char *strPath) :
|
||||
m_pVarName(strName), m_pPath(strPath),
|
||||
m_aStr(aStr), m_pIntVar(pInt), m_nMin(nMin), m_nMax(nMax)
|
||||
{
|
||||
CTweakVars::Add(this);
|
||||
}
|
||||
|
||||
void AddDBG(const char *path);
|
||||
};
|
||||
|
||||
#define _TWEEKCLASS(name, type) \
|
||||
class name : public CTweakVar \
|
||||
{ \
|
||||
public: \
|
||||
const char *m_pPath, *m_pVarName; \
|
||||
type *m_pIntVar, m_nLoawerBound, m_nUpperBound, m_nStep; \
|
||||
\
|
||||
name(type *pInt, const char *strName, type nLower, type nUpper, type nStep, const char *strPath) : \
|
||||
m_pIntVar(pInt), m_nLoawerBound(nLower), m_nUpperBound(nUpper), m_nStep(nStep), \
|
||||
m_pVarName(strName), m_pPath(strPath) \
|
||||
{ \
|
||||
CTweakVars::Add(this); \
|
||||
} \
|
||||
\
|
||||
void AddDBG(const char *path); \
|
||||
};
|
||||
|
||||
_TWEEKCLASS(CTweakInt8, int8);
|
||||
_TWEEKCLASS(CTweakUInt8, uint8);
|
||||
_TWEEKCLASS(CTweakInt16, int16);
|
||||
_TWEEKCLASS(CTweakUInt16, uint16);
|
||||
_TWEEKCLASS(CTweakInt32, int32);
|
||||
_TWEEKCLASS(CTweakUInt32, uint32);
|
||||
_TWEEKCLASS(CTweakFloat, float);
|
||||
|
||||
#undef _TWEEKCLASS
|
Loading…
Add table
Add a link
Reference in a new issue