SubS Shadows, Cutscenes, Exchange, and Planes (#773)

* Bring code over

* Rename

* clean up variables.h

* Bring over some more code as well as cleanup

* remove newline in functions.h

* format

* Add plane functions

* Remove from actorfixer

* Add some more docs to plane functions

* Use temp for better format

* change func_8013E8F8 to return an s32

* rename origin back to pos

* format

* Add docs to SubS_ComputePlane

* format

* gfxContextPtr -> globalCtx

* bss

* Better docs of SubS_ComputePlane

* Normal -> unitVec

* Review pt. 1

* Update plane comment

* SubS_ActorAndPlayerAreFacing -> SubS_ActorAndPlayerFaceEachOther

* Add subs texture defines

* Update include/z64math.h

Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com>

Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com>
This commit is contained in:
Derek Hensley
2022-04-22 05:11:54 +01:00
committed by GitHub
co-authored by EllipticEllipsis
parent 10d9025267
commit e50c346ab8
37 changed files with 390 additions and 115 deletions
+10 -10
View File
@@ -2442,7 +2442,7 @@ s32 func_8013A530(GlobalContext* globalCtx, Actor* actor, s32 flag, Vec3f* pos,
struct EnDoor* SubS_FindDoor(GlobalContext* globalCtx, s32 switchFlag);
Gfx* SubS_DrawTransformFlexLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* jointTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, TransformLimbDraw transformLimbDraw, Actor* actor, Mtx** mtx, Gfx* gfx);
Gfx* SubS_DrawTransformFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, TransformLimbDraw transformLimbDraw, Actor* actor, Gfx* gfx);
s32 func_8013AD6C(GlobalContext* globalCtx);
s32 SubS_InCsMode(GlobalContext* globalCtx);
s32 func_8013AD9C(s16 arg0, s16 arg1, Vec3f* arg2, Vec3s* arg3, s32 arg4, s32 arg5);
void SubS_UpdateFlags(u16* flags, u16 setBits, u16 unsetBits);
void func_8013AF00(f32* arg0, s32 arg1, s32 arg2);
@@ -2459,10 +2459,10 @@ Path* SubS_GetDayDependentPath(GlobalContext* globalCtx, u8 pathIndex, u8 max, s
s32 func_8013C068(Path* path, s32 arg1, Vec3f* arg2, f32 arg3, s32 arg4);
s32 func_8013C624(Actor* actor, Path* path, s32* arg2, f32* arg3, s32 arg4, s32 arg5);
s32 SubS_CopyPointFromPathCheckBounds(Path* path, s32 pointIndex, Vec3f* dst);
s32 func_8013C964(Actor* actor, GlobalContext* globalCtx, f32 arg2, f32 arg3, s32 arg4, s32 arg5);
void func_8013CC2C(s32 arg0, s32 arg1, u8* arg2, s32 arg3);
void func_8013CD64(Vec3f* arg0, Vec3f* arg1, u8* arg2, f32 arg3, u8 arg4, u8* arg5, s8* arg6);
void func_8013CF04(Actor* actor, GraphicsContext** gfxCtxPtr, u8* arg2);
s32 func_8013C964(Actor* actor, GlobalContext* globalCtx, f32 xzRange, f32 yRange, s32 itemId, s32 type);
void SubS_FillShadowTex(s32 startCol, s32 startRow, u8* tex, s32 size);
void SubS_GenShadowTex(Vec3f bodyPartsPos[], Vec3f* worldPos, u8* tex, f32 tween, u8 bodyPartsNum, u8 sizes[], s8 parentBodyParts[]);
void SubS_DrawShadowTex(Actor* actor, GameState* gameState, u8* tex);
s16 func_8013D0E0(s16* arg0, s16 arg1, s16 arg2, f32 arg3, f32 arg4, f32 arg5);
s32 func_8013D2E0(Vec3f* arg0, Vec3f* arg1, Vec3s* arg2, Vec3s* arg3, Vec3s* arg4, Vec3s* arg5, u16* arg6);
s32 SubS_AngleDiffLessEqual(s16 angleA, s16 threshold, s16 angleB);
@@ -2487,12 +2487,12 @@ s32 SubS_ActorPathing_SetNextPoint(GlobalContext* globalCtx, ActorPathing* actor
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);
void func_8013E4B0(Vec3f* arg0, Vec3f* arg1, Vec3s* arg2, Plane* plane);
s32 func_8013E5CC(Vec3f* arg0, Vec3s* arg1, Vec3f* arg2, Vec3f* arg3, Vec3f* arg4, Vec3f* arg5);
void SubS_ConstructPlane(Vec3f* point, Vec3f* unitVec, Vec3s* rot, Plane* plane);
s32 SubS_LineSegVsPlane(Vec3f* point, Vec3s* rot, Vec3f* unitVec, Vec3f* linePointA, Vec3f* linePointB, Vec3f* intersect);
Actor* SubS_FindActorCustom(GlobalContext* globalCtx, Actor* actor, Actor* actorListStart, u8 actorCategory, s16 actorId, void* verifyData, VerifyActor verifyActor);
s32 func_8013E748(Actor* actor, GlobalContext* globalCtx, f32 arg2, f32 arg3, s32 arg4, Vec3s* arg5, func_8013E748_arg6 arg6);
s32 func_8013E7C0(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2);
void func_8013E8F8(Actor* actor, GlobalContext* globalCtx, f32 arg2, f32 arg3, s32 arg4, s16 arg5, s16 arg6);
s32 func_8013E748(Actor* actor, GlobalContext* globalCtx, f32 xzRange, f32 yRange, s32 exchangeItemId, void* data, func_8013E748_VerifyFunc verifyFunc);
s32 SubS_ActorAndPlayerFaceEachOther(GlobalContext* globalCtx, Actor* actor, void* data);
s32 func_8013E8F8(Actor* actor, GlobalContext* globalCtx, f32 xzRange, f32 yRange, s32 exhangeItemId, s16 playerYawTol, s16 actorYawTol);
s32 func_8013E950(Vec3f* arg0, Vec3f* arg1, s16 arg2, Vec3f* arg3, Vec3f* arg4, s16* arg5, s16* arg6, s16* arg7, s16* arg8, u16 arg9, u16 arg10, u16 arg11, u16 arg12);
// void func_8013EC10(void);
void func_8013EC44(f32 a, u8 b, u8 c, u8 d);
-6
View File
@@ -1349,12 +1349,6 @@ extern SceneTableEntry gSceneTable[];
extern UNK_PTR D_801C5C50;
// extern UNK_TYPE1 D_801C5C9C;
extern UNK_PTR D_801C5CB0;
extern MtxF sMtxFClear;
// extern UNK_TYPE1 D_801C5D10;
// extern UNK_TYPE1 D_801C5D20;
// extern UNK_TYPE1 D_801C5D60;
// extern UNK_TYPE1 D_801C5D80;
extern Vec3f D_801C5DB0;
// extern UNK_TYPE1 D_801C5DD0;
// extern UNK_TYPE1 D_801C5DE0;
// extern UNK_TYPE1 D_801C5DF0;
+4
View File
@@ -49,6 +49,10 @@ typedef struct {
/* 0x0C */ f32 radius;
} Spheref; // size = 0x10
/*
The plane paramaters are of form `ax + by + cz + d = 0`
where `(a,b,c)` is the plane's normal vector and d is the originDist
*/
typedef struct {
/* 0x00 */ Vec3f normal;
/* 0x0C */ f32 originDist;
+10 -1
View File
@@ -4,16 +4,25 @@
#include "z64actor.h"
#include "z64scene.h"
#include "code/sub_s/sub_s.h"
extern Vec3f gOneVec3f;
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*, void*);
//! @TODO: rename based on func_8013E748 and func_800B8500
typedef s32 (*func_8013E748_VerifyFunc)(struct GlobalContext*, Actor*, void*);
typedef s32 (*VerifyActor)(struct GlobalContext*, Actor*, Actor*, void*);
#define SUBS_SHADOW_TEX_WIDTH 64
#define SUBS_SHADOW_TEX_HEIGHT 64
#define SUBS_SHADOW_TEX_SIZE ((s32)sizeof(u8[SUBS_SHADOW_TEX_HEIGHT][SUBS_SHADOW_TEX_WIDTH]))
#define ACTOR_PATHING_RETURN_TO_START (1 << 0)
#define ACTOR_PATHING_SWITCH_DIRECTION (1 << 1)
#define ACTOR_PATHING_MOVE_BACKWARDS (1 << 3)
+2 -2
View File
@@ -72,8 +72,8 @@ typedef struct EnHy {
} EnHy; // size = 0x3EC
extern s8 gEnHyBodyParts[];
extern s8 gEnHyBodyPartsIndex[];
extern u8 gEnHyShadowSize[];
extern s8 gEnHyParentBodyParts[];
extern u8 gEnHyShadowSizes[];
s32 EnHy_ChangeAnim(SkelAnime* skelAnime, s16 animIndex);
EnDoor* EnHy_FindNearestDoor(Actor* actor, GlobalContext* globalCtx);