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-21 21:11:54 -07:00 committed by GitHub
parent 10d9025267
commit e50c346ab8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 390 additions and 115 deletions

View File

@ -1,6 +1,6 @@
<Root>
<File Name="code" OutName="sub_s" BaseAddress="0x800A5AC0" RangeStart="0x120260" RangeEnd="0x1202F0" >
<DList Name="D_801C5D60" Offset="0x1202A0"/>
<DList Name="D_801C5D80" Offset="0x1202C0"/>
<DList Name="gShadowDL" Offset="0x1202A0"/>
<DList Name="gShadowVtxDL" Offset="0x1202C0"/>
</File>
</Root>

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

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;

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;

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)

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

View File

@ -1,4 +1,3 @@
#include "prevent_bss_reordering.h"
#include "global.h"
u8 sYaz0DataBuffer[0x400];

View File

@ -37,9 +37,9 @@ static AnimationInfoS sAnimations[] = {
s8 gEnHyBodyParts[] = { -1, 1, 12, 13, 14, 9, 10, 11, 0, 6, 7, 8, 3, 4, 5, 2 };
s8 gEnHyBodyPartsIndex[] = { 0, 0, 0, 0, 3, 4, 0, 6, 7, 0, 9, 10, 0, 12, 13 };
s8 gEnHyParentBodyParts[] = { 0, 0, 0, 0, 3, 4, 0, 6, 7, 0, 9, 10, 0, 12, 13 };
u8 gEnHyShadowSize[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
u8 gEnHyShadowSizes[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
s32 EnHy_ChangeAnim(SkelAnime* skelAnime, s16 animIndex) {
s16 frameCount;

View File

@ -10,7 +10,7 @@ s16 sPathDayFlags[] = { 0x40, 0x20, 0x10, 8, 4, 2, 1, 0 };
#include "code/sub_s/sub_s.c"
Vec3f D_801C5DB0 = { 1.0f, 1.0f, 1.0f };
Vec3f gOneVec3f = { 1.0f, 1.0f, 1.0f };
s32 D_801C5DBC[] = { 0, 1 }; // Unused
@ -158,7 +158,15 @@ Gfx* SubS_DrawTransformFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jo
return gfx;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013AD6C.s")
s32 SubS_InCsMode(GlobalContext* globalCtx) {
s32 inCsMode = false;
if (Play_InCsMode(globalCtx)) {
inCsMode = true;
}
return inCsMode;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013AD9C.s")
@ -333,13 +341,189 @@ s32 SubS_CopyPointFromPathCheckBounds(Path* path, s32 pointIndex, Vec3f* dst) {
return true;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013C964.s")
//! TODO: Needs docs with func_800B8500
s32 func_8013C964(Actor* actor, GlobalContext* globalCtx, f32 xzRange, f32 yRange, s32 itemId, s32 type) {
s32 ret = false;
s16 x;
s16 y;
f32 xzDistToPlayerTemp;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013CC2C.s")
Actor_GetScreenPos(globalCtx, actor, &x, &y);
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013CD64.s")
switch (type) {
case 1:
yRange = fabsf(actor->playerHeightRel) + 1.0f;
xzRange = actor->xzDistToPlayer + 1.0f;
ret = Actor_PickUp(actor, globalCtx, itemId, xzRange, yRange);
break;
case 2:
if ((fabsf(actor->playerHeightRel) <= yRange) && (actor->xzDistToPlayer <= xzRange)) {
ret = func_800B8500(actor, globalCtx, xzRange, yRange, itemId);
}
break;
case 3:
//! @bug: Both x and y conditionals are always true, || should be an &&
if (((x >= 0) || (x < SCREEN_WIDTH)) && ((y >= 0) || (y < SCREEN_HEIGHT))) {
ret = func_800B8500(actor, globalCtx, xzRange, yRange, itemId);
}
break;
case 4:
yRange = fabsf(actor->playerHeightRel) + 1.0f;
xzRange = actor->xzDistToPlayer + 1.0f;
xzDistToPlayerTemp = actor->xzDistToPlayer;
actor->xzDistToPlayer = 0.0f;
actor->flags |= 0x10000;
ret = func_800B8500(actor, globalCtx, xzRange, yRange, itemId);
actor->xzDistToPlayer = xzDistToPlayerTemp;
break;
case 5:
//! @bug: Both x and y conditionals are always true, || should be an &&
if (((x >= 0) || (x < SCREEN_WIDTH)) && ((y >= 0) || (y < SCREEN_HEIGHT)) &&
(fabsf(actor->playerHeightRel) <= yRange) && (actor->xzDistToPlayer <= xzRange) && actor->isTargeted) {
actor->flags |= 0x10000;
ret = func_800B8500(actor, globalCtx, xzRange, yRange, itemId);
}
break;
case 6:
//! @bug: Both x and y conditionals are always true, || should be an &&
if (((x >= 0) || (x < SCREEN_WIDTH)) && ((y >= 0) || (y < SCREEN_HEIGHT)) &&
(fabsf(actor->playerHeightRel) <= yRange) && (actor->xzDistToPlayer <= xzRange)) {
actor->flags |= 0x10000;
ret = func_800B8500(actor, globalCtx, xzRange, yRange, itemId);
}
break;
}
return ret;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013CF04.s")
const u8 sShadowMaps[4][12][12] = {
{
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0 },
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0 },
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0 },
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0 },
{ 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
},
{
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0 },
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0 },
{ 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 },
{ 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 },
{ 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 },
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0 },
{ 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
},
{
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0 },
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0 },
{ 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 },
{ 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 },
{ 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 },
{ 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 },
{ 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0 },
{ 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
},
{
{ 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0 },
{ 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 },
{ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 },
{ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 },
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
{ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 },
{ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 },
{ 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 },
{ 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0 },
},
};
void SubS_FillShadowTex(s32 startCol, s32 startRow, u8* tex, s32 size) {
s32 i;
s32 j;
s32 start;
for (i = 0; i < 12; i++) {
start = ((startRow + i) * 64) + startCol - 390;
for (j = 0; j < 12; j++) {
if (sShadowMaps[size][i][j] != 0) {
if ((start + j >= 0) && (start + j < SUBS_SHADOW_TEX_SIZE)) {
tex[start + j] = 255;
}
}
}
}
}
void SubS_GenShadowTex(Vec3f bodyPartsPos[], Vec3f* worldPos, u8* tex, f32 tween, u8 bodyPartsNum, u8 sizes[],
s8 parentBodyParts[]) {
Vec3f pos;
Vec3f startVec;
s32 i;
s32 parentBodyPart;
Vec3f* bodyPartPos;
s32 startCol;
s32 startRow;
for (i = 0; i < bodyPartsNum; i++) {
if (parentBodyParts[i] >= 0) {
parentBodyPart = parentBodyParts[i];
bodyPartPos = &bodyPartsPos[i];
pos.x = (bodyPartsPos[parentBodyPart].x - bodyPartPos->x) * tween + (bodyPartPos->x - worldPos->x);
pos.y = (bodyPartsPos[parentBodyPart].y - bodyPartPos->y) * tween + (bodyPartPos->y - worldPos->y);
pos.z = (bodyPartsPos[parentBodyPart].z - bodyPartPos->z) * tween + (bodyPartPos->z - worldPos->z);
} else {
bodyPartPos = &bodyPartsPos[i];
pos.x = bodyPartPos->x - worldPos->x;
pos.y = bodyPartPos->y - worldPos->y;
pos.z = bodyPartPos->z - worldPos->z;
}
Matrix_MultiplyVector3fByState(&pos, &startVec);
startCol = 64.0f + startVec.x;
startRow = 64.0f - startVec.z;
SubS_FillShadowTex(startCol >> 1, startRow >> 1, tex, sizes[i]);
}
}
void SubS_DrawShadowTex(Actor* actor, GameState* gameState, u8* tex) {
s32 pad;
GraphicsContext* gfxCtx = gameState->gfxCtx;
OPEN_DISPS(gfxCtx);
func_8012C28C(gfxCtx);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, 100);
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0);
Matrix_InsertTranslation(actor->world.pos.x, 0.0f, actor->world.pos.z, MTXMODE_NEW);
Matrix_Scale(0.6f, 1.0f, 0.6f, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gShadowDL);
gDPLoadTextureBlock(POLY_OPA_DISP++, tex, G_IM_FMT_I, G_IM_SIZ_8b, SUBS_SHADOW_TEX_WIDTH, SUBS_SHADOW_TEX_HEIGHT, 0,
G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD);
gSPDisplayList(POLY_OPA_DISP++, gShadowVtxDL);
CLOSE_DISPS(gfxCtx);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013D0E0.s")
@ -688,9 +872,58 @@ s32 SubS_FillCutscenesList(Actor* actor, s16 cutscenes[], s16 numCutscenes) {
return i;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013E4B0.s")
/**
* Computes a plane based on a point on the plane, a unit vector and two angles
*
* @param[in] point a point on the plane
* @param[in] unitVec the unit vector rotated that becomes the plane's normal
* @param[in] rot the angles to rotate with, uses just the x and y components
* @param[out] plane the computed plane
*
* Notes:
* The unit input vector is expected to already be normalized (only uses are with the z unit vector)
*
*/
void SubS_ConstructPlane(Vec3f* point, Vec3f* unitVec, Vec3s* rot, Plane* plane) {
f32 sin;
f32 cos;
f32 temp;
f32 unitVecZ;
f32 normY;
f32 unitVecYX;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013E5CC.s")
sin = Math_SinS(-rot->x);
cos = Math_CosS(-rot->x);
unitVecZ = unitVec->z;
unitVecYX = unitVec->y;
// Apply a rotation by -x about the X axis
temp = (unitVecZ * cos) - (unitVecYX * sin);
normY = (unitVecZ * sin) + (unitVecYX * cos);
sin = Math_SinS(rot->y);
cos = Math_CosS(rot->y);
unitVecYX = unitVec->x;
plane->normal.y = normY;
// Apply a rotation by y about the Y axis
plane->normal.z = (temp * cos) - (unitVecYX * sin);
plane->normal.x = (temp * sin) + (unitVecYX * cos);
plane->originDist = -((point->x * plane->normal.x) + (plane->normal.y * point->y) + (plane->normal.z * point->z));
}
s32 SubS_LineSegVsPlane(Vec3f* point, Vec3s* rot, Vec3f* unitVec, Vec3f* linePointA, Vec3f* linePointB,
Vec3f* intersect) {
s32 lineSegVsPlane;
Plane plane;
SubS_ConstructPlane(point, unitVec, rot, &plane);
lineSegVsPlane = Math3D_LineSegVsPlane(plane.normal.x, plane.normal.y, plane.normal.z, plane.originDist, linePointA,
linePointB, intersect, false);
return lineSegVsPlane ? true : false;
}
/**
* Finds the first actor instance of a specified Id and category verified with a custom callback.
@ -714,10 +947,44 @@ Actor* SubS_FindActorCustom(GlobalContext* globalCtx, Actor* actor, Actor* actor
return actorIter;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013E748.s")
//! TODO: Needs docs with func_800B8500
s32 func_8013E748(Actor* actor, GlobalContext* globalCtx, f32 xzRange, f32 yRange, s32 exchangeItemId, void* data,
func_8013E748_VerifyFunc verifyFunc) {
s32 ret = false;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013E7C0.s")
if ((verifyFunc == NULL) || ((verifyFunc != NULL) && verifyFunc(globalCtx, actor, data))) {
ret = func_800B8500(actor, globalCtx, xzRange, yRange, exchangeItemId);
}
return ret;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013E8F8.s")
s32 SubS_ActorAndPlayerFaceEachOther(GlobalContext* globalCtx, Actor* actor, void* data) {
Player* player = GET_PLAYER(globalCtx);
Vec3s* yawTols = (Vec3s*)data;
s16 playerYaw = ABS(BINANG_SUB(Actor_YawBetweenActors(&player->actor, actor), player->actor.shape.rot.y));
s16 actorYaw = ABS(BINANG_SUB(actor->yawTowardsPlayer, actor->shape.rot.y));
s32 areFacing = false;
s32 actorYawTol = ABS(yawTols->y);
s32 playerYawTol;
if (actorYaw < (s16)actorYawTol) {
playerYawTol = ABS(yawTols->x);
if (playerYaw < (s16)playerYawTol) {
areFacing = true;
}
}
return areFacing;
}
//! TODO: Needs docs with func_800B8500
s32 func_8013E8F8(Actor* actor, GlobalContext* globalCtx, f32 xzRange, f32 yRange, s32 exhangeItemId, s16 playerYawTol,
s16 actorYawTol) {
Vec3s yawTols;
yawTols.x = playerYawTol;
yawTols.y = actorYawTol;
return func_8013E748(actor, globalCtx, xzRange, yRange, exhangeItemId, &yawTols, SubS_ActorAndPlayerFaceEachOther);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013E950.s")

View File

@ -4,6 +4,7 @@
* Description: Twinmold
*/
#include "prevent_bss_reordering.h"
#include "z_boss_02.h"
#include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h"
#include "overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h"

View File

@ -541,7 +541,7 @@ void EnAh_Update(Actor* thisx, GlobalContext* globalCtx) {
radius = this->collider.dim.radius + 60;
height = this->collider.dim.height + 10;
func_8013C964(&this->actor, globalCtx, radius, height, 0, this->unk_2D8 & 7);
func_8013C964(&this->actor, globalCtx, radius, height, EXCH_ITEM_NONE, this->unk_2D8 & 7);
if (!(this->unk_2D8 & 0x10)) {
Actor_MoveWithGravity(&this->actor);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4);

View File

@ -647,7 +647,7 @@ s32 func_80BDF308(EnAl* this, GlobalContext* globalCtx, struct_80133038_arg2* ar
break;
case 2:
this->unk_4F0 = 0;
this->unk_4F0 = EXCH_ITEM_NONE;
this->unk_4EA = 0;
func_80BDE27C(this, 2);
break;
@ -660,7 +660,7 @@ s32 func_80BDF390(EnAl* this, GlobalContext* globalCtx, struct_80133038_arg2* ar
this->actor.flags |= ACTOR_FLAG_1;
this->actor.targetMode = 0;
this->unk_4F0 = 0;
this->unk_4F0 = EXCH_ITEM_NONE;
this->unk_4C2 = 0;
this->unk_4D4 = 40.0f;

View File

@ -384,7 +384,7 @@ s32 func_80BA9160(EnBaba* this, GlobalContext* globalCtx) {
this->actor.world.pos.x = sp58.x;
this->actor.world.pos.z = sp58.z;
if (func_8013AD6C(globalCtx)) {
if (SubS_InCsMode(globalCtx)) {
sp54 = this->unk_430;
sp50 = this->unk_42C;
sp58 = this->actor.world.pos;
@ -401,7 +401,7 @@ s32 func_80BA9160(EnBaba* this, GlobalContext* globalCtx) {
this->actor.world.rot.y = Math_Vec3f_Yaw(&sp70, &sp64);
}
if (func_8013AD6C(globalCtx)) {
if (SubS_InCsMode(globalCtx)) {
this->unk_430 = sp54;
this->unk_42C = sp50;
this->unk_414 = sp58;

View File

@ -308,7 +308,7 @@ void EnBba01_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* t
void EnBba01_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnBba01* this = THIS;
s32 i;
u8* shadowTex = GRAPH_ALLOC(globalCtx->state.gfxCtx, sizeof(u8[64][64]));
u8* shadowTex = GRAPH_ALLOC(globalCtx->state.gfxCtx, SUBS_SHADOW_TEX_SIZE);
u8* shadowTexIter;
OPEN_DISPS(globalCtx->state.gfxCtx);
@ -322,14 +322,14 @@ void EnBba01_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnBba01_TransformLimbDraw, &this->enHy.actor);
Matrix_InsertXRotation_s(0, MTXMODE_NEW);
for (i = 0, shadowTexIter = shadowTex; i < (s32)sizeof(u8[64][64]); i++) {
for (i = 0, shadowTexIter = shadowTex; i < SUBS_SHADOW_TEX_SIZE; i++) {
*shadowTexIter++ = 0;
}
for (i = 0; i < 5; i++) {
func_8013CD64(this->enHy.bodyPartsPos, &this->enHy.actor.world.pos, shadowTex, i / 5.0f,
ARRAY_COUNT(this->enHy.bodyPartsPos), gEnHyShadowSize, gEnHyBodyPartsIndex);
SubS_GenShadowTex(this->enHy.bodyPartsPos, &this->enHy.actor.world.pos, shadowTex, i / 5.0f,
ARRAY_COUNT(this->enHy.bodyPartsPos), gEnHyShadowSizes, gEnHyParentBodyParts);
}
func_8013CF04(&this->enHy.actor, &globalCtx->state.gfxCtx, shadowTex);
SubS_DrawShadowTex(&this->enHy.actor, &globalCtx->state, shadowTex);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}

View File

@ -299,7 +299,7 @@ void EnCne01_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* t
void EnCne01_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnCne01* this = THIS;
s32 i;
u8* shadowTex = GRAPH_ALLOC(globalCtx->state.gfxCtx, sizeof(u8[64][64]));
u8* shadowTex = GRAPH_ALLOC(globalCtx->state.gfxCtx, SUBS_SHADOW_TEX_SIZE);
u8* shadowTexIter;
OPEN_DISPS(globalCtx->state.gfxCtx);
@ -314,14 +314,14 @@ void EnCne01_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnCne01_TransformLimbDraw, &this->enHy.actor);
Matrix_InsertXRotation_s(0, MTXMODE_NEW);
for (i = 0, shadowTexIter = shadowTex; i < (s32)sizeof(u8[64][64]); i++) {
for (i = 0, shadowTexIter = shadowTex; i < SUBS_SHADOW_TEX_SIZE; i++) {
*shadowTexIter++ = 0;
}
for (i = 0; i < 5; i++) {
func_8013CD64(this->enHy.bodyPartsPos, &this->enHy.actor.world.pos, shadowTex, i / 5.0f,
ARRAY_COUNT(this->enHy.bodyPartsPos), gEnHyShadowSize, gEnHyBodyPartsIndex);
SubS_GenShadowTex(this->enHy.bodyPartsPos, &this->enHy.actor.world.pos, shadowTex, i / 5.0f,
ARRAY_COUNT(this->enHy.bodyPartsPos), gEnHyShadowSizes, gEnHyParentBodyParts);
}
func_8013CF04(&this->enHy.actor, &globalCtx->state.gfxCtx, shadowTex);
SubS_DrawShadowTex(&this->enHy.actor, &globalCtx->state, shadowTex);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}

View File

@ -564,7 +564,7 @@ void EnDai_Update(Actor* thisx, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
func_80B3E834(this);
if (!(this->unk_1CE & 0x200)) {
func_8013C964(&this->actor, globalCtx, 0.0f, 0.0f, 0, this->unk_1CE & 7);
func_8013C964(&this->actor, globalCtx, 0.0f, 0.0f, EXCH_ITEM_NONE, this->unk_1CE & 7);
}
func_80B3E460(this);
}

View File

@ -149,8 +149,8 @@ void func_80A715DC(EnDno* this, GlobalContext* globalCtx) {
crace = (BgCraceMovebg*)SubS_FindActor(globalCtx, &crace->actor, ACTORCAT_BG, ACTOR_BG_CRACE_MOVEBG);
if (crace != NULL) {
if (ENDNO_GET_F(&crace->actor) == ENDNO_GET_F_0 && !(crace->unk_170 & 1)) {
if (func_8013E5CC(&crace->actor.home.pos, &crace->actor.home.rot, &D_80A73B2C, &this->actor.prevPos,
&this->actor.world.pos, &sp88)) {
if (SubS_LineSegVsPlane(&crace->actor.home.pos, &crace->actor.home.rot, &D_80A73B2C,
&this->actor.prevPos, &this->actor.world.pos, &sp88)) {
Math_Vec3f_Diff(&this->actor.world.pos, &crace->actor.home.pos, &sp7C);
Matrix_RotateY(-crace->actor.home.rot.y, MTXMODE_NEW);
Matrix_MultiplyVector3fByState(&sp7C, &sp70);

View File

@ -410,7 +410,7 @@ void EnDnp_Update(Actor* thisx, GlobalContext* globalCtx) {
if ((this->unk_322 & 0x400) && !(gSaveContext.save.weekEventReg[23] & 0x20)) {
Actor_PickUp(&this->actor, globalCtx, GI_MAX, sp2C, sp28);
}
func_8013C964(&this->actor, globalCtx, sp2C, sp28, 0, this->unk_322 & 7);
func_8013C964(&this->actor, globalCtx, sp2C, sp28, EXCH_ITEM_NONE, this->unk_322 & 7);
Actor_SetFocus(&this->actor, 30.0f);
func_80B3CC80(this, globalCtx);
}

View File

@ -455,7 +455,7 @@ void EnDnq_Update(Actor* thisx, GlobalContext* globalCtx) {
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4);
this->unk_394 = this->actor.xzDistToPlayer;
func_80A52C6C(this, globalCtx);
func_8013C964(&this->actor, globalCtx, this->unk_390, fabsf(this->actor.playerHeightRel) + 1.0f, 0,
func_8013C964(&this->actor, globalCtx, this->unk_390, fabsf(this->actor.playerHeightRel) + 1.0f, EXCH_ITEM_NONE,
this->unk_37C & 7);
this->actor.xzDistToPlayer = this->unk_394;
Actor_SetFocus(&this->actor, 46.0f);

View File

@ -554,7 +554,7 @@ void EnDns_Update(Actor* thisx, GlobalContext* globalCtx) {
func_8092C934(this);
func_8092C86C(this, globalCtx);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4);
func_8013C964(&this->actor, globalCtx, 80.0f, 40.0f, 0, this->unk_2C6 & 7);
func_8013C964(&this->actor, globalCtx, 80.0f, 40.0f, EXCH_ITEM_NONE, this->unk_2C6 & 7);
Actor_SetFocus(&this->actor, 34.0f);
func_8092C6FC(this, globalCtx);
func_8092C5C0(this);

View File

@ -293,7 +293,7 @@ void EnDodongo_Init(Actor* thisx, GlobalContext* globalCtx) {
this->unk_330.r = 255;
this->unk_330.g = 10;
this->unk_330.a = 200;
Math_Vec3f_Copy(&this->unk_314, &D_801C5DB0);
Math_Vec3f_Copy(&this->unk_314, &gOneVec3f);
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 48.0f);
SkelAnime_Init(globalCtx, &this->skelAnime, &object_dodongo_Skel_008318, &object_dodongo_Anim_004C20,
this->jointTable, this->morphTable, 31);

View File

@ -1363,7 +1363,7 @@ s32 func_80950804(EnGm* this, GlobalContext* globalCtx) {
f32 temp_f0;
door = func_8094DF90(globalCtx, this->unk_258);
if (!func_8013AD6C(globalCtx) && (this->unk_3C4 != 0)) {
if (!SubS_InCsMode(globalCtx) && (this->unk_3C4 != 0)) {
if ((door != NULL) && (door->dyna.actor.update != NULL)) {
if ((this->unk_3BA / (f32)this->unk_3B8) <= 0.9f) {
door->unk_1A7 = this->unk_261;
@ -1412,7 +1412,7 @@ s32 func_8095097C(EnGm* this, GlobalContext* globalCtx) {
this->actor.world.pos.x = sp58.x;
this->actor.world.pos.z = sp58.z;
if (func_8013AD6C(globalCtx)) {
if (SubS_InCsMode(globalCtx)) {
sp54 = this->unk_254;
sp50 = this->unk_250;
sp58 = this->actor.world.pos;
@ -1429,7 +1429,7 @@ s32 func_8095097C(EnGm* this, GlobalContext* globalCtx) {
this->actor.world.rot.y = Math_Vec3f_Yaw(&sp70, &sp64);
}
if (func_8013AD6C(globalCtx)) {
if (SubS_InCsMode(globalCtx)) {
this->unk_254 = sp54;
this->unk_250 = sp50;
this->unk_238 = sp58;
@ -1626,7 +1626,7 @@ void EnGm_Update(Actor* thisx, GlobalContext* globalCtx) {
func_8094DFF8(this, globalCtx);
func_8094E2D0(this);
func_8094F2E8(this);
func_8013C964(&this->actor, globalCtx, this->unk_3B4, 30.0f, 0, this->unk_3A4 & 7);
func_8013C964(&this->actor, globalCtx, this->unk_3B4, 30.0f, EXCH_ITEM_NONE, this->unk_3A4 & 7);
if ((this->unk_258 != 3) && (this->unk_258 != 5) && (this->unk_258 != 8)) {
Actor_MoveWithGravity(&this->actor);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4);

View File

@ -1926,10 +1926,10 @@ void EnGo_Update(Actor* thisx, GlobalContext* globalCtx) {
} else {
phi_f0 = this->colliderCylinder.dim.radius + 40;
}
func_8013C964(&this->actor, globalCtx, phi_f0, 20.0f, 0, this->unk_390 & 7);
func_8013C964(&this->actor, globalCtx, phi_f0, 20.0f, EXCH_ITEM_NONE, this->unk_390 & 7);
} else if ((this->unk_390 & 0x200) && (this->unk_3EC != 0)) {
phi_f0 = this->colliderCylinder.dim.radius + 40;
func_8013C964(&this->actor, globalCtx, phi_f0, 20.0f, 0, this->unk_390 & 7);
func_8013C964(&this->actor, globalCtx, phi_f0, 20.0f, EXCH_ITEM_NONE, this->unk_390 & 7);
}
if ((ENGO_GET_F(&this->actor) != ENGO_F_8) && (ENGO_GET_F(&this->actor) != ENGO_F_2) &&

View File

@ -154,8 +154,8 @@ void EnGs_Init(Actor* thisx, GlobalContext* globalCtx) {
func_80997AFC(this->unk_194, &this->unk_1FA);
this->unk_1F4 = this->unk_1FA;
Math_Vec3f_Copy(&this->unk_1B0[0], &D_801C5DB0);
Math_Vec3f_Copy(&this->unk_1B0[1], &D_801C5DB0);
Math_Vec3f_Copy(&this->unk_1B0[0], &gOneVec3f);
Math_Vec3f_Copy(&this->unk_1B0[1], &gOneVec3f);
SubS_FillCutscenesList(&this->actor, this->unk_212, ARRAY_COUNT(this->unk_212));
func_801A5080(0);
if (this->actor.params == ENGS_1) {
@ -183,8 +183,8 @@ void func_80997D38(EnGs* this, GlobalContext* globalCtx) {
if (Message_GetState(&globalCtx->msgCtx) == 0) {
if (this->actor.xzDistToPlayer <= D_8099A408[this->actor.params]) {
func_8013E8F8(&this->actor, globalCtx, D_8099A408[this->actor.params], D_8099A408[this->actor.params], 0,
0x2000, 0x2000);
func_8013E8F8(&this->actor, globalCtx, D_8099A408[this->actor.params], D_8099A408[this->actor.params],
EXCH_ITEM_NONE, 0x2000, 0x2000);
}
}

View File

@ -702,7 +702,7 @@ s32 func_80BF2470(EnIg* this, GlobalContext* globalCtx) {
f32 temp;
s32 pad;
if (!func_8013AD6C(globalCtx) && (this->unk_3EC != 0)) {
if (!SubS_InCsMode(globalCtx) && (this->unk_3EC != 0)) {
if ((door != NULL) && (door->dyna.actor.update != NULL)) {
if (((f32)this->unk_3E2 / this->unk_3E0) <= 0.9f) {
door->unk_1A7 = this->unk_2A4;
@ -748,7 +748,7 @@ s32 func_80BF25E8(EnIg* this, GlobalContext* globalCtx) {
this->actor.world.pos.x = sp58.x;
this->actor.world.pos.z = sp58.z;
if (func_8013AD6C(globalCtx)) {
if (SubS_InCsMode(globalCtx)) {
sp54 = this->unk_294;
sp50 = this->unk_290;
sp58 = this->actor.world.pos;
@ -765,7 +765,7 @@ s32 func_80BF25E8(EnIg* this, GlobalContext* globalCtx) {
this->actor.world.rot.y = Math_Vec3f_Yaw(&sp70, &sp64);
}
if (func_8013AD6C(globalCtx)) {
if (SubS_InCsMode(globalCtx)) {
this->unk_294 = sp54;
this->unk_290 = sp50;
this->unk_278 = sp58;
@ -918,7 +918,7 @@ void EnIg_Update(Actor* thisx, GlobalContext* globalCtx) {
func_80BF1258(this);
func_80BF13E4(this);
func_80BF15EC(this);
func_8013C964(&this->actor, globalCtx, 60.0f, 30.0f, 0, this->unk_3D0 & 7);
func_8013C964(&this->actor, globalCtx, 60.0f, 30.0f, EXCH_ITEM_NONE, this->unk_3D0 & 7);
Actor_MoveWithGravity(&this->actor);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4);
func_80BF1354(this, globalCtx);

View File

@ -379,7 +379,7 @@ void EnJa_Update(Actor* thisx, GlobalContext* globalCtx) {
radius = this->collider.dim.radius + 30;
height = this->collider.dim.height + 10;
func_8013C964(&this->actor, globalCtx, radius, height, 0, this->unk_340 & 7);
func_8013C964(&this->actor, globalCtx, radius, height, EXCH_ITEM_NONE, this->unk_340 & 7);
if (this->unk_1D8.unk_00 != 2) {
Actor_MoveWithGravity(&this->actor);

View File

@ -1086,7 +1086,7 @@ s32 func_80AF94AC(EnPm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar
if (arg2->unk0 == 24) {
Flags_UnsetSwitch(globalCtx, 0);
Flags_UnsetSwitch(globalCtx, 1);
this->unk_394 = 0;
this->unk_394 = EXCH_ITEM_NONE;
this->unk_368 = 60.0f;
func_80AF7E98(this, 9);
}
@ -1274,7 +1274,7 @@ s32 func_80AF9BF8(EnPm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar
this->actor.flags |= ACTOR_FLAG_1;
this->actor.targetMode = 0;
this->unk_394 = 0;
this->unk_394 = EXCH_ITEM_NONE;
this->unk_356 = 0;
this->unk_368 = 40.0f;
@ -1409,7 +1409,7 @@ s32 func_80AF9D04(EnPm* this, GlobalContext* globalCtx) {
Vec3f* sp28;
f32 temp;
if (!func_8013AD6C(globalCtx) && (this->unk_374 != 0)) {
if (!SubS_InCsMode(globalCtx) && (this->unk_374 != 0)) {
if ((door != NULL) && (door->dyna.actor.update != NULL)) {
if (((f32)this->unk_36E / this->unk_36C) <= 0.9f) {
door->unk_1A7 = this->unk_260;
@ -1457,7 +1457,7 @@ s32 func_80AF9E7C(EnPm* this, GlobalContext* globalCtx) {
this->actor.world.pos.x = sp58.x;
this->actor.world.pos.z = sp58.z;
if (func_8013AD6C(globalCtx)) {
if (SubS_InCsMode(globalCtx)) {
sp54 = this->unk_254;
sp50 = this->unk_250;
sp58 = this->actor.world.pos;
@ -1474,7 +1474,7 @@ s32 func_80AF9E7C(EnPm* this, GlobalContext* globalCtx) {
this->actor.world.rot.y = Math_Vec3f_Yaw(&sp70, &sp64);
}
if (func_8013AD6C(globalCtx)) {
if (SubS_InCsMode(globalCtx)) {
this->unk_254 = sp54;
this->unk_250 = sp50;
this->unk_238 = sp58;

View File

@ -380,7 +380,7 @@ void EnShn_Update(Actor* thisx, GlobalContext* globalCtx) {
func_80AE6130(this);
func_80AE63A8(this, globalCtx);
this->unk_2E0 = 0;
func_8013C964(&this->actor, globalCtx, 120.0f, 40.0f, 0, this->unk_1D8 & 7);
func_8013C964(&this->actor, globalCtx, 120.0f, 40.0f, EXCH_ITEM_NONE, this->unk_1D8 & 7);
}
s32 EnShn_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {

View File

@ -758,7 +758,7 @@ s32 func_80BABFD4(EnSuttari* this, GlobalContext* globalCtx) {
}
this->actor.world.pos.x = sp58.x;
this->actor.world.pos.z = sp58.z;
if (func_8013AD6C(globalCtx)) {
if (SubS_InCsMode(globalCtx)) {
sp54 = this->unk424;
sp50 = this->unk420;
sp58 = this->actor.world.pos;
@ -772,7 +772,7 @@ s32 func_80BABFD4(EnSuttari* this, GlobalContext* globalCtx) {
sp64 = this->unk408;
this->actor.world.rot.y = Math_Vec3f_Yaw(&sp70, &sp64);
}
if (func_8013AD6C(globalCtx)) {
if (SubS_InCsMode(globalCtx)) {
this->unk424 = sp54;
this->unk420 = sp50;
this->unk408 = sp58;

View File

@ -541,7 +541,7 @@ void EnTab_Update(Actor* thisx, GlobalContext* globalCtx) {
radius = this->collider.dim.radius + this->unk_30C;
height = this->collider.dim.height + 10;
func_8013C964(&this->actor, globalCtx, radius, height, 0, this->unk_2FC & 7);
func_8013C964(&this->actor, globalCtx, radius, height, EXCH_ITEM_NONE, this->unk_2FC & 7);
Actor_MoveWithGravity(&this->actor);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 30.0f, 12.0f, 0.0f, 4);
func_80BE0620(this, globalCtx);

View File

@ -486,7 +486,7 @@ s32 func_80AECE60(EnTk* this, GlobalContext* globalCtx) {
}
if (!(this->unk_3CE & 8) && !(this->unk_2CA & 0x10) && (this->actor.xzDistToPlayer < 100.0f)) {
func_8013E8F8(&this->actor, globalCtx, 100.0f, 100.0f, 0, 0x4000, 0x4000);
func_8013E8F8(&this->actor, globalCtx, 100.0f, 100.0f, EXCH_ITEM_NONE, 0x4000, 0x4000);
}
return false;
@ -695,7 +695,7 @@ void func_80AED940(EnTk* this, GlobalContext* globalCtx) {
func_80AEDE10(this, globalCtx);
} else if (!(this->unk_2CA & 0x80)) {
if (this->actor.xzDistToPlayer < 100.0f) {
func_8013E8F8(&this->actor, globalCtx, 100.0f, 100.0f, 0, 0x4000, 0x4000);
func_8013E8F8(&this->actor, globalCtx, 100.0f, 100.0f, EXCH_ITEM_NONE, 0x4000, 0x4000);
}
} else {
func_800B8500(&this->actor, globalCtx, this->actor.xzDistToPlayer, this->actor.playerHeightRel, 0);

View File

@ -1130,7 +1130,7 @@ void EnTru_Init(Actor* thisx, GlobalContext* globalCtx) {
if (gSaveContext.save.weekEventReg[16] & 0x10) {
func_80A86924(this, 5);
} else {
this->unk_388 = 0;
this->unk_388 = EXCH_ITEM_NONE;
}
this->actionFunc = func_80A87FD0;
@ -1156,7 +1156,7 @@ void EnTru_Update(Actor* thisx, GlobalContext* globalCtx) {
func_80A86DB8(this);
radius = this->collider.dim.worldSphere.radius + 30;
this->unk_388 = !(this->unk_34E & 0x80) ? 0 : 0;
this->unk_388 = !(this->unk_34E & 0x80) ? EXCH_ITEM_NONE : EXCH_ITEM_NONE;
func_8013C964(&this->actor, globalCtx, radius, 20.0f, this->unk_388, this->unk_34E & 7);
func_80A8697C(this, globalCtx);

View File

@ -99,9 +99,9 @@ static AnimationInfoS sAnimations[] = {
{ &gZoraWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -4 },
};
s8 D_8099F578[] = { -1, 1, 12, 13, 14, 9, 10, 11, 0, 6, 7, 8, 3, 4, 5, 2, -1, -1, -1, -1 };
s8 D_8099F58C[] = { 0, 0, 0, 0, 3, 4, 0, 6, 7, 0, 9, 10, 0, 12, 13 };
u8 D_8099F59C[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
s8 sBodyParts[] = { -1, 1, 12, 13, 14, 9, 10, 11, 0, 6, 7, 8, 3, 4, 5, 2, -1, -1, -1, -1 };
s8 sParentBodyParts[] = { 0, 0, 0, 0, 3, 4, 0, 6, 7, 0, 9, 10, 0, 12, 13 };
u8 sShadowSizes[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
s32 EnZo_SetAnimation(SkelAnime* skelAnime, s16 index) {
s16 frameCount;
@ -310,8 +310,8 @@ void EnZo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec
Vec3f sp30 = { 400.0f, 0.0f, 0.0f };
Vec3f zeroVec = { 0.0f, 0.0f, 0.0f };
if (D_8099F578[limbIndex] >= 0) {
Matrix_MultiplyVector3fByState(&zeroVec, &this->unk_364[D_8099F578[limbIndex]]);
if (sBodyParts[limbIndex] >= 0) {
Matrix_MultiplyVector3fByState(&zeroVec, &this->bodyPartsPos[sBodyParts[limbIndex]]);
}
if (limbIndex == 15) {
Matrix_MultiplyVector3fByState(&sp30, &this->actor.focus.pos);
@ -336,9 +336,9 @@ static Gfx sTransparencyDlist[] = {
void EnZo_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnZo* this = THIS;
s32 i;
u8* shadowTex = GRAPH_ALLOC(globalCtx->state.gfxCtx, sizeof(u8) * SQ(64));
u8* shadowTex = GRAPH_ALLOC(globalCtx->state.gfxCtx, SUBS_SHADOW_TEX_SIZE);
u8* shadowTexIter;
TexturePtr eyeTextures[] = { &gZoraEyeOpenTex, &gZoraEyeHalfTex, &gZoraEyeClosedTex };
TexturePtr eyeTextures[] = { gZoraEyeOpenTex, gZoraEyeHalfTex, gZoraEyeClosedTex };
OPEN_DISPS(globalCtx->state.gfxCtx);
func_8012C28C(globalCtx->state.gfxCtx);
@ -354,14 +354,15 @@ void EnZo_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnZo_OverrideLimbDraw, EnZo_PostLimbDraw, &this->actor, POLY_OPA_DISP);
Matrix_InsertXRotation_s(0, 0);
for (i = 0, shadowTexIter = shadowTex; i < (s32)sizeof(u8) * SQ(64); i++) {
for (i = 0, shadowTexIter = shadowTex; i < SUBS_SHADOW_TEX_SIZE; i++) {
*shadowTexIter = 0;
shadowTexIter++;
}
for (i = 0; i < 5; i++) {
func_8013CD64(this->unk_364, &this->actor.world.pos, shadowTex, i / 5.0f, 15, D_8099F59C, D_8099F58C);
SubS_GenShadowTex(this->bodyPartsPos, &this->actor.world.pos, shadowTex, i / 5.0f,
ARRAY_COUNT(this->bodyPartsPos), sShadowSizes, sParentBodyParts);
}
func_8013CF04(&this->actor, &globalCtx->state.gfxCtx, shadowTex);
SubS_DrawShadowTex(&this->actor, &globalCtx->state, shadowTex);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}

View File

@ -30,7 +30,7 @@ typedef struct EnZo {
/* 0x0300 */ UNK_TYPE1 unk_300[0x12];
/* 0x0312 */ s16 limbRotY[20];
/* 0x033A */ s16 limbRotZ[20];
/* 0x0364 */ Vec3f unk_364[15];
/* 0x0364 */ Vec3f bodyPartsPos[15];
/* 0x041A */ UNK_TYPE1 unk_41A[0x6];
/* 0x041E */ s16 eyeIndex;
/* 0x0420 */ s16 blinkTimer;

View File

@ -2658,7 +2658,7 @@
0x8013A7C0:("SubS_FindDoor",),
0x8013A860:("SubS_DrawTransformFlexLimb",),
0x8013AB00:("SubS_DrawTransformFlex",),
0x8013AD6C:("func_8013AD6C",),
0x8013AD6C:("SubS_InCsMode",),
0x8013AD9C:("func_8013AD9C",),
0x8013AED4:("SubS_UpdateFlags",),
0x8013AF00:("func_8013AF00",),
@ -2676,9 +2676,9 @@
0x8013C624:("func_8013C624",),
0x8013C8B8:("SubS_CopyPointFromPathCheckBounds",),
0x8013C964:("func_8013C964",),
0x8013CC2C:("func_8013CC2C",),
0x8013CD64:("func_8013CD64",),
0x8013CF04:("func_8013CF04",),
0x8013CC2C:("SubS_FillShadowTex",),
0x8013CD64:("SubS_GenShadowTex",),
0x8013CF04:("SubS_DrawShadowTex",),
0x8013D0E0:("func_8013D0E0",),
0x8013D2E0:("func_8013D2E0",),
0x8013D5E8:("SubS_AngleDiffLessEqual",),
@ -2703,11 +2703,11 @@
0x8013E1C8:("SubS_ChangeAnimationBySpeedInfo",),
0x8013E2D4:("SubS_StartActorCutscene",),
0x8013E3B8:("SubS_FillCutscenesList",),
0x8013E4B0:("func_8013E4B0",),
0x8013E5CC:("func_8013E5CC",),
0x8013E4B0:("SubS_ConstructPlane",),
0x8013E5CC:("SubS_LineSegVsPlane",),
0x8013E640:("SubS_FindActorCustom",),
0x8013E748:("func_8013E748",),
0x8013E7C0:("func_8013E7C0",),
0x8013E7C0:("SubS_ActorAndPlayerFaceEachOther",),
0x8013E8F8:("func_8013E8F8",),
0x8013E950:("func_8013E950",),
0x8013EC10:("func_8013EC10",),

View File

@ -920,8 +920,8 @@
0x801BC288:("D_801BC288","Gfx","[3]",0x18),
0x801BC2A0:("D_801BC2A0","UNK_TYPE1","",0x1),
0x801BC3F0:("gEnHyBodyParts","UNK_TYPE1","",0x1),
0x801BC400:("gEnHyBodyPartsIndex","UNK_TYPE1","",0x1),
0x801BC410:("gEnHyShadowSize","s32",[],0x10),
0x801BC400:("gEnHyParentBodyParts","UNK_TYPE1","",0x1),
0x801BC410:("gEnHyShadowSizes","s32",[],0x10),
0x801BC420:("sReactionTextIds","u16","[]",0x140A),
0x801BD830:("actorCutscenesGlobalCutscenes","ActorCutscene","[8]",0x80),
0x801BD8B0:("actorCutsceneCurrent","s16","",0x2),
@ -1971,9 +1971,9 @@
0x801C5CD0:("sMtxFClear","MtxF","",0x40),
0x801C5D10:("D_801C5D10","UNK_TYPE1","",0x1),
0x801C5D20:("D_801C5D20","UNK_TYPE1","",0x1),
0x801C5D60:("D_801C5D60","UNK_TYPE1","",0x1),
0x801C5D80:("D_801C5D80","UNK_TYPE1","",0x1),
0x801C5DB0:("D_801C5DB0","UNK_TYPE1","",0x1),
0x801C5D60:("gShadowDL","UNK_TYPE1","",0x1),
0x801C5D80:("gShadowVtxDL","UNK_TYPE1","",0x1),
0x801C5DB0:("gOneVec3f","UNK_TYPE1","",0x1),
0x801C5DD0:("D_801C5DD0","UNK_TYPE1","",0x1),
0x801C5DE0:("D_801C5DE0","UNK_TYPE1","",0x1),
0x801C5DF0:("D_801C5DF0","UNK_TYPE1","",0x1),

View File

@ -2172,7 +2172,7 @@ asm/non_matchings/code/z_snap/func_8013A530.s,func_8013A530,0x8013A530,0xA4
asm/non_matchings/code/z_sub_s/SubS_FindDoor.s,SubS_FindDoor,0x8013A7C0,0x28
asm/non_matchings/code/z_sub_s/SubS_DrawTransformFlexLimb.s,SubS_DrawTransformFlexLimb,0x8013A860,0xA8
asm/non_matchings/code/z_sub_s/SubS_DrawTransformFlex.s,SubS_DrawTransformFlex,0x8013AB00,0x9B
asm/non_matchings/code/z_sub_s/func_8013AD6C.s,func_8013AD6C,0x8013AD6C,0xC
asm/non_matchings/code/z_sub_s/SubS_InCsMode.s,SubS_InCsMode,0x8013AD6C,0xC
asm/non_matchings/code/z_sub_s/func_8013AD9C.s,func_8013AD9C,0x8013AD9C,0x4E
asm/non_matchings/code/z_sub_s/SubS_UpdateFlags.s,SubS_UpdateFlags,0x8013AED4,0xB
asm/non_matchings/code/z_sub_s/func_8013AF00.s,func_8013AF00,0x8013AF00,0x44
@ -2190,9 +2190,9 @@ asm/non_matchings/code/z_sub_s/func_8013C068.s,func_8013C068,0x8013C068,0x16F
asm/non_matchings/code/z_sub_s/func_8013C624.s,func_8013C624,0x8013C624,0xA5
asm/non_matchings/code/z_sub_s/SubS_CopyPointFromPathCheckBounds.s,SubS_CopyPointFromPathCheckBounds,0x8013C8B8,0x2B
asm/non_matchings/code/z_sub_s/func_8013C964.s,func_8013C964,0x8013C964,0xB2
asm/non_matchings/code/z_sub_s/func_8013CC2C.s,func_8013CC2C,0x8013CC2C,0x4E
asm/non_matchings/code/z_sub_s/func_8013CD64.s,func_8013CD64,0x8013CD64,0x68
asm/non_matchings/code/z_sub_s/func_8013CF04.s,func_8013CF04,0x8013CF04,0x77
asm/non_matchings/code/z_sub_s/SubS_FillShadowTex.s,SubS_FillShadowTex,0x8013CC2C,0x4E
asm/non_matchings/code/z_sub_s/SubS_GenShadowTex.s,SubS_GenShadowTex,0x8013CD64,0x68
asm/non_matchings/code/z_sub_s/SubS_DrawShadowTex.s,SubS_DrawShadowTex,0x8013CF04,0x77
asm/non_matchings/code/z_sub_s/func_8013D0E0.s,func_8013D0E0,0x8013D0E0,0x80
asm/non_matchings/code/z_sub_s/func_8013D2E0.s,func_8013D2E0,0x8013D2E0,0xC2
asm/non_matchings/code/z_sub_s/SubS_AngleDiffLessEqual.s,SubS_AngleDiffLessEqual,0x8013D5E8,0x18
@ -2217,11 +2217,11 @@ asm/non_matchings/code/z_sub_s/SubS_ActorPathing_SetNextPoint.s,SubS_ActorPathin
asm/non_matchings/code/z_sub_s/SubS_ChangeAnimationBySpeedInfo.s,SubS_ChangeAnimationBySpeedInfo,0x8013E1C8,0x43
asm/non_matchings/code/z_sub_s/SubS_StartActorCutscene.s,SubS_StartActorCutscene,0x8013E2D4,0x39
asm/non_matchings/code/z_sub_s/SubS_FillCutscenesList.s,SubS_FillCutscenesList,0x8013E3B8,0x3E
asm/non_matchings/code/z_sub_s/func_8013E4B0.s,func_8013E4B0,0x8013E4B0,0x47
asm/non_matchings/code/z_sub_s/func_8013E5CC.s,func_8013E5CC,0x8013E5CC,0x1D
asm/non_matchings/code/z_sub_s/SubS_ConstructPlane.s,SubS_ConstructPlane,0x8013E4B0,0x47
asm/non_matchings/code/z_sub_s/SubS_LineSegVsPlane.s,SubS_LineSegVsPlane,0x8013E5CC,0x1D
asm/non_matchings/code/z_sub_s/SubS_FindActorCustom.s,SubS_FindActorCustom,0x8013E640,0x42
asm/non_matchings/code/z_sub_s/func_8013E748.s,func_8013E748,0x8013E748,0x1E
asm/non_matchings/code/z_sub_s/func_8013E7C0.s,func_8013E7C0,0x8013E7C0,0x4E
asm/non_matchings/code/z_sub_s/SubS_ActorAndPlayerFaceEachOther.s,SubS_ActorAndPlayerFaceEachOther,0x8013E7C0,0x4E
asm/non_matchings/code/z_sub_s/func_8013E8F8.s,func_8013E8F8,0x8013E8F8,0x16
asm/non_matchings/code/z_sub_s/func_8013E950.s,func_8013E950,0x8013E950,0xB0
asm/non_matchings/code/code_8013EC10/func_8013EC10.s,func_8013EC10,0x8013EC10,0xD

1 asm/non_matchings/code/z_en_a_keep/EnAObj_Init.s EnAObj_Init 0x800A5AC0 0x2B
2172 asm/non_matchings/code/z_sub_s/SubS_FindDoor.s SubS_FindDoor 0x8013A7C0 0x28
2173 asm/non_matchings/code/z_sub_s/SubS_DrawTransformFlexLimb.s SubS_DrawTransformFlexLimb 0x8013A860 0xA8
2174 asm/non_matchings/code/z_sub_s/SubS_DrawTransformFlex.s SubS_DrawTransformFlex 0x8013AB00 0x9B
2175 asm/non_matchings/code/z_sub_s/func_8013AD6C.s asm/non_matchings/code/z_sub_s/SubS_InCsMode.s func_8013AD6C SubS_InCsMode 0x8013AD6C 0xC
2176 asm/non_matchings/code/z_sub_s/func_8013AD9C.s func_8013AD9C 0x8013AD9C 0x4E
2177 asm/non_matchings/code/z_sub_s/SubS_UpdateFlags.s SubS_UpdateFlags 0x8013AED4 0xB
2178 asm/non_matchings/code/z_sub_s/func_8013AF00.s func_8013AF00 0x8013AF00 0x44
2190 asm/non_matchings/code/z_sub_s/func_8013C624.s func_8013C624 0x8013C624 0xA5
2191 asm/non_matchings/code/z_sub_s/SubS_CopyPointFromPathCheckBounds.s SubS_CopyPointFromPathCheckBounds 0x8013C8B8 0x2B
2192 asm/non_matchings/code/z_sub_s/func_8013C964.s func_8013C964 0x8013C964 0xB2
2193 asm/non_matchings/code/z_sub_s/func_8013CC2C.s asm/non_matchings/code/z_sub_s/SubS_FillShadowTex.s func_8013CC2C SubS_FillShadowTex 0x8013CC2C 0x4E
2194 asm/non_matchings/code/z_sub_s/func_8013CD64.s asm/non_matchings/code/z_sub_s/SubS_GenShadowTex.s func_8013CD64 SubS_GenShadowTex 0x8013CD64 0x68
2195 asm/non_matchings/code/z_sub_s/func_8013CF04.s asm/non_matchings/code/z_sub_s/SubS_DrawShadowTex.s func_8013CF04 SubS_DrawShadowTex 0x8013CF04 0x77
2196 asm/non_matchings/code/z_sub_s/func_8013D0E0.s func_8013D0E0 0x8013D0E0 0x80
2197 asm/non_matchings/code/z_sub_s/func_8013D2E0.s func_8013D2E0 0x8013D2E0 0xC2
2198 asm/non_matchings/code/z_sub_s/SubS_AngleDiffLessEqual.s SubS_AngleDiffLessEqual 0x8013D5E8 0x18
2217 asm/non_matchings/code/z_sub_s/SubS_ChangeAnimationBySpeedInfo.s SubS_ChangeAnimationBySpeedInfo 0x8013E1C8 0x43
2218 asm/non_matchings/code/z_sub_s/SubS_StartActorCutscene.s SubS_StartActorCutscene 0x8013E2D4 0x39
2219 asm/non_matchings/code/z_sub_s/SubS_FillCutscenesList.s SubS_FillCutscenesList 0x8013E3B8 0x3E
2220 asm/non_matchings/code/z_sub_s/func_8013E4B0.s asm/non_matchings/code/z_sub_s/SubS_ConstructPlane.s func_8013E4B0 SubS_ConstructPlane 0x8013E4B0 0x47
2221 asm/non_matchings/code/z_sub_s/func_8013E5CC.s asm/non_matchings/code/z_sub_s/SubS_LineSegVsPlane.s func_8013E5CC SubS_LineSegVsPlane 0x8013E5CC 0x1D
2222 asm/non_matchings/code/z_sub_s/SubS_FindActorCustom.s SubS_FindActorCustom 0x8013E640 0x42
2223 asm/non_matchings/code/z_sub_s/func_8013E748.s func_8013E748 0x8013E748 0x1E
2224 asm/non_matchings/code/z_sub_s/func_8013E7C0.s asm/non_matchings/code/z_sub_s/SubS_ActorAndPlayerFaceEachOther.s func_8013E7C0 SubS_ActorAndPlayerFaceEachOther 0x8013E7C0 0x4E
2225 asm/non_matchings/code/z_sub_s/func_8013E8F8.s func_8013E8F8 0x8013E8F8 0x16
2226 asm/non_matchings/code/z_sub_s/func_8013E950.s func_8013E950 0x8013E950 0xB0
2227 asm/non_matchings/code/code_8013EC10/func_8013EC10.s func_8013EC10 0x8013EC10 0xD