Files
tp/include/SSystem/SComponent/c_lib.h
T

72 lines
2.0 KiB
C++
Raw Normal View History

2021-04-08 18:43:16 +02:00
#ifndef C_LIB_H_
#define C_LIB_H_
2021-03-28 22:49:05 +02:00
2022-03-26 10:17:17 -07:00
#include "MSL_C/math.h"
2021-04-08 18:43:16 +02:00
#include "SSystem/SComponent/c_xyz.h"
2021-05-03 02:03:24 +02:00
#include "dolphin/mtx/mtx.h"
2021-03-28 22:49:05 +02:00
#include "dolphin/types.h"
2021-11-09 21:09:33 +01:00
inline bool cLib_IsZero(f32 f) {
2021-11-25 23:11:51 +01:00
return fabsf(f) < 8e-11f;
2021-11-09 21:09:33 +01:00
}
2021-03-28 22:49:05 +02:00
2021-04-08 18:43:16 +02:00
void cLib_memCpy(void* dst, const void* src, unsigned long size);
void cLib_memSet(void* ptr, int value, unsigned long size);
float cLib_addCalc(float*, float, float, float, float);
void cLib_addCalc2(float*, float, float, float);
void cLib_addCalc0(float*, float, float);
float cLib_addCalcPos(cXyz*, const cXyz&, float, float, float);
float cLib_addCalcPosXZ(cXyz*, const cXyz&, float, float, float);
void cLib_addCalcPos2(cXyz*, const cXyz&, float, float);
void cLib_addCalcPosXZ2(cXyz*, const cXyz&, float, float);
short cLib_addCalcAngleS(short*, short, short, short, short);
void cLib_addCalcAngleS2(short*, short, short, short);
int cLib_chaseUC(unsigned char*, unsigned char, unsigned char);
int cLib_chaseS(short*, short, short);
int cLib_chaseF(float*, float, float);
int cLib_chasePos(cXyz*, const cXyz&, float);
int cLib_chasePosXZ(cXyz*, const cXyz&, float);
int cLib_chaseAngleS(short*, short, short);
s16 cLib_targetAngleY(const Vec* lhs, const Vec* rhs);
s16 cLib_targetAngleY(const Vec& lhs, const Vec& rhs);
short cLib_targetAngleX(const cXyz*, const cXyz*);
void cLib_offsetPos(cXyz*, const cXyz*, short, const cXyz*);
s32 cLib_distanceAngleS(s16 x, s16 y);
inline void cLib_offBit(u8& pVar, u8 pBit) {
pVar &= ~pBit;
}
inline void cLib_onBit(u8& pVar, u8 pBit) {
pVar |= pBit;
}
inline u8 cLib_checkBit(u8& pVar, u8 pBit) {
return pVar & pBit;
}
2021-12-04 05:57:01 -08:00
template <typename T>
2022-01-25 12:24:14 -08:00
inline T cLib_minMaxLimit(T val, T min, T max) {
T ret;
if (val < min) {
ret = min;
} else {
ret = max;
if (val <= max) {
ret = val;
}
2021-11-10 23:54:31 -08:00
}
2022-01-25 12:24:14 -08:00
return ret;
2021-11-10 23:54:31 -08:00
}
2021-04-08 18:43:16 +02:00
void MtxInit(void);
void MtxTrans(float, float, float, unsigned char);
void MtxScale(float, float, float, unsigned char);
void MtxPosition(cXyz*, cXyz*);
void MtxPush(void);
Mtx* MtxPull(void);
#endif