diff --git a/config/sly1.yaml b/config/sly1.yaml index 262e9bf9..db3fcec1 100644 --- a/config/sly1.yaml +++ b/config/sly1.yaml @@ -78,15 +78,15 @@ segments: - [0x1f560, c, P2/brx] - [0x1fe70, asm, P2/ac] #- [0x, asm, P2/act] - #- [0x, asm, P2/actseg] + - [0x23f28, c, P2/actseg] - [0x243c0, asm, P2/alarm] - [0x24dc0, asm, P2/alo] #- [0x, asm, P2/aseg] #- [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] @@ -200,8 +200,8 @@ segments: #- [0x, asm, P2/shape] - [0xb3988, asm, P2/shd] - [0xb5920, asm, P2/shdanim] - #- [0x, asm, P2/sky] - #- [0x, asm, P2/slotheap] + - [0xb6cd8, c, P2/sky] + - [0xb6d80, asm, P2/slotheap] - [0xb6f50, asm, P2/sm] #- [0x, asm, P2/smartguard] - [0xb8968, asm, P2/so] diff --git a/config/symbol_addrs.txt b/config/symbol_addrs.txt index 3a031e0c..dbde958d 100644 --- a/config/symbol_addrs.txt +++ b/config/symbol_addrs.txt @@ -374,6 +374,37 @@ LoadSwObjectsFromBrx__FP2SWP3ALOP18CBinaryInputStream = 0x11ECB8; // type:func SetLoDefaults__FP2LO = 0x11EDA8; // type:func +//////////////////////////////////////////////////////////////// +// P2/actseg.c +//////////////////////////////////////////////////////////////// +RetractActseg__FP6ACTSEGi = 0x122F28; // type:func +CloneActseg__FP6ACTSEGT0 = 0x122F88; // type:func +GetActsegPositionGoal__FP6ACTSEGfP6VECTORT2 = 0x122FE0; // type:func +GetActsegRotationGoal__FP6ACTSEGfP7MATRIX3P6VECTOR = 0x123120; // type:func +GetActsegTwistGoal__FP6ACTSEGPfT1 = 0x123270; // type:func +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 //////////////////////////////////////////////////////////////// @@ -1172,6 +1203,13 @@ g_unkblot11 = 0x26eed0; // size:0x280 g_totals = 0x26f138; // size:0x280 +//////////////////////////////////////////////////////////////// +// P2/sky.c +//////////////////////////////////////////////////////////////// +PostSkyLoad__FP3SKY = 0x1c9a18; // type:func +UpdateSky__FP3SKYf = 0x1c9a58; // type:func + + //////////////////////////////////////////////////////////////// // P2/sound.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/include/sky.h b/include/sky.h new file mode 100644 index 00000000..83066ce5 --- /dev/null +++ b/include/sky.h @@ -0,0 +1,37 @@ +/** + * @file sky.h + * + * @brief Skyboxes. + */ +#ifndef SKY_H +#define SKY_H + +#include "common.h" + +/** + * @brief Skybox structure. + * + * @todo Fill out the structure. + */ +struct SKY +{ + // ... +}; + +/** + * @brief Initializes the sky with default values. + * Calls super function PostAloLoad(). + * + * @param psky Pointer to the sky. + */ +void PostSkyLoad(SKY *psky); + +/** + * @brief Updates the given sky. + * + * @param psky Pointer to the sky. + * @param dt Delta time. + */ +void UpdateSky(SKY *psky, float dt); + +#endif // SKY_H diff --git a/include/sw.h b/include/sw.h index 0b11804f..03be7d4a 100644 --- a/include/sw.h +++ b/include/sw.h @@ -17,4 +17,6 @@ struct SW extern SW *g_psw; +void IncrementSwHandsOff(SW *psw); + #endif // SW_H diff --git a/src/P2/actseg.c b/src/P2/actseg.c new file mode 100644 index 00000000..87095cee --- /dev/null +++ b/src/P2/actseg.c @@ -0,0 +1,15 @@ +#include "common.h" + +INCLUDE_ASM(const s32, "P2/actseg", RetractActseg__FP6ACTSEGi); + +INCLUDE_ASM(const s32, "P2/actseg", CloneActseg__FP6ACTSEGT0); + +INCLUDE_ASM(const s32, "P2/actseg", GetActsegPositionGoal__FP6ACTSEGfP6VECTORT2); + +INCLUDE_ASM(const s32, "P2/actseg", GetActsegRotationGoal__FP6ACTSEGfP7MATRIX3P6VECTOR); + +INCLUDE_ASM(const s32, "P2/actseg", GetActsegTwistGoal__FP6ACTSEGPfT1); + +INCLUDE_ASM(const s32, "P2/actseg", GetActsegScale__FP6ACTSEGP7MATRIX3); + +INCLUDE_ASM(const s32, "P2/actseg", GGetActsegPoseGoal__FP6ACTSEGi); 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); diff --git a/src/P2/sky.c b/src/P2/sky.c new file mode 100644 index 00000000..f1834ad6 --- /dev/null +++ b/src/P2/sky.c @@ -0,0 +1,5 @@ +#include "sky.h" + +INCLUDE_ASM(const s32, "P2/sky", func_001B5CD8); + +INCLUDE_ASM(const s32, "P2/sky", func_001B5D28); diff --git a/src/P2/xform2.c b/src/P2/xform2.c index c2e51893..bd37f517 100644 --- a/src/P2/xform2.c +++ b/src/P2/xform2.c @@ -1,4 +1,5 @@ #include +#include INCLUDE_ASM(const s32, "P2/xform2", LoadWarpFromBrx__FP4WARPP18CBinaryInputStream);