From b5b3304ac604c420460fd3531f8bb7f04bf2cd1b Mon Sep 17 00:00:00 2001 From: Zac Date: Wed, 27 Nov 2024 06:10:58 +0000 Subject: [PATCH] Split basic.c and bec.c --- config/sly1.yaml | 4 ++-- config/symbol_addrs.txt | 19 +++++++++++++++++++ include/basic.h | 27 +++++++++++++++++++++++++++ include/bez.h | 15 ++++++++++++++- src/P2/basic.c | 7 +++++++ src/P2/bez.c | 15 +++++++++++++++ 6 files changed, 84 insertions(+), 3 deletions(-) create mode 100644 src/P2/basic.c create mode 100644 src/P2/bez.c diff --git a/config/sly1.yaml b/config/sly1.yaml index 86c28002..db3fcec1 100644 --- a/config/sly1.yaml +++ b/config/sly1.yaml @@ -85,8 +85,8 @@ segments: #- [0x, asm, P2/asega] #- [0x, asm, P2/barrier] - [0x30cf0, asm, P2/bas] - - [0x310e8, asm, P2/basic] - - [0x31168, asm, P2/bez] + - [0x310e8, c, P2/basic] + - [0x31168, c, P2/bez] - [0x31f48, c, P2/binoc] - [0x38290, c, P2/bis] - [0x395a0, asm, P2/bbmark] diff --git a/config/symbol_addrs.txt b/config/symbol_addrs.txt index 7865f0af..dbde958d 100644 --- a/config/symbol_addrs.txt +++ b/config/symbol_addrs.txt @@ -386,6 +386,25 @@ GetActsegScale__FP6ACTSEGP7MATRIX3 = 0x1232E8; // type:func GGetActsegPoseGoal__FP6ACTSEGi = 0x123358; // type:func +//////////////////////////////////////////////////////////////// +// P2/basic.c +//////////////////////////////////////////////////////////////// +FIsBasicDerivedFrom__FP5BASIC3CID = 0x1300e8; // type:func +EnsureBasicSidebag__FP5BASIC = 0x130110; // type:func + + +//////////////////////////////////////////////////////////////// +// P2/bez.c +//////////////////////////////////////////////////////////////// +EvaluateBezierWeightedFloat__FfffffffffPfN29 = 0x130168; // type:func +EvaluateBezierFloat__FfffffffPfN27 = 0x1303F0; // type:func +EvaluateBezierPos__FfffP6VECTORN63 = 0x130540; // type:func +EvaluateBezierMat__FfffP7MATRIX3P6VECTORT3T4T3T4T4 = 0x130748; // type:func +TesselateBezier__FfffP6VECTORN33iT3 = 0x130B48; // type:func +SBezierPosLength__FffP6VECTORN32 = 0x130C20; // type:func +LimitBezierMulti__Fie = 0x130C58; // type:func + + //////////////////////////////////////////////////////////////// // P2/binoc.c //////////////////////////////////////////////////////////////// diff --git a/include/basic.h b/include/basic.h index 58183213..7b1b6d30 100644 --- a/include/basic.h +++ b/include/basic.h @@ -8,6 +8,7 @@ #include "common.h" #include +#include /** * @brief Basic object. @@ -22,4 +23,30 @@ struct BASIC CSidebag *psidebag; }; +/** + * @brief Check if the basic object is derived from the given class ID. + * + * @param pbasic The object. + * @param cid The class ID to check. + * + * @retval 1 if the object is derived from the class. + * @retval 0 if the object is not derived from the class. + */ +int FIsBasicDerivedFrom(BASIC *pbasic, CID cid); + +/** + * @brief Check if the basic has a sidebag, and if not, create one. + * + * @param pbasic The object. + */ +void EnsureBasicSidebag(BASIC *pbasic); + +/** + * @brief Get the basic object's CID. + * + * @param pbasic The object. + * @param pcid Return CID. + */ +void GetBasicCid(BASIC *pbasic, CID *pcid); + #endif // BASIC_H diff --git a/include/bez.h b/include/bez.h index 8bb6fe7e..8dfb9c79 100644 --- a/include/bez.h +++ b/include/bez.h @@ -1,11 +1,24 @@ /** * @file bez.h + * + * @brief Bezier curves. + * + * @todo Add function parameters and documentation. */ #ifndef BEZ_H #define BEZ_H #include "common.h" +#include +#include -// ... +void EvaluateBezierWeightedFloat(float, float, float, float, float, float, float, float, float, float *, float *, float *); +void EvaluateBezierFloat(float, float, float, float, float, float, float, float *, float *, float *); +void EvaluateBezierPos(float, float, float, VECTOR *, VECTOR *, VECTOR *, VECTOR *, VECTOR *, VECTOR *, VECTOR *); +void EvaluateBezierMat(float, float, float, MATRIX3 *, VECTOR *, MATRIX3 *, VECTOR *, MATRIX3 *, VECTOR *, VECTOR *); +void TesselateBezier(float, float, float, VECTOR *, VECTOR *, VECTOR *, VECTOR *, int, VECTOR *); +float SBezierPosLength(float, float, VECTOR *, VECTOR *, VECTOR *, VECTOR *); + +void LimitBezierMulti(int c, ...); #endif // BEZ_H diff --git a/src/P2/basic.c b/src/P2/basic.c new file mode 100644 index 00000000..0b21af82 --- /dev/null +++ b/src/P2/basic.c @@ -0,0 +1,7 @@ +#include + +INCLUDE_ASM(const s32, "P2/basic", FIsBasicDerivedFrom__FP5BASIC3CID); + +INCLUDE_ASM(const s32, "P2/basic", EnsureBasicSidebag__FP5BASIC); + +INCLUDE_ASM(const s32, "P2/basic", func_00130158); diff --git a/src/P2/bez.c b/src/P2/bez.c new file mode 100644 index 00000000..4ca5b91c --- /dev/null +++ b/src/P2/bez.c @@ -0,0 +1,15 @@ +#include + +INCLUDE_ASM(const s32, "P2/bez", EvaluateBezierWeightedFloat__FfffffffffPfN29); + +INCLUDE_ASM(const s32, "P2/bez", EvaluateBezierFloat__FfffffffPfN27); + +INCLUDE_ASM(const s32, "P2/bez", EvaluateBezierPos__FfffP6VECTORN63); + +INCLUDE_ASM(const s32, "P2/bez", EvaluateBezierMat__FfffP7MATRIX3P6VECTORT3T4T3T4T4); + +INCLUDE_ASM(const s32, "P2/bez", TesselateBezier__FfffP6VECTORN33iT3); + +INCLUDE_ASM(const s32, "P2/bez", SBezierPosLength__FffP6VECTORN32); + +INCLUDE_ASM(const s32, "P2/bez", LimitBezierMulti__Fie);