Implement m_lib and some header file defintions

This commit is contained in:
Cuyler36
2023-04-23 18:46:44 -04:00
parent 98d13299ca
commit c75418ec1b
10 changed files with 1058 additions and 370 deletions
+48 -35
View File
@@ -2,11 +2,19 @@
#define M_LIB_H
#include "types.h"
#include "m_play.h"
#include "m_actor.h"
#ifdef __cplusplus
extern "C" {
#endif
#define SHT_MAX 32767.0f
#define SHT_MINV (1.0f / SHT_MAX)
#define ABS(x) ((x) >= 0) ? (x) : -(x)
#define SQ(x) ((x)*(x))
typedef struct xy_s {
typedef struct xy_s {
f32 x, y;
} xy_t;
@@ -22,49 +30,54 @@ typedef struct rgba_t { //can be put in other place
u8 r, g, b, a;
} rgba_t;
extern void mem_copy(u8*, u8*, u32);
extern void mem_clear(u8*, u32, u8);
extern s32 mem_cmp(u8*, u8*, u32);
extern void mem_copy(u8* dst, u8* src, size_t size);
extern void mem_clear(u8* dst, size_t size, u8 val);
extern int mem_cmp(u8* p1, u8* p2, size_t size);
extern f32 sin_s(s16);
extern f32 cos_s(s16);
extern f32 cos_s(s16 angle);
extern f32 sin_s(s16 angle);
extern s32 chase_angle(s16*, s16, s16);
extern s32 chase_s(s16*, s16, s16);
extern s32 chase_f(f32*, f32, f32);
extern f32 chase_xyz_t(xyz_t*, xyz_t*, f32);
extern s32 chase_angle2(s16*, s16, s16);
extern int chase_angle(s16* const pValue, const s16 target, s16 step);
extern int chase_s(s16* const pValue, const s16 target, s16 step);
extern int chase_f(f32* const pValue, const f32 target, f32 step);
extern f32 chase_xyz_t(xyz_t* const pValue, const xyz_t* const target, const f32 fraction);
extern int chase_angle2(s16* const pValue, const s16 limit, const s16 step);
extern void inter_float(f32*, f32, s32);
extern s16 get_random_timer(s16, s16);
extern void inter_float(f32* const pValue, const f32 arg1, const int step);
extern s16 get_random_timer(const s16 base, const s16 range);
extern void xyz_t_move(xyz_t*, xyz_t*);
extern void xyz_t_move_s_xyz(xyz_t*, s_xyz*);
extern void xyz_t_add(xyz_t*, xyz_t*, xyz_t*);
extern void xyz_t_sub(xyz_t*, xyz_t*, xyz_t*);
extern void xyz_t_mult_v(xyz_t*, f32);
extern void xyz_t_move(xyz_t* const dest, const xyz_t* const src);
extern void xyz_t_move_s_xyz(xyz_t* const dest, const s_xyz* const src);
extern void xyz_t_add(const xyz_t* const augend, const xyz_t* const addend, xyz_t* const total);
extern void xyz_t_sub(const xyz_t* const minuend, const xyz_t* const subtrahend, xyz_t* const diff);
extern void xyz_t_mult_v(xyz_t* const multiplicand, const f32 multiplier);
extern f32 search_position_distance(xyz_t*, xyz_t*);
extern f32 search_position_distanceXZ(xyz_t*, xyz_t*);
extern s16 search_position_angleY(xyz_t*, xyz_t*);
extern s16 search_position_angleX(xyz_t*, xyz_t*);
extern f32 search_position_distance(const xyz_t* const pos, const xyz_t* const target);
extern f32 search_position_distanceXZ(const xyz_t* const pos, const xyz_t* const target);
extern s16 search_position_angleY(const xyz_t* const pos, const xyz_t* const target);
extern s16 search_position_angleX(const xyz_t* const pos, const xyz_t* const target);
extern void add_calc2(f32*, f32, f32, f32);
extern void add_calc0(f32*, f32, f32);
extern f32 add_calc(f32* pValue, f32 target, f32 fraction, f32 maxStep, f32 minStep);
extern void add_calc2(f32* pValue, f32 target, f32 fraction, f32 maxStep);
extern void add_calc0(f32* pValue, f32 fraction, f32 maxStep);
extern s16 add_calc_short_angle2(s16*, s16, f32, s16, s16);
extern s16 add_calc_short_angle3(s16*, s16, f32, s16, s16);
extern s16 add_calc_short_angle2(s16* pValue, s16 target, f32 fraction, s16 maxStep, s16 minStep);
extern s16 add_calc_short_angle3(s16* pValue, s16 target, f32 fraction, s16 maxStep, s16 minStep);
extern void rgba_t_move(rgba_t*, rgba_t*);
extern void rgba_t_move(rgba_t* dest, const rgba_t* const src);
extern u32 none_proc1(void);
extern void none_proc2(void);
extern int none_proc1();
extern void none_proc2(ACTOR* actor, GAME* game);
extern void _Game_play_isPause(u32); //IDK
extern int _Game_play_isPause(GAME_PLAY* play);
extern f32 check_percent_abs(f32 x, f32 min, f32 max, f32 scale, s32 shift_by_min);
extern f32 get_percent_forAccelBrake(f32 now, f32 start, f32 end, f32 accelerate, f32 brake);
extern void Game_play_Projection_Trans(GAME_PLAY* play, xyz_t* wpos, xyz_t* screen_pos);
extern f32 get_percent(int max, int min, int x);
#ifdef __cplusplus
}
#endif
//Unsure
//?? check_percent_abs();
//?? get_percent_forAccelBrake();
//void Game_play_Projection_Trans(game_play*, Vec3f*, Vec3f);
extern f32 get_percent(s32, s32, s32);
#endif