Skip to content

Commit

Permalink
Split basic.c and bec.c
Browse files Browse the repository at this point in the history
  • Loading branch information
TheOnlyZac authored Nov 27, 2024
1 parent 1edd80e commit b5b3304
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 3 deletions.
4 changes: 2 additions & 2 deletions config/sly1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
19 changes: 19 additions & 0 deletions config/symbol_addrs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
////////////////////////////////////////////////////////////////
Expand Down
27 changes: 27 additions & 0 deletions include/basic.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "common.h"
#include <splice/sidebag.h>
#include <cid.h>

/**
* @brief Basic object.
Expand All @@ -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
15 changes: 14 additions & 1 deletion include/bez.h
Original file line number Diff line number Diff line change
@@ -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 <vec.h>
#include <mat.h>

// ...
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
7 changes: 7 additions & 0 deletions src/P2/basic.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <basic.h>

INCLUDE_ASM(const s32, "P2/basic", FIsBasicDerivedFrom__FP5BASIC3CID);

INCLUDE_ASM(const s32, "P2/basic", EnsureBasicSidebag__FP5BASIC);

INCLUDE_ASM(const s32, "P2/basic", func_00130158);
15 changes: 15 additions & 0 deletions src/P2/bez.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <bez.h>

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);

0 comments on commit b5b3304

Please sign in to comment.