isle-portable/LEGO1/legoutil.h
Christian Semmler bc5ca621a4
(Proposal) Introduction of naming convention checker (ncc) (#322)
* Add ncc tool

* Add symlink

* Fixes

* Try this

* Try this

* Try this

* Try this

* Add include path

* Update style

* Update style

* Add more rules

* Fix style

* Update styles

* Fix name parameter

* Fix MxParam p

* Fix m_unk0x pattern

* Allow 4 digits for relative hex

* Add missing offset

* Fix some parameters

* Fix some vtables

* Fix more vtables

* Update rules, fixes

* More fixes

* More fixes

* More fixes

* More fixes

* More fixes

* More fixes

* More fixes

* Fix last issue

* Update readme

* Update readme

* Update CONTRIBUTING.md

* Fix annotations

* Rename

* Update CONTRIBUTING.md

* Update README.md
2023-12-13 11:48:14 +01:00

61 lines
1.1 KiB
C++

#ifndef LEGOUTIL_H
#define LEGOUTIL_H
#include "extra.h"
#include "mxatomid.h"
#include <windows.h>
template <class T>
inline T Abs(T p_t)
{
return p_t < 0 ? -p_t : p_t;
}
template <class T>
inline T Min(T p_t1, T p_t2)
{
return p_t1 < p_t2 ? p_t1 : p_t2;
}
template <class T>
inline T Max(T p_t1, T p_t2)
{
return p_t1 > p_t2 ? p_t1 : p_t2;
}
template <class T>
inline void GetScalar(char** p_source, T& p_dest)
{
p_dest = *(T*) *p_source;
*p_source += sizeof(T);
}
template <class T>
inline T GetScalar(T** p_source)
{
T val = **p_source;
*p_source += 1;
return val;
}
template <class T>
inline void GetDouble(char** p_source, T& p_dest)
{
p_dest = *(double*) *p_source;
*p_source += sizeof(double);
}
template <class T>
inline void GetString(char** p_source, const char* p_dest, T* p_obj, void (T::*p_setter)(const char*))
{
(p_obj->*p_setter)(*p_source);
*p_source += strlen(p_dest) + 1;
}
ExtraActionType MatchActionString(const char*);
void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bOut, float* p_gOut);
void FUN_1003ee00(MxAtomId& p_atomId, MxS32 p_id);
void SetAppCursor(WPARAM p_wparam);
#endif // LEGOUTIL_H