2023-06-19 04:34:58 -04:00
|
|
|
#ifndef LEGOUTIL_H
|
|
|
|
#define LEGOUTIL_H
|
|
|
|
|
2023-09-27 15:16:46 -04:00
|
|
|
#include "extra.h"
|
2023-12-14 11:50:29 -05:00
|
|
|
#include "legoentity.h"
|
2023-10-24 08:37:02 -04:00
|
|
|
#include "mxatomid.h"
|
2023-12-14 11:50:29 -05:00
|
|
|
#include "mxtypes.h"
|
2023-09-27 15:16:46 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
#include <windows.h>
|
|
|
|
|
2023-06-19 04:34:58 -04:00
|
|
|
template <class T>
|
|
|
|
inline T Abs(T p_t)
|
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
return p_t < 0 ? -p_t : p_t;
|
2023-06-19 04:34:58 -04:00
|
|
|
}
|
|
|
|
|
2023-06-30 19:24:46 -04:00
|
|
|
template <class T>
|
|
|
|
inline T Min(T p_t1, T p_t2)
|
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
return p_t1 < p_t2 ? p_t1 : p_t2;
|
2023-06-30 19:24:46 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
inline T Max(T p_t1, T p_t2)
|
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
return p_t1 > p_t2 ? p_t1 : p_t2;
|
2023-06-30 19:24:46 -04:00
|
|
|
}
|
|
|
|
|
2023-10-07 14:07:26 -04:00
|
|
|
template <class T>
|
2023-12-17 12:24:39 -05:00
|
|
|
inline void GetScalar(MxU8** p_source, T& p_dest)
|
2023-10-07 14:07:26 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
p_dest = *(T*) *p_source;
|
|
|
|
*p_source += sizeof(T);
|
2023-10-07 14:07:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class T>
|
2023-10-24 19:38:27 -04:00
|
|
|
inline T GetScalar(T** p_source)
|
2023-10-07 14:07:26 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
T val = **p_source;
|
|
|
|
*p_source += 1;
|
|
|
|
return val;
|
2023-10-07 14:07:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class T>
|
2023-12-17 12:24:39 -05:00
|
|
|
inline void GetDouble(MxU8** p_source, T& p_dest)
|
2023-10-07 14:07:26 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
p_dest = *(double*) *p_source;
|
|
|
|
*p_source += sizeof(double);
|
2023-10-07 14:07:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class T>
|
2023-12-25 15:22:20 -05:00
|
|
|
inline void GetString(MxU8** p_source, char** p_dest, T* p_obj, void (T::*p_setter)(const char*))
|
2023-10-07 14:07:26 -04:00
|
|
|
{
|
2023-12-17 12:24:39 -05:00
|
|
|
(p_obj->*p_setter)((char*) *p_source);
|
2023-12-25 15:22:20 -05:00
|
|
|
*p_source += strlen(*p_dest) + 1;
|
2023-10-07 14:07:26 -04:00
|
|
|
}
|
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
ExtraActionType MatchActionString(const char*);
|
2023-12-14 11:50:29 -05:00
|
|
|
void InvokeAction(ExtraActionType p_actionId, MxAtomId& p_pAtom, int p_targetEntityId, LegoEntity* p_sender);
|
2023-12-13 05:48:14 -05:00
|
|
|
void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bOut, float* p_gOut);
|
2023-12-29 10:22:18 -05:00
|
|
|
MxBool FUN_1003ee00(MxAtomId& p_atomId, MxS32 p_id);
|
2023-12-15 18:11:34 -05:00
|
|
|
void FUN_1003ef00(MxBool);
|
2023-09-29 12:42:15 -04:00
|
|
|
void SetAppCursor(WPARAM p_wparam);
|
2023-12-14 11:50:29 -05:00
|
|
|
MxBool FUN_1003ef60();
|
2023-06-30 19:33:59 -04:00
|
|
|
|
2023-06-29 04:10:08 -04:00
|
|
|
#endif // LEGOUTIL_H
|