SubS ActorPathing (#689)

* Bring code over

* Clean up

* Renames

* Cleanup

* Split SubS stuff from z64 into z64subs

* newline

* Bss

* Name callbacks

* bss

* bss
This commit is contained in:
Derek Hensley
2022-03-26 02:43:14 +00:00
committed by GitHub
parent 36e48fcd91
commit 9a41b76f35
13 changed files with 296 additions and 150 deletions
+6 -6
View File
@@ -2481,12 +2481,12 @@ Actor* SubS_FindActor(GlobalContext* globalCtx, Actor* actorListStart, u8 actorC
s32 SubS_FillLimbRotTables(GlobalContext* globalCtx, s16* limbRotTableY, s16* limbRotTableZ, s32 numLimbs);
s32 func_8013DB90(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2);
s32 func_8013DC40(Path* arg0, s32 arg1, s32 arg2, Vec3f* arg3);
void func_8013DCE0(GlobalContext* globalCtx, Vec3f* arg1, Actor* arg2, struct_8013DF3C_arg1* arg3, Path* arg4, s32 arg5, s32 arg6, s32 arg7, s32 arg8, u8 arg9);
s32 func_8013DE04(GlobalContext* globalCtx, struct_8013DF3C_arg1* arg1, struct_8013DF3C_arg1_unk_func1 arg2, struct_8013DF3C_arg1_unk_func2 arg3, struct_8013DF3C_arg1_unk_func2 arg4, struct_8013DF3C_arg1_unk_func2 arg5);
void func_8013DF3C(GlobalContext* globalCtx, struct_8013DF3C_arg1* arg1);
s32 func_8013E054(GlobalContext* globalCtx, struct_8013DF3C_arg1* arg1);
s32 func_8013E07C(GlobalContext* globalCtx, struct_8013DF3C_arg1* arg1);
s32 func_8013E0A4(GlobalContext* globalCtx, struct_8013DF3C_arg1* arg1);
void SubS_ActorPathing_Init(GlobalContext* globalCtx, Vec3f* worldPos, Actor* actor, ActorPathing* actorPath, Path* paths, s32 pathIndex, s32 begPointIndex, s32 endPointIndex, s32 curPointIndex, u8 flags);
s32 SubS_ActorPathing_Update(GlobalContext* globalCtx, ActorPathing* actorPath, ActorPathingComputeFunc computePointInfoFunc, ActorPathingUpdateFunc updateActorInfoFunc, ActorPathingUpdateFunc moveFunc, ActorPathingUpdateFunc setNextPointFunc);
void SubS_ActorPathing_ComputePointInfo(GlobalContext* globalCtx, ActorPathing* actorPath);
s32 SubS_ActorPathing_MoveWithGravity(GlobalContext* globalCtx, ActorPathing* actorPath);
s32 SubS_ActorPathing_MoveWithoutGravityReverse(GlobalContext* globalCtx, ActorPathing* actorPath);
s32 SubS_ActorPathing_SetNextPoint(GlobalContext* globalCtx, ActorPathing* actorPath);
void SubS_ChangeAnimationBySpeedInfo(SkelAnime* skelAnime, AnimationSpeedInfo* animations, s32 nextIndex, s32* curIndex);
s32 SubS_StartActorCutscene(Actor* actor, s16 nextCutscene, s16 curCutscene, s32 type);
s32 SubS_FillCutscenesList(Actor* actor, s16 cutscenes[], s16 numCutscenes);
+1 -39
View File
@@ -39,6 +39,7 @@
#include "z64save.h"
#include "z64scene.h"
#include "z64skin.h"
#include "z64subs.h"
#include "z64transition.h"
#include "regs.h"
@@ -1369,45 +1370,6 @@ typedef struct {
/* 0x8 */ s32 unk8; // game script pointer?
} struct_80133038_arg2; // size = 0xC
typedef enum {
/* 0 */ SUBS_CUTSCENE_SET_UNK_LINK_FIELDS,
/* 1 */ SUBS_CUTSCENE_NORMAL,
/* 2 */ SUBS_CUTSCENE_SET_FLAG
} SubSCutsceneType;
typedef s32 (*func_8013E748_arg6)(struct GlobalContext*, Actor*, Vec3s*);
typedef s32 (*VerifyActor)(struct GlobalContext*, Actor*, Actor*, void*);
struct struct_8013DF3C_arg1;
typedef void (*struct_8013DF3C_arg1_unk_func1)(struct GlobalContext*, struct struct_8013DF3C_arg1*);
typedef s32 (*struct_8013DF3C_arg1_unk_func2)(struct GlobalContext*, struct struct_8013DF3C_arg1*);
typedef struct struct_8013DF3C_arg1 {
/* 0x00 */ Path* setupPathList;
/* 0x04 */ s32 pathIndex;
/* 0x08 */ Vec3s* points;
/* 0x0C */ s32 count;
/* 0x10 */ s32 unk_10;
/* 0x14 */ s32 unk_14;
/* 0x18 */ s32 unk_18;
/* 0x1C */ u8 unk_1C;
/* 0x1D */ u8 unk_1D;
/* 0x20 */ Vec3f unk_20;
/* 0x2C */ Vec3f unk_2C;
/* 0x38 */ Vec3f unk_38;
/* 0x44 */ Vec3f* unk_44;
/* 0x48 */ Actor* actor;
/* 0x4C */ f32 unk_4C;
/* 0x50 */ f32 unk_50;
/* 0x54 */ Vec3s unk_54;
/* 0x5C */ struct_8013DF3C_arg1_unk_func1 unk_5C;
/* 0x60 */ struct_8013DF3C_arg1_unk_func2 unk_60;
/* 0x64 */ struct_8013DF3C_arg1_unk_func2 unk_64;
/* 0x68 */ struct_8013DF3C_arg1_unk_func2 unk_68;
} struct_8013DF3C_arg1; // size = 0x6C
typedef struct {
/* 0x00 */ u32 type;
/* 0x04 */ u32 setScissor;
+60
View File
@@ -0,0 +1,60 @@
#ifndef Z64SUBS_H
#define Z64SUBS_H
#include "z64actor.h"
#include "z64scene.h"
typedef enum {
/* 0 */ SUBS_CUTSCENE_SET_UNK_LINK_FIELDS,
/* 1 */ SUBS_CUTSCENE_NORMAL,
/* 2 */ SUBS_CUTSCENE_SET_FLAG
} SubSCutsceneType;
typedef s32 (*func_8013E748_arg6)(struct GlobalContext*, Actor*, Vec3s*);
typedef s32 (*VerifyActor)(struct GlobalContext*, Actor*, Actor*, void*);
#define ACTOR_PATHING_RETURN_TO_START (1 << 0)
#define ACTOR_PATHING_SWITCH_DIRECTION (1 << 1)
#define ACTOR_PATHING_MOVE_BACKWARDS (1 << 3)
#define ACTOR_PATHING_REACHED_POINT_PERMANENT (1 << 4)
#define ACTOR_PATHING_REACHED_END_PERMANENT (1 << 5)
#define ACTOR_PATHING_REACHED_POINT_TEMPORARY (1 << 6)
#define ACTOR_PATHING_REACHED_END_TEMPORARY (1 << 7)
#define ACTOR_PATHING_REACHED_TEMPORARY \
(ACTOR_PATHING_REACHED_POINT_TEMPORARY | ACTOR_PATHING_REACHED_END_TEMPORARY)
#define ACTOR_PATHING_REACHED_POINT \
(ACTOR_PATHING_REACHED_POINT_PERMANENT | ACTOR_PATHING_REACHED_POINT_TEMPORARY)
#define ACTOR_PATHING_REACHED_END \
(ACTOR_PATHING_REACHED_END_PERMANENT | ACTOR_PATHING_REACHED_END_TEMPORARY)
struct ActorPathing;
typedef void (*ActorPathingComputeFunc)(struct GlobalContext*, struct ActorPathing*);
typedef s32 (*ActorPathingUpdateFunc)(struct GlobalContext*, struct ActorPathing*);
typedef struct ActorPathing {
/* 0x00 */ Path* setupPathList;
/* 0x04 */ s32 pathIndex;
/* 0x08 */ Vec3s* points;
/* 0x0C */ s32 count;
/* 0x10 */ s32 curPointIndex;
/* 0x14 */ s32 begPointIndex;
/* 0x18 */ s32 endPointIndex;
/* 0x1C */ u8 flags;
/* 0x1D */ u8 prevFlags;
/* 0x20 */ Vec3f curPoint;
/* 0x2C */ Vec3f pointOffset;
/* 0x38 */ Vec3f prevPoint;
/* 0x44 */ Vec3f* worldPos;
/* 0x48 */ Actor* actor;
/* 0x4C */ f32 distSqToCurPointXZ;
/* 0x50 */ f32 distSqToCurPoint;
/* 0x54 */ Vec3s rotToCurPoint;
/* 0x5C */ ActorPathingComputeFunc computePointInfoFunc;
/* 0x60 */ ActorPathingUpdateFunc updateActorInfoFunc; // Return true if should setNextPoint, false if the actor should move forward
/* 0x64 */ ActorPathingUpdateFunc moveFunc; // Return true if should compute and update again
/* 0x68 */ ActorPathingUpdateFunc setNextPointFunc; // Return true if should compute and update again
} ActorPathing; // size = 0x6C
#endif