mirror of
https://github.com/izzy2lost/2ship2harkinian-Android.git
synced 2026-06-19 01:20:08 -07:00
z_fcurve_data OK, match last function in z_fcurve_data_skelanime, document SkelCurve system (#776)
* Match SkelCurve_Update Co-authored-by: Kelebek1 <34639600+Kelebek1@users.noreply.github.com> * Match and document z_fcurve_data * Begin documenting SkelCurve * More documentation * Deformat header * Pluralise knotCount * Sort out jointTable * Rename frameCount * Format * More documentation * Cleanup on DemoEffect * Remove space on typedef * Format, couple of fixes in the header * Review * Oops * Fix EnBox, DemoTreLgt, use macros in EnTorch Co-authored-by: Kelebek1 <34639600+Kelebek1@users.noreply.github.com>
This commit is contained in:
co-authored by
Kelebek1
parent
5ae4ef87cd
commit
af0123de1e
@@ -1454,14 +1454,6 @@ s16 ActorCutscene_GetCurrentCamera(s16 index);
|
||||
s16 func_800F21CC(void);
|
||||
s32 func_800F22C4(s16 param_1, Actor* actor);
|
||||
void ActorCutscene_SetReturnCamera(s16 index);
|
||||
// void func_800F23E0(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
|
||||
f32 func_800F2478(f32 target, TransformData* transData, s32 refIdx);
|
||||
void SkelCurve_Clear(SkelAnimeCurve* skelCurve);
|
||||
s32 SkelCurve_Init(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve, SkelCurveLimbList* limbListSeg, TransformUpdateIndex* transUpdIdx);
|
||||
void SkelCurve_Destroy(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve);
|
||||
void SkelCurve_SetAnim(SkelAnimeCurve* skelCurve, TransformUpdateIndex* transUpdIdx, f32 arg2, f32 animFinalFrame, f32 animCurFrame, f32 animSpeed);
|
||||
s32 SkelCurve_Update(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve);
|
||||
void SkelCurve_Draw(Actor* actor, GlobalContext* globalCtx, SkelAnimeCurve* skelCurve, OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, Actor* thisx);
|
||||
void FireObj_SetPosition(FireObj* fire, Vec3f* pos);
|
||||
void FireObj_Draw(GlobalContext* globalCtx, FireObj* fire);
|
||||
void FireObj_Init(GlobalContext* globalCtx, FireObj* fire, FireObjInitParams* init, Actor* actor);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef _OS_INTERNAL_H_
|
||||
#define _OS_INTERNAL_H_
|
||||
|
||||
typedef struct {
|
||||
typedef struct {
|
||||
/* 0x00 */ OSMesgQueue* queue;
|
||||
/* 0x04 */ OSMesg msg;
|
||||
} __osHwInt; // size = 0x08
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "z64audio.h"
|
||||
#include "z64bgcheck.h"
|
||||
#include "z64collision_check.h"
|
||||
#include "z64curve.h"
|
||||
#include "z64cutscene.h"
|
||||
#include "z64dma.h"
|
||||
#include "z64effect.h"
|
||||
|
||||
@@ -224,56 +224,6 @@ typedef void (*AnimationEntryCallback)(struct GlobalContext*, AnimationEntryData
|
||||
|
||||
extern u32 link_animetion_segment;
|
||||
|
||||
// fcurve_skelanime structs
|
||||
typedef struct {
|
||||
/* 0x0000 */ u16 unk00; // appears to be flags
|
||||
/* 0x0002 */ s16 unk02;
|
||||
/* 0x0004 */ s16 unk04;
|
||||
/* 0x0006 */ s16 unk06;
|
||||
/* 0x0008 */ f32 unk08;
|
||||
} TransformData; // size = 0xC
|
||||
|
||||
typedef struct {
|
||||
/* 0x0000 */ u8* refIndex;
|
||||
/* 0x0004 */ TransformData* transformData;
|
||||
/* 0x0008 */ s16* copyValues;
|
||||
/* 0x000C */ s16 unk0C;
|
||||
/* 0x000E */ s16 unk10;
|
||||
} TransformUpdateIndex; // size 0x10
|
||||
|
||||
typedef struct {
|
||||
/* 0x0000 */ u8 firstChildIdx;
|
||||
/* 0x0001 */ u8 nextLimbIdx;
|
||||
/* 0x0004 */ Gfx* dList[2];
|
||||
} SkelCurveLimb; // size >= 0x8
|
||||
|
||||
typedef struct {
|
||||
/* 0x0000 */ SkelCurveLimb** limbs;
|
||||
/* 0x0004 */ u8 limbCount;
|
||||
} SkelCurveLimbList; // size = 0x8
|
||||
|
||||
typedef struct {
|
||||
/* 0x0000 */ Vec3s scale;
|
||||
/* 0x0006 */ Vec3s rot;
|
||||
/* 0x000C */ Vec3s pos;
|
||||
} LimbTransform; // size = 0x12
|
||||
|
||||
typedef struct {
|
||||
/* 0x0000 */ u8 limbCount;
|
||||
/* 0x0004 */ SkelCurveLimb** limbList;
|
||||
/* 0x0008 */ TransformUpdateIndex* transUpdIdx;
|
||||
/* 0x000C */ f32 unk0C; // seems to be unused
|
||||
/* 0x0010 */ f32 animFinalFrame;
|
||||
/* 0x0014 */ f32 animSpeed;
|
||||
/* 0x0018 */ f32 animCurFrame;
|
||||
/* 0x001C */ LimbTransform* transforms;
|
||||
} SkelAnimeCurve; // size = 0x20
|
||||
|
||||
typedef s32 (*OverrideCurveLimbDraw)(struct GlobalContext* globalCtx, SkelAnimeCurve* skelCuve, s32 limbIndex,
|
||||
struct Actor* actor);
|
||||
typedef void (*PostCurveLimbDraw)(struct GlobalContext* globalCtx, SkelAnimeCurve* skelCuve, s32 limbIndex,
|
||||
struct Actor* actor);
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ AnimationHeader* animation;
|
||||
/* 0x04 */ f32 playSpeed;
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
#ifndef Z64_CURVE_H
|
||||
#define Z64_CURVE_H
|
||||
|
||||
#include "PR/ultratypes.h"
|
||||
#include "z64math.h"
|
||||
|
||||
struct GlobalContext;
|
||||
|
||||
typedef struct {
|
||||
/* 0x0 */ u16 flags; // Only the bottom two bits are used, although others are set in objects
|
||||
/* 0x2 */ s16 abscissa; // knot input value
|
||||
/* 0x4 */ s16 leftGradient; // left derivative at the point
|
||||
/* 0x6 */ s16 rightGradient; // right derivative at the point
|
||||
/* 0x8 */ f32 ordinate; // output value
|
||||
} CurveInterpKnot; // size = 0xC
|
||||
|
||||
typedef struct {
|
||||
/* 0x0 */ u8* knotCounts;
|
||||
/* 0x4 */ CurveInterpKnot* interpolationData;
|
||||
/* 0x8 */ s16* constantData;
|
||||
/* 0xC */ s16 unk_0C; // Set but not used, always 1 in objects
|
||||
/* 0xE */ s16 frameCount; // Not used, inferred from use in objects
|
||||
} CurveAnimationHeader; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
/* 0x0 */ u8 child;
|
||||
/* 0x1 */ u8 sibling;
|
||||
/* 0x4 */ Gfx* dList[2];
|
||||
} SkelCurveLimb; // size = 0xC
|
||||
|
||||
typedef struct {
|
||||
/* 0x0 */ SkelCurveLimb** limbs;
|
||||
/* 0x4 */ u8 limbCount;
|
||||
} CurveSkeletonHeader; // size = 0x8
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8 limbCount;
|
||||
/* 0x04 */ SkelCurveLimb** skeleton;
|
||||
/* 0x08 */ CurveAnimationHeader* animation;
|
||||
/* 0x0C */ f32 unk_0C; // set but not used
|
||||
/* 0x10 */ f32 endFrame;
|
||||
/* 0x14 */ f32 playSpeed;
|
||||
/* 0x18 */ f32 curFrame;
|
||||
/* 0x1C */ s16 (*jointTable)[9];
|
||||
} SkelCurve; // size = 0x20
|
||||
|
||||
typedef s32 (*OverrideCurveLimbDraw)(struct GlobalContext* globalCtx, SkelCurve* skelCuve, s32 limbIndex, struct Actor* actor);
|
||||
typedef void (*PostCurveLimbDraw)(struct GlobalContext* globalCtx, SkelCurve* skelCuve, s32 limbIndex, struct Actor* actor);
|
||||
|
||||
|
||||
|
||||
f32 Curve_Interpolate(f32 x, CurveInterpKnot* knots, s32 knotCount);
|
||||
|
||||
void SkelCurve_Clear(SkelCurve* skelCurve);
|
||||
s32 SkelCurve_Init(struct GlobalContext* globalCtx, SkelCurve* skelCurve, CurveSkeletonHeader* skeletonHeaderSeg, CurveAnimationHeader* animation);
|
||||
void SkelCurve_Destroy(struct GlobalContext* globalCtx, SkelCurve* skelCurve);
|
||||
void SkelCurve_SetAnim(SkelCurve* skelCurve, CurveAnimationHeader* animation, f32 arg2, f32 endFrame, f32 curFrame, f32 playSpeed);
|
||||
s32 SkelCurve_Update(struct GlobalContext* globalCtx, SkelCurve* skelCurve);
|
||||
void SkelCurve_Draw(Actor* actor, struct GlobalContext* globalCtx, SkelCurve* skelCurve, OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, Actor* thisx);
|
||||
|
||||
|
||||
// ZAPD compatibility typedefs
|
||||
// TODO: Remove when ZAPD adds support for them
|
||||
typedef CurveInterpKnot TransformData;
|
||||
typedef CurveAnimationHeader TransformUpdateIndex;
|
||||
typedef CurveSkeletonHeader SkelCurveLimbList;
|
||||
|
||||
#endif // Z64_CURVE_H
|
||||
+5
-1
@@ -280,7 +280,9 @@ typedef enum {
|
||||
/* 0x0C */ GI_HEART_PIECE = 0x0C,
|
||||
/* 0x0D */ GI_HEART_CONTAINER,
|
||||
/* 0x11 */ GI_STRAY_FAIRY = 0x11,
|
||||
/* 0x16 */ GI_BOMBS_10 = 0x16,
|
||||
/* 0x14 */ GI_BOMBS_1 = 0x14,
|
||||
/* 0x15 */ GI_BOMBS_5,
|
||||
/* 0x16 */ GI_BOMBS_10,
|
||||
/* 0x19 */ GI_STICKS_1 = 0x19,
|
||||
/* 0x1A */ GI_BOMBCHUS_10,
|
||||
/* 0x1B */ GI_BOMB_BAG_20,
|
||||
@@ -298,6 +300,8 @@ typedef enum {
|
||||
/* 0x32 */ GI_SHIELD_HERO = 0x32,
|
||||
/* 0x33 */ GI_SHIELD_MIRROR,
|
||||
/* 0x35 */ GI_MAGIC_BEANS = 0x35,
|
||||
/* 0x36 */ GI_BOMBCHUS_1,
|
||||
/* 0x3A */ GI_BOMBCHUS_5 = 0x3A,
|
||||
/* 0x3C */ GI_KEY_SMALL = 0x3C,
|
||||
/* 0x3D */ GI_KEY_BOSS,
|
||||
/* 0x3E */ GI_MAP,
|
||||
|
||||
+10
-8
@@ -109,17 +109,19 @@ typedef struct {
|
||||
|
||||
#define IS_ZERO(f) (fabsf(f) < 0.008f)
|
||||
|
||||
// Trig macros
|
||||
#define DEGF_TO_BINANG(degreesf) (s16)(degreesf * 182.04167f + .5f)
|
||||
#define RADF_TO_BINANG(radf) (s16)(radf * (0x8000 / M_PI))
|
||||
#define RADF_TO_DEGF(radf) (radf * (180.0f / M_PI))
|
||||
#define DEGF_TO_RADF(degf) (degf * (M_PI / 180.0f))
|
||||
// Angle conversion macros
|
||||
#define DEG_TO_BINANG(degrees) (s16)((degrees) * (0x8000 / 180.0f))
|
||||
#define DEGF_TO_BINANG(degreesf) (s16)((degreesf) * 182.04167f + .5f)
|
||||
#define RADF_TO_BINANG(radf) (s16)((radf) * (0x8000 / M_PI))
|
||||
#define RADF_TO_DEGF(radf) ((radf) * (180.0f / M_PI))
|
||||
#define DEGF_TO_RADF(degf) ((degf) * (M_PI / 180.0f))
|
||||
#define BINANG_TO_DEGF(binang) ((f32)binang * (360.0001525f / 65535.0f))
|
||||
#define BINANG_TO_RAD(binang) (((f32)binang / 0x8000) * M_PI)
|
||||
|
||||
// Angle arithmetic macros
|
||||
#define BINANG_ROT180(angle) ((s16)(angle + 0x8000))
|
||||
#define BINANG_SUB(a, b) ((s16)(a - b))
|
||||
#define BINANG_ADD(a, b) ((s16)(a + b))
|
||||
#define DEG_TO_RAD(degrees) ((degrees) * (M_PI / 180.0f))
|
||||
#define BINANG_TO_DEGF(binang) ((f32)binang * (360.0001525f / 65535.0f))
|
||||
#define BINANG_TO_RAD(binang) (((f32)binang / 0x8000) * M_PI)
|
||||
|
||||
// Vector macros
|
||||
#define SQXZ(vec) ((vec.x) * (vec.x) + (vec.z) * (vec.z))
|
||||
|
||||
Reference in New Issue
Block a user