mirror of https://github.com/zeldaret/mm.git
Code_800f07c0 OK with some documentation (#373)
* Matched func_800F07C0 * Matched func_800F0888 * Matched func_800F0944 * Matched func_800F09B4 * Matched func_800F0A94 * Matched func_800F0E94 * Matched func_800F0EEC * Matched func_800F0F28 * Matched func_800F0FF0 * Matched func_800F10AC * Matched func_800F112C * Matched func_800F0DD4 * Matched func_800F0CE4 * Matched func_800F0A20 * Matched func_800F0BB4 * Fix functions.h * Migrated data and add some doc comments, having BSS issues * BSS fix * Fix merge conflict * Document * Run Formatter * Actually save functions.h * Rename UnusedNPC to EnHy * Change some rets and run format * PR review * Fix merge conflict * Minor touchups * Fix renamed func * Change char to UNK_TYPE1 * Add header * Rename two functions * Fix capital X's in undefined_syms * Convert char to UNK_TYPE1 in EnDoor * Change huge ternary into if else for readability * Fix up EnIn * Better whitespace * Format * Revert UNK_TYPE1s in EnDoor * Rename file * Missed rename in undefined_syms
This commit is contained in:
parent
1274b81c5e
commit
a7cece0fca
|
|
@ -1584,21 +1584,21 @@ void func_800F048C(GlobalContext* globalCtx, Vec3f* param_2, u8 param_3, u16 par
|
|||
void Audio_PlaySoundAtPosition(GlobalContext* globalCtx, Vec3f* position, s32 param_3, u16 sfxId);
|
||||
void func_800F0590(GlobalContext* globalCtx, Vec3f* arg1, s32 arg2, s32 arg3);
|
||||
u16 ElfMessage_GetFirstCycleHint(GlobalContext* globalCtx);
|
||||
// void func_800F07C0(void);
|
||||
// void func_800F0888(void);
|
||||
// void func_800F0944(void);
|
||||
// void func_800F09B4(void);
|
||||
// void func_800F0A20(void);
|
||||
// void func_800F0A94(void);
|
||||
// void func_800F0BB4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5);
|
||||
// void func_800F0CE4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE4 param_6);
|
||||
// void func_800F0DD4(void);
|
||||
// void func_800F0E94(void);
|
||||
// void func_800F0EEC(void);
|
||||
// void func_800F0F28(void);
|
||||
// void func_800F0FF0(void);
|
||||
// void func_800F10AC(void);
|
||||
// void func_800F112C(void);
|
||||
s32 EnHy_ChangeAnim(SkelAnime* skelAnime, s16 animIndex);
|
||||
Actor* EnHy_FindNearestDoor(Actor* actor, GlobalContext* globalCtx);
|
||||
void EnHy_ChangeObjectAndAnim(EnHy* enHy, GlobalContext* globalCtx, s16 animIndex);
|
||||
s32 EnHy_UpdateSkelAnime(EnHy* enHy, GlobalContext* globalCtx);
|
||||
void EnHy_Blink(EnHy* enHy, s32 arg1);
|
||||
s32 EnHy_Init(EnHy* enHy, GlobalContext* globalCtx, FlexSkeletonHeader* skeletonHeaderSeg, s16 animIndex);
|
||||
void func_800F0BB4(EnHy* enHy, GlobalContext* globalCtx, Actor* arg2, s16 arg3, s16 arg4);
|
||||
s32 func_800F0CE4(EnHy* enHy, GlobalContext* globalCtx, ActorFunc draw, s16 arg3, s16 arg4, f32 arg5);
|
||||
s32 func_800F0DD4(EnHy* enHy, GlobalContext* globalCtx, s16 arg2, s16 arg3);
|
||||
s32 EnHy_SetPointFowards(EnHy* enHy, GlobalContext* globalCtx, f32 gravity, s16 animIndex);
|
||||
s32 EnHy_SetPointBackwards(EnHy* enHy, GlobalContext* globalCtx, s16 animIndex);
|
||||
s32 EnHy_MoveForwards(EnHy* enHy, f32 arg1);
|
||||
s32 EnHy_MoveBackwards(EnHy* enHy, f32 arg1);
|
||||
void EnHy_UpdateCollider(EnHy* enHy, GlobalContext* globalCtx);
|
||||
s32 EnHy_PlayWalkingSound(EnHy* enHy, GlobalContext* globalCtx, f32 arg2);
|
||||
u16 Text_GetFaceReaction(GlobalContext* globalCtx, u32 reactionSet);
|
||||
void EnvFlags_UnsetAll(GlobalContext* globalCtx);
|
||||
void EnvFlags_Set(GlobalContext* globalCtx, s16 flag);
|
||||
|
|
@ -2667,7 +2667,7 @@ s8 func_8013D8DC(s8 arg0, GlobalContext* globalCtx);
|
|||
s8 func_8013D924(s16 arg0, GlobalContext* globalCtx);
|
||||
Actor* func_ActorCategoryIterateById(GlobalContext* globalCtx, Actor* actorListStart, u8 actorCategory, s16 actorId);
|
||||
s32 func_8013D9C8(GlobalContext* globalCtx, s16* arg1, s16* arg2, s32 arg3);
|
||||
u8 func_8013DB90(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2);
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -889,7 +889,6 @@ extern s801BB170 D_801BB170[118];
|
|||
// extern UNK_TYPE1 D_801BC210;
|
||||
extern Gfx D_801BC240[9];
|
||||
extern Gfx D_801BC288[3];
|
||||
// extern UNK_TYPE1 D_801BC2A0;
|
||||
// extern UNK_TYPE1 D_801BC3F0;
|
||||
// extern UNK_TYPE1 D_801BC400;
|
||||
// extern UNK_TYPE1 D_801BC410;
|
||||
|
|
|
|||
|
|
@ -1462,6 +1462,30 @@ typedef struct {
|
|||
/* 0x24 */ s16 unk_24;
|
||||
} struct_800BD888_arg1; // size = 0x28
|
||||
|
||||
typedef struct EnHy {
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x144 */ UNK_TYPE1 unk_144[0x8];
|
||||
/* 0x14C */ SkelAnime skelAnime;
|
||||
/* 0x190 */ s8 unk190;
|
||||
/* 0x191 */ s8 unk191;
|
||||
/* 0x192 */ s8 unk192;
|
||||
/* 0x193 */ s8 animObjIndex;
|
||||
/* 0x194 */ ColliderCylinder collider;
|
||||
/* 0x1E0 */ UNK_TYPE1 unk_1E0[0x4];
|
||||
/* 0x1E4 */ Path* path;
|
||||
/* 0x1E8 */ s16 curPoint;
|
||||
/* 0x1EA */ UNK_TYPE1 unk_1EA[0x2];
|
||||
/* 0x1EC */ Vec3f leftFootPos;
|
||||
/* 0x1F8 */ Vec3f rightFootPos;
|
||||
/* 0x204 */ u8 isLeftFootOnGround;
|
||||
/* 0x205 */ u8 isRightFootOnGround;
|
||||
/* 0x206 */ Vec3s jointTable[16];
|
||||
/* 0x266 */ Vec3s morphTable[16];
|
||||
/* 0x2C6 */ UNK_TYPE1 unk_2C6[0x120];
|
||||
/* 0x3E6 */ s16 eyeTexIndex;
|
||||
/* 0x3E8 */ s16 blinkTimer;
|
||||
} EnHy;
|
||||
|
||||
typedef struct {
|
||||
/* 0x0 */ u8 unk0;
|
||||
/* 0x4 */ s32 unk4;
|
||||
|
|
|
|||
3
spec
3
spec
|
|
@ -473,8 +473,7 @@ beginseg
|
|||
include "build/data/code/z_eff_footmark.data.o"
|
||||
include "build/src/code/code_800F0390.o"
|
||||
include "build/src/code/z_elf_message.o"
|
||||
include "build/src/code/code_800F07C0.o"
|
||||
include "build/data/code/code_801BC2A0.data.o"
|
||||
include "build/src/code/z_en_hy.o"
|
||||
include "build/src/code/z_face_reaction.o"
|
||||
include "build/src/code/z_env_flags.o"
|
||||
include "build/src/code/z_eventmgr.o"
|
||||
|
|
|
|||
|
|
@ -1,31 +0,0 @@
|
|||
#include "global.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F07C0/func_800F07C0.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F07C0/func_800F0888.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F07C0/func_800F0944.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F07C0/func_800F09B4.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F07C0/func_800F0A20.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F07C0/func_800F0A94.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F07C0/func_800F0BB4.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F07C0/func_800F0CE4.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F07C0/func_800F0DD4.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F07C0/func_800F0E94.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F07C0/func_800F0EEC.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F07C0/func_800F0F28.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F07C0/func_800F0FF0.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F07C0/func_800F10AC.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F07C0/func_800F112C.s")
|
||||
|
|
@ -0,0 +1,271 @@
|
|||
/*
|
||||
* File: z_en_hy.c
|
||||
* Description: Unused System for NPCs (includes animation, door interaction, blinking, pathing, and collider helpers)
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#include "overlays/actors/ovl_En_Door/z_en_door.h"
|
||||
|
||||
extern AnimationHeader D_0600007C;
|
||||
extern AnimationHeader D_0600066C;
|
||||
extern AnimationHeader D_0600071C;
|
||||
extern AnimationHeader D_060008C0;
|
||||
extern AnimationHeader D_06000AB0;
|
||||
extern AnimationHeader D_06000FDC;
|
||||
extern AnimationHeader D_06001494;
|
||||
extern AnimationHeader D_06001908;
|
||||
extern AnimationHeader D_06001EE0;
|
||||
extern AnimationHeader D_06005DC4;
|
||||
extern AnimationHeader D_06005D9C;
|
||||
extern AnimationHeader D_0600DED8;
|
||||
extern AnimationHeader D_0600F920;
|
||||
extern AnimationHeader D_0600FC1C;
|
||||
extern AnimationHeader D_0600FEE4;
|
||||
extern AnimationHeader D_06010330;
|
||||
|
||||
static ActorAnimationEntryS animations[] = {
|
||||
{ &D_0600007C, 1.0f, 0, -1, 0, 0 }, { &D_06001494, 1.0f, 0, -1, 0, 0 }, { &D_06001494, 1.0f, 0, -1, 0, -8 },
|
||||
{ &D_06001908, 1.0f, 0, -1, 0, 0 }, { &D_06001908, 1.0f, 0, -1, 0, -8 }, { &D_060008C0, 1.0f, 0, -1, 0, 0 },
|
||||
{ &D_06005DC4, 1.0f, 0, -1, 0, 0 }, { &D_06000FDC, 1.0f, 0, -1, 0, 0 }, { &D_06000AB0, 1.0f, 0, -1, 0, -8 },
|
||||
{ &D_0600066C, 1.0f, 0, -1, 0, 0 }, { &D_0600071C, 1.0f, 0, -1, 0, 0 }, { &D_06001EE0, 1.0f, 0, -1, 0, 0 },
|
||||
{ &D_0600DED8, 1.5f, 0, -1, 2, 0 }, { &D_0600F920, 1.5f, 0, -1, 2, 0 }, { &D_0600FC1C, 1.0f, 0, -1, 0, 0 },
|
||||
{ &D_0600FEE4, 1.0f, 0, -1, 0, 0 }, { &D_06010330, 1.0f, 0, -1, 0, 0 }, { &D_0600FC1C, 1.0f, 0, -1, 0, -8 },
|
||||
{ &D_0600FEE4, 1.0f, 0, -1, 0, -8 }, { &D_06010330, 1.0f, 0, -1, 0, -8 }, { &D_06005D9C, 1.0f, 0, -1, 0, -8 },
|
||||
};
|
||||
|
||||
s8 D_801BC3F0[] = { -1, 1, 12, 13, 14, 9, 10, 11, 0, 6, 7, 8, 3, 4, 5, 2 };
|
||||
|
||||
s8 D_801BC400[] = { 0, 0, 0, 0, 3, 4, 0, 6, 7, 0, 9, 10, 0, 12, 13, 0 };
|
||||
|
||||
u8 D_801BC410[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
s32 EnHy_ChangeAnim(SkelAnime* skelAnime, s16 animIndex) {
|
||||
s16 frameCount;
|
||||
s32 isChanged = false;
|
||||
|
||||
if (animIndex >= 0 && animIndex <= 20) {
|
||||
isChanged = true;
|
||||
frameCount = animations[animIndex].frameCount;
|
||||
if (frameCount < 0) {
|
||||
frameCount = Animation_GetLastFrame(&animations[animIndex].animationSeg->common);
|
||||
}
|
||||
Animation_Change(skelAnime, animations[animIndex].animationSeg, animations[animIndex].playbackSpeed,
|
||||
animations[animIndex].frame, frameCount, animations[animIndex].mode,
|
||||
animations[animIndex].transitionRate);
|
||||
}
|
||||
return isChanged;
|
||||
}
|
||||
|
||||
//! @TODO: Return Door instance when c and h files are split
|
||||
Actor* EnHy_FindNearestDoor(Actor* actor, GlobalContext* globalCtx) {
|
||||
Actor* nearestDoor = NULL;
|
||||
Actor* doorIter = NULL;
|
||||
Actor* door;
|
||||
f32 dist;
|
||||
s32 isSetup = false;
|
||||
f32 minDist = 0.0f;
|
||||
|
||||
do {
|
||||
doorIter = func_ActorCategoryIterateById(globalCtx, doorIter, ACTORCAT_DOOR, ACTOR_EN_DOOR);
|
||||
door = doorIter;
|
||||
dist = Actor_DistanceBetweenActors(actor, door);
|
||||
if (!isSetup || (dist < minDist)) {
|
||||
nearestDoor = door;
|
||||
minDist = dist;
|
||||
isSetup = true;
|
||||
}
|
||||
doorIter = door->next;
|
||||
} while (doorIter != NULL);
|
||||
|
||||
if (1) {}
|
||||
|
||||
return nearestDoor;
|
||||
}
|
||||
|
||||
void EnHy_ChangeObjectAndAnim(EnHy* enHy, GlobalContext* globalCtx, s16 animIndex) {
|
||||
gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[enHy->animObjIndex].segment);
|
||||
EnHy_ChangeAnim(&enHy->skelAnime, animIndex);
|
||||
}
|
||||
|
||||
s32 EnHy_UpdateSkelAnime(EnHy* enHy, GlobalContext* globalCtx) {
|
||||
s32 isUpdated = false;
|
||||
|
||||
if (enHy->actor.draw != NULL) {
|
||||
gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[enHy->animObjIndex].segment);
|
||||
SkelAnime_Update(&enHy->skelAnime);
|
||||
isUpdated = true;
|
||||
}
|
||||
return isUpdated;
|
||||
}
|
||||
|
||||
void EnHy_Blink(EnHy* enHy, s32 eyeTexMaxIndex) {
|
||||
if (DECR(enHy->blinkTimer) == 0) {
|
||||
enHy->eyeTexIndex++;
|
||||
if (enHy->eyeTexIndex >= eyeTexMaxIndex) {
|
||||
enHy->eyeTexIndex = 0;
|
||||
enHy->blinkTimer = Rand_S16Offset(30, 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s32 EnHy_Init(EnHy* enHy, GlobalContext* globalCtx, FlexSkeletonHeader* skeletonHeaderSeg, s16 animIndex) {
|
||||
s32 isInitialized = false;
|
||||
|
||||
if ((func_8013D8DC(enHy->animObjIndex, globalCtx) == 1) && (func_8013D8DC(enHy->unk190, globalCtx) == 1) &&
|
||||
(func_8013D8DC(enHy->unk191, globalCtx) == 1) && (func_8013D8DC(enHy->unk192, globalCtx) == 1)) {
|
||||
enHy->actor.objBankIndex = enHy->unk192;
|
||||
isInitialized = true;
|
||||
ActorShape_Init(&enHy->actor.shape, 0.0f, NULL, 0.0f);
|
||||
gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[enHy->actor.objBankIndex].segment);
|
||||
SkelAnime_InitFlex(globalCtx, &enHy->skelAnime, skeletonHeaderSeg, NULL, enHy->jointTable, enHy->morphTable,
|
||||
16);
|
||||
EnHy_ChangeObjectAndAnim(enHy, globalCtx, animIndex);
|
||||
}
|
||||
return isInitialized;
|
||||
}
|
||||
|
||||
//! @TODO: Should just take EnDoor instead of actor when c and h are split
|
||||
void func_800F0BB4(EnHy* enHy, GlobalContext* globalCtx, Actor* door, s16 arg3, s16 arg4) {
|
||||
s32 pad;
|
||||
s8 sp3B;
|
||||
Vec3f offset;
|
||||
f32 phi_f0;
|
||||
|
||||
Actor_CalcOffsetOrientedToDrawRotation(door, &offset, &enHy->actor.world.pos);
|
||||
phi_f0 = (offset.z >= 0.0f) ? 1.0f : -1.0f;
|
||||
sp3B = ((s8)phi_f0 < 0) ? 0 : 2;
|
||||
EnHy_ChangeObjectAndAnim(enHy, globalCtx, (sp3B == 0) ? arg3 : arg4);
|
||||
enHy->skelAnime.baseTransl = *enHy->skelAnime.jointTable;
|
||||
enHy->skelAnime.prevTransl = *enHy->skelAnime.jointTable;
|
||||
enHy->skelAnime.moveFlags |= 3;
|
||||
AnimationContext_SetMoveActor(globalCtx, &enHy->actor, &enHy->skelAnime, 1.0f);
|
||||
((EnDoor*)door)->unk_1A1 = 1;
|
||||
((EnDoor*)door)->unk_1A0 = sp3B;
|
||||
}
|
||||
|
||||
s32 func_800F0CE4(EnHy* enHy, GlobalContext* globalCtx, ActorFunc draw, s16 arg3, s16 arg4, f32 arg5) {
|
||||
s32 ret = false;
|
||||
s16 yaw;
|
||||
Actor* door;
|
||||
s32 pad;
|
||||
|
||||
if (func_8013D68C(enHy->path, enHy->curPoint, &enHy->actor.world.pos)) {
|
||||
door = EnHy_FindNearestDoor(&enHy->actor, globalCtx);
|
||||
if (door != NULL) {
|
||||
ret = true;
|
||||
func_800F0BB4(enHy, globalCtx, door, arg3, arg4);
|
||||
yaw = Math_Vec3f_Yaw(&enHy->actor.world.pos, &door->world.pos);
|
||||
enHy->actor.world.pos.x += arg5 * Math_SinS(yaw);
|
||||
enHy->actor.world.pos.z += arg5 * Math_CosS(yaw);
|
||||
enHy->actor.world.rot.y = -yaw;
|
||||
enHy->actor.shape.rot.y = -yaw;
|
||||
enHy->actor.draw = draw;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 func_800F0DD4(EnHy* enHy, GlobalContext* globalCtx, s16 arg2, s16 arg3) {
|
||||
s32 ret = false;
|
||||
s32 pad;
|
||||
Actor* door;
|
||||
|
||||
enHy->curPoint = 0;
|
||||
if (func_8013D68C(enHy->path, enHy->curPoint, &enHy->actor.world.pos)) {
|
||||
door = EnHy_FindNearestDoor(&enHy->actor, globalCtx);
|
||||
if (door != NULL) {
|
||||
ret = true;
|
||||
func_800F0BB4(enHy, globalCtx, door, arg2, arg3);
|
||||
enHy->actor.shape.rot.y = Math_Vec3f_Yaw(&enHy->actor.world.pos, &door->world.pos);
|
||||
enHy->actor.world.rot.y = enHy->actor.shape.rot.y;
|
||||
enHy->actor.gravity = 0.0f;
|
||||
enHy->actor.flags &= ~1;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 EnHy_SetPointFowards(EnHy* enHy, GlobalContext* globalCtx, f32 gravity, s16 animIndex) {
|
||||
enHy->actor.gravity = gravity;
|
||||
enHy->actor.flags |= 1;
|
||||
EnHy_ChangeObjectAndAnim(enHy, globalCtx, animIndex);
|
||||
enHy->curPoint++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 EnHy_SetPointBackwards(EnHy* enHy, GlobalContext* globalCtx, s16 animIndex) {
|
||||
EnHy_ChangeObjectAndAnim(enHy, globalCtx, animIndex);
|
||||
enHy->curPoint--;
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 EnHy_MoveForwards(EnHy* enHy, f32 speedTarget) {
|
||||
s16 rotStep;
|
||||
s32 reachedEnd = false;
|
||||
Vec3f curPointPos;
|
||||
|
||||
Math_SmoothStepToF(&enHy->actor.speedXZ, speedTarget, 0.4f, 1000.0f, 0.0f);
|
||||
rotStep = enHy->actor.speedXZ * 400.0f;
|
||||
if (func_8013D68C(enHy->path, enHy->curPoint, &curPointPos) && func_8013D768(&enHy->actor, &curPointPos, rotStep)) {
|
||||
enHy->curPoint++;
|
||||
if (enHy->curPoint >= enHy->path->count) {
|
||||
reachedEnd = true;
|
||||
}
|
||||
}
|
||||
return reachedEnd;
|
||||
}
|
||||
|
||||
s32 EnHy_MoveBackwards(EnHy* enHy, f32 speedTarget) {
|
||||
s16 rotStep;
|
||||
s32 reachedEnd = false;
|
||||
Vec3f curPointPos;
|
||||
|
||||
Math_SmoothStepToF(&enHy->actor.speedXZ, speedTarget, 0.4f, 1000.0f, 0.0f);
|
||||
rotStep = enHy->actor.speedXZ * 400.0f;
|
||||
if (func_8013D68C(enHy->path, enHy->curPoint, &curPointPos) && func_8013D768(&enHy->actor, &curPointPos, rotStep)) {
|
||||
enHy->curPoint--;
|
||||
if (enHy->curPoint < 0) {
|
||||
reachedEnd = true;
|
||||
}
|
||||
}
|
||||
return reachedEnd;
|
||||
}
|
||||
|
||||
void EnHy_UpdateCollider(EnHy* enHy, GlobalContext* globalCtx) {
|
||||
enHy->collider.dim.pos.x = enHy->actor.world.pos.x;
|
||||
enHy->collider.dim.pos.y = enHy->actor.world.pos.y;
|
||||
enHy->collider.dim.pos.z = enHy->actor.world.pos.z;
|
||||
|
||||
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &enHy->collider.base);
|
||||
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &enHy->collider.base);
|
||||
}
|
||||
|
||||
s32 EnHy_PlayWalkingSound(EnHy* enHy, GlobalContext* globalCtx, f32 distAboveThreshold) {
|
||||
u8 wasLeftFootOnGround = enHy->isLeftFootOnGround;
|
||||
u8 wasRightFootOnGround = enHy->isRightFootOnGround;
|
||||
s32 waterSfxId;
|
||||
u16 sfxId;
|
||||
u8 isFootOnGround;
|
||||
|
||||
if (enHy->actor.bgCheckFlags & 0x20) {
|
||||
if (enHy->actor.depthInWater < 20.0f) {
|
||||
waterSfxId = NA_SE_PL_WALK_WATER0 - SFX_FLAG;
|
||||
} else {
|
||||
waterSfxId = NA_SE_PL_WALK_WATER1 - SFX_FLAG;
|
||||
}
|
||||
sfxId = waterSfxId + SFX_FLAG;
|
||||
} else {
|
||||
sfxId = SurfaceType_GetSfx(&globalCtx->colCtx, enHy->actor.floorPoly, enHy->actor.floorBgId) + SFX_FLAG;
|
||||
}
|
||||
|
||||
enHy->isLeftFootOnGround = isFootOnGround = func_8013DB90(globalCtx, &enHy->leftFootPos, distAboveThreshold);
|
||||
if (enHy->isLeftFootOnGround && !wasLeftFootOnGround && isFootOnGround) {
|
||||
Audio_PlayActorSound2(&enHy->actor, sfxId);
|
||||
}
|
||||
|
||||
enHy->isRightFootOnGround = isFootOnGround = func_8013DB90(globalCtx, &enHy->rightFootPos, distAboveThreshold);
|
||||
if (enHy->isRightFootOnGround && !wasRightFootOnGround && isFootOnGround) {
|
||||
Audio_PlayActorSound2(&enHy->actor, sfxId);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -8,11 +8,14 @@ struct EnDoor;
|
|||
typedef void (*EnDoorActionFunc)(struct EnDoor*, GlobalContext*);
|
||||
|
||||
typedef struct EnDoor {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x0144 */ char unk_144[0x63];
|
||||
/* 0x01A7 */ s8 unk_1A7;
|
||||
/* 0x01A8 */ char unk_1A8[0x20];
|
||||
/* 0x01C8 */ EnDoorActionFunc actionFunc;
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x144 */ char unk_144[0x5C];
|
||||
/* 0x1A0 */ s8 unk_1A0;
|
||||
/* 0x1A1 */ s8 unk_1A1;
|
||||
/* 0x1A2 */ char unk_1A2[0x5];
|
||||
/* 0x1A7 */ s8 unk_1A7;
|
||||
/* 0x1A8 */ char unk_1A8[0x20];
|
||||
/* 0x1C8 */ EnDoorActionFunc actionFunc;
|
||||
} EnDoor; // size = 0x1CC
|
||||
|
||||
extern const ActorInit En_Door_InitVars;
|
||||
|
|
|
|||
|
|
@ -214,11 +214,11 @@ s32 func_808F3178(EnIn* this, GlobalContext* globalCtx) {
|
|||
u8 tmp;
|
||||
|
||||
this->unk260 = tmp = func_8013DB90(globalCtx, &this->unk248, -6.0f);
|
||||
if (this->unk260 != 0 && prevUnk260 == 0 && tmp & 0xFF) {
|
||||
if (this->unk260 != 0 && prevUnk260 == 0 && tmp) {
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_PL_WALK_CONCRETE);
|
||||
}
|
||||
this->unk261 = tmp = func_8013DB90(globalCtx, &this->unk254, -6.0f);
|
||||
if (this->unk261 != 0 && prevUnk261 == 0 && tmp & 0xFF) {
|
||||
if (this->unk261 != 0 && prevUnk261 == 0 && tmp) {
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_PL_WALK_CONCRETE);
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -380,7 +380,7 @@
|
|||
0x800EFE60 : "z_eff_footmark",
|
||||
0x800F0390 : "code_800F0390",
|
||||
0x800F05C0 : "z_elf_message",
|
||||
0x800F07C0 : "code_800F07C0",
|
||||
0x800F07C0 : "z_en_hy",
|
||||
0x800F1250 : "z_face_reaction",
|
||||
0x800F12D0 : "z_env_flags",
|
||||
0x800F1460 : "z_eventmgr",
|
||||
|
|
|
|||
|
|
@ -1616,21 +1616,21 @@
|
|||
0x800F0568:("Audio_PlaySoundAtPosition",),
|
||||
0x800F0590:("func_800F0590",),
|
||||
0x800F05C0:("ElfMessage_GetFirstCycleHint",),
|
||||
0x800F07C0:("func_800F07C0",),
|
||||
0x800F0888:("func_800F0888",),
|
||||
0x800F0944:("func_800F0944",),
|
||||
0x800F09B4:("func_800F09B4",),
|
||||
0x800F0A20:("func_800F0A20",),
|
||||
0x800F0A94:("func_800F0A94",),
|
||||
0x800F07C0:("EnHy_ChangeAnim",),
|
||||
0x800F0888:("EnHy_FindNearestDoor",),
|
||||
0x800F0944:("EnHy_ChangeObjectAndAnim",),
|
||||
0x800F09B4:("EnHy_UpdateSkelAnime",),
|
||||
0x800F0A20:("EnHy_Blink",),
|
||||
0x800F0A94:("EnHy_Init",),
|
||||
0x800F0BB4:("func_800F0BB4",),
|
||||
0x800F0CE4:("func_800F0CE4",),
|
||||
0x800F0DD4:("func_800F0DD4",),
|
||||
0x800F0E94:("func_800F0E94",),
|
||||
0x800F0EEC:("func_800F0EEC",),
|
||||
0x800F0F28:("func_800F0F28",),
|
||||
0x800F0FF0:("func_800F0FF0",),
|
||||
0x800F10AC:("func_800F10AC",),
|
||||
0x800F112C:("func_800F112C",),
|
||||
0x800F0E94:("EnHy_SetPointFowards",),
|
||||
0x800F0EEC:("EnHy_SetPointBackwards",),
|
||||
0x800F0F28:("EnHy_MoveForwards",),
|
||||
0x800F0FF0:("EnHy_MoveBackwards",),
|
||||
0x800F10AC:("EnHy_UpdateCollider",),
|
||||
0x800F112C:("EnHy_PlayWalkingSound",),
|
||||
0x800F1250:("Text_GetFaceReaction",),
|
||||
0x800F12D0:("EnvFlags_UnsetAll",),
|
||||
0x800F1304:("EnvFlags_Set",),
|
||||
|
|
|
|||
|
|
@ -923,7 +923,7 @@
|
|||
0x801BC2A0:("D_801BC2A0","UNK_TYPE1","",0x1),
|
||||
0x801BC3F0:("D_801BC3F0","UNK_TYPE1","",0x1),
|
||||
0x801BC400:("D_801BC400","UNK_TYPE1","",0x1),
|
||||
0x801BC410:("D_801BC410","UNK_TYPE1","",0x1),
|
||||
0x801BC410:("D_801BC410","s32",[],0x10),
|
||||
0x801BC420:("sReactionTextIds","u16","[]",0x140A),
|
||||
0x801BD830:("actorCutscenesGlobalCutscenes","ActorCutscene","[8]",0x80),
|
||||
0x801BD8B0:("actorCutsceneCurrent","s16","",0x2),
|
||||
|
|
|
|||
|
|
@ -608,6 +608,24 @@ D_06011AB8 = 0x06011AB8;
|
|||
D_06012A80 = 0x06012A80;
|
||||
D_06013138 = 0x06013138;
|
||||
|
||||
// z_en_hy.c
|
||||
D_0600007C = 0x0600007C;
|
||||
D_0600066C = 0x0600066C;
|
||||
D_0600071C = 0x0600071C;
|
||||
D_060008C0 = 0x060008C0;
|
||||
D_06000AB0 = 0x06000AB0;
|
||||
D_06000FDC = 0x06000FDC;
|
||||
D_06001494 = 0x06001494;
|
||||
D_06001908 = 0x06001908;
|
||||
D_06001EE0 = 0x06001EE0;
|
||||
D_06005DC4 = 0x06005DC4;
|
||||
D_06005D9C = 0x06005D9C;
|
||||
D_0600DED8 = 0x0600DED8;
|
||||
D_0600F920 = 0x0600F920;
|
||||
D_0600FC1C = 0x0600FC1C;
|
||||
D_0600FEE4 = 0x0600FEE4;
|
||||
D_06010330 = 0x06010330;
|
||||
|
||||
// ovl_Arms_Hook
|
||||
|
||||
D_0601D960 = 0x0601D960;
|
||||
|
|
|
|||
Loading…
Reference in New Issue