mirror of
https://github.com/zeldaret/mm.git
synced 2026-08-17 21:03:30 -04:00
Ovl_En_Cne_01 Ok and Documented (#641)
* Decomp and document Cne01 * Document object_cne * split enhy header from z64 * Cleanup * Actually include new z_en_hy header * Actor flags * Add header to object_cne * screen defines * Useage of ENHY_LIMB_MAX
This commit is contained in:
+66
-60
@@ -3,78 +3,79 @@
|
||||
* Description: Unused System for NPCs (includes animation, door interaction, blinking, pathing, and collider helpers)
|
||||
*/
|
||||
|
||||
#include "global.h"
|
||||
#include "z_en_hy.h"
|
||||
#include "overlays/actors/ovl_En_Door/z_en_door.h"
|
||||
#include "objects/object_aob/object_aob.h"
|
||||
#include "objects/object_bba/object_bba.h"
|
||||
#include "objects/object_bji/object_bji.h"
|
||||
#include "objects/object_boj/object_boj.h"
|
||||
#include "objects/object_os_anime/object_os_anime.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 },
|
||||
ActorAnimationEntryS sAnimations[] = {
|
||||
{ &object_aob_Anim_00007C, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
|
||||
{ &object_boj_Anim_001494, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
|
||||
{ &object_boj_Anim_001494, 1.0f, 0, -1, ANIMMODE_LOOP, -8 },
|
||||
{ &object_boj_Anim_001908, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
|
||||
{ &object_boj_Anim_001908, 1.0f, 0, -1, ANIMMODE_LOOP, -8 },
|
||||
{ &object_boj_Anim_0008C0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
|
||||
{ &object_bba_Anim_005DC4, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
|
||||
{ &object_bji_Anim_000FDC, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
|
||||
{ &object_bji_Anim_000AB0, 1.0f, 0, -1, ANIMMODE_LOOP, -8 },
|
||||
{ &object_bji_Anim_00066C, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
|
||||
{ &object_boj_Anim_00071C, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
|
||||
{ &object_os_anime_Anim_001EE0, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
|
||||
{ &object_boj_Anim_00DED8, 1.5f, 0, -1, ANIMMODE_ONCE, 0 },
|
||||
{ &object_boj_Anim_00F920, 1.5f, 0, -1, ANIMMODE_ONCE, 0 },
|
||||
{ &object_boj_Anim_00FC1C, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
|
||||
{ &object_boj_Anim_00FEE4, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
|
||||
{ &object_boj_Anim_010330, 1.0f, 0, -1, ANIMMODE_LOOP, 0 },
|
||||
{ &object_boj_Anim_00FC1C, 1.0f, 0, -1, ANIMMODE_LOOP, -8 },
|
||||
{ &object_boj_Anim_00FEE4, 1.0f, 0, -1, ANIMMODE_LOOP, -8 },
|
||||
{ &object_boj_Anim_010330, 1.0f, 0, -1, ANIMMODE_LOOP, -8 },
|
||||
{ &object_boj_Anim_005D9C, 1.0f, 0, -1, ANIMMODE_LOOP, -8 },
|
||||
};
|
||||
|
||||
s8 D_801BC3F0[] = { -1, 1, 12, 13, 14, 9, 10, 11, 0, 6, 7, 8, 3, 4, 5, 2 };
|
||||
s8 gEnHyBodyParts[] = { -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 };
|
||||
s8 gEnHyBodyPartsIndex[] = { 0, 0, 0, 0, 3, 4, 0, 6, 7, 0, 9, 10, 0, 12, 13 };
|
||||
|
||||
u8 D_801BC410[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
u8 gEnHyShadowSize[] = { 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) {
|
||||
if (animIndex >= ENHY_ANIMATION_AOB_0 && animIndex < ENHY_ANIMATION_MAX) {
|
||||
isChanged = true;
|
||||
frameCount = animations[animIndex].frameCount;
|
||||
frameCount = sAnimations[animIndex].frameCount;
|
||||
if (frameCount < 0) {
|
||||
frameCount = Animation_GetLastFrame(&animations[animIndex].animationSeg->common);
|
||||
frameCount = Animation_GetLastFrame(&sAnimations[animIndex].animationSeg->common);
|
||||
}
|
||||
Animation_Change(skelAnime, animations[animIndex].animationSeg, animations[animIndex].playbackSpeed,
|
||||
animations[animIndex].frame, frameCount, animations[animIndex].mode,
|
||||
animations[animIndex].transitionRate);
|
||||
Animation_Change(skelAnime, sAnimations[animIndex].animationSeg, sAnimations[animIndex].playbackSpeed,
|
||||
sAnimations[animIndex].frame, frameCount, sAnimations[animIndex].mode,
|
||||
sAnimations[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;
|
||||
EnDoor* EnHy_FindNearestDoor(Actor* actor, GlobalContext* globalCtx) {
|
||||
EnDoor* nearestDoor = NULL;
|
||||
Actor* doorIter = NULL;
|
||||
Actor* door;
|
||||
EnDoor* door;
|
||||
f32 dist;
|
||||
s32 isSetup = false;
|
||||
f32 minDist = 0.0f;
|
||||
|
||||
do {
|
||||
doorIter = SubS_FindActor(globalCtx, doorIter, ACTORCAT_DOOR, ACTOR_EN_DOOR);
|
||||
door = doorIter;
|
||||
dist = Actor_DistanceBetweenActors(actor, door);
|
||||
door = (EnDoor*)doorIter;
|
||||
dist = Actor_DistanceBetweenActors(actor, &door->actor);
|
||||
if (!isSetup || (dist < minDist)) {
|
||||
nearestDoor = door;
|
||||
minDist = dist;
|
||||
isSetup = true;
|
||||
}
|
||||
doorIter = door->next;
|
||||
doorIter = door->actor.next;
|
||||
} while (doorIter != NULL);
|
||||
|
||||
if (1) {}
|
||||
@@ -111,27 +112,29 @@ void EnHy_Blink(EnHy* enHy, s32 eyeTexMaxIndex) {
|
||||
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;
|
||||
if ((func_8013D8DC(enHy->animObjIndex, globalCtx) == true) &&
|
||||
(func_8013D8DC(enHy->headObjIndex, globalCtx) == true) &&
|
||||
(func_8013D8DC(enHy->skelUpperObjIndex, globalCtx) == true) &&
|
||||
(func_8013D8DC(enHy->skelLowerObjIndex, globalCtx) == true)) {
|
||||
enHy->actor.objBankIndex = enHy->skelLowerObjIndex;
|
||||
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_LIMB_MAX);
|
||||
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) {
|
||||
void func_800F0BB4(EnHy* enHy, GlobalContext* globalCtx, EnDoor* door, s16 arg3, s16 arg4) {
|
||||
s32 pad;
|
||||
s8 sp3B;
|
||||
Vec3f offset;
|
||||
f32 phi_f0;
|
||||
|
||||
Actor_OffsetOfPointInActorCoords(door, &offset, &enHy->actor.world.pos);
|
||||
Actor_OffsetOfPointInActorCoords(&door->actor, &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);
|
||||
@@ -139,14 +142,14 @@ void func_800F0BB4(EnHy* enHy, GlobalContext* globalCtx, Actor* door, s16 arg3,
|
||||
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;
|
||||
door->unk_1A1 = 1;
|
||||
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;
|
||||
EnDoor* door;
|
||||
s32 pad;
|
||||
|
||||
if (func_8013D68C(enHy->path, enHy->curPoint, &enHy->actor.world.pos)) {
|
||||
@@ -154,7 +157,7 @@ s32 func_800F0CE4(EnHy* enHy, GlobalContext* globalCtx, ActorFunc draw, s16 arg3
|
||||
if (door != NULL) {
|
||||
ret = true;
|
||||
func_800F0BB4(enHy, globalCtx, door, arg3, arg4);
|
||||
yaw = Math_Vec3f_Yaw(&enHy->actor.world.pos, &door->world.pos);
|
||||
yaw = Math_Vec3f_Yaw(&enHy->actor.world.pos, &door->actor.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;
|
||||
@@ -168,7 +171,7 @@ s32 func_800F0CE4(EnHy* enHy, GlobalContext* globalCtx, ActorFunc draw, s16 arg3
|
||||
s32 func_800F0DD4(EnHy* enHy, GlobalContext* globalCtx, s16 arg2, s16 arg3) {
|
||||
s32 ret = false;
|
||||
s32 pad;
|
||||
Actor* door;
|
||||
EnDoor* door;
|
||||
|
||||
enHy->curPoint = 0;
|
||||
if (func_8013D68C(enHy->path, enHy->curPoint, &enHy->actor.world.pos)) {
|
||||
@@ -176,10 +179,10 @@ s32 func_800F0DD4(EnHy* enHy, GlobalContext* globalCtx, s16 arg2, s16 arg3) {
|
||||
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.shape.rot.y = Math_Vec3f_Yaw(&enHy->actor.world.pos, &door->actor.world.pos);
|
||||
enHy->actor.world.rot.y = enHy->actor.shape.rot.y;
|
||||
enHy->actor.gravity = 0.0f;
|
||||
enHy->actor.flags &= ~1;
|
||||
enHy->actor.flags &= ~ACTOR_FLAG_1;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@@ -187,16 +190,16 @@ s32 func_800F0DD4(EnHy* enHy, GlobalContext* globalCtx, s16 arg2, s16 arg3) {
|
||||
|
||||
s32 EnHy_SetPointFowards(EnHy* enHy, GlobalContext* globalCtx, f32 gravity, s16 animIndex) {
|
||||
enHy->actor.gravity = gravity;
|
||||
enHy->actor.flags |= 1;
|
||||
enHy->actor.flags |= ACTOR_FLAG_1;
|
||||
EnHy_ChangeObjectAndAnim(enHy, globalCtx, animIndex);
|
||||
enHy->curPoint++;
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
s32 EnHy_SetPointBackwards(EnHy* enHy, GlobalContext* globalCtx, s16 animIndex) {
|
||||
EnHy_ChangeObjectAndAnim(enHy, globalCtx, animIndex);
|
||||
enHy->curPoint--;
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
s32 EnHy_MoveForwards(EnHy* enHy, f32 speedTarget) {
|
||||
@@ -212,6 +215,7 @@ s32 EnHy_MoveForwards(EnHy* enHy, f32 speedTarget) {
|
||||
reachedEnd = true;
|
||||
}
|
||||
}
|
||||
|
||||
return reachedEnd;
|
||||
}
|
||||
|
||||
@@ -228,6 +232,7 @@ s32 EnHy_MoveBackwards(EnHy* enHy, f32 speedTarget) {
|
||||
reachedEnd = true;
|
||||
}
|
||||
}
|
||||
|
||||
return reachedEnd;
|
||||
}
|
||||
|
||||
@@ -267,5 +272,6 @@ s32 EnHy_PlayWalkingSound(EnHy* enHy, GlobalContext* globalCtx, f32 distAboveThr
|
||||
if (enHy->isRightFootOnGround && !wasRightFootOnGround && isFootOnGround) {
|
||||
Actor_PlaySfxAtPos(&enHy->actor, sfxId);
|
||||
}
|
||||
return 0;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
*/
|
||||
|
||||
#include "z_en_cne_01.h"
|
||||
#include "objects/object_cne/object_cne.h"
|
||||
|
||||
#define FLAGS 0x00000019
|
||||
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_8 | ACTOR_FLAG_1)
|
||||
|
||||
#define THIS ((EnCne01*)thisx)
|
||||
|
||||
@@ -15,12 +16,12 @@ void EnCne01_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnCne01_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnCne01_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
void func_809CB520(EnCne01* this, GlobalContext* globalCtx);
|
||||
void func_809CB5A0(EnCne01* this, GlobalContext* globalCtx);
|
||||
void func_809CB5D8(EnCne01* this, GlobalContext* globalCtx);
|
||||
void func_809CB5FC(EnCne01* this, GlobalContext* globalCtx);
|
||||
void EnCne01_Walk(EnHy* this, GlobalContext* globalCtx);
|
||||
void EnCne01_FaceForward(EnHy* this, GlobalContext* globalCtx);
|
||||
void EnCne01_Talk(EnHy* this, GlobalContext* globalCtx);
|
||||
|
||||
typedef enum { CNE01_DMG_EFF_NONE } EnCne01DamageEffect;
|
||||
|
||||
#if 0
|
||||
const ActorInit En_Cne_01_InitVars = {
|
||||
ACTOR_EN_CNE_01,
|
||||
ACTORCAT_NPC,
|
||||
@@ -33,85 +34,295 @@ const ActorInit En_Cne_01_InitVars = {
|
||||
(ActorFunc)EnCne01_Draw,
|
||||
};
|
||||
|
||||
// static ColliderCylinderInit sCylinderInit = {
|
||||
static ColliderCylinderInit D_809CBF00 = {
|
||||
{ COLTYPE_HIT0, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, },
|
||||
{ ELEMTYPE_UNK1, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, },
|
||||
static ColliderCylinderInit sCylinderInit = {
|
||||
{
|
||||
COLTYPE_HIT0,
|
||||
AT_NONE,
|
||||
AC_ON | AC_TYPE_PLAYER,
|
||||
OC1_ON | OC1_TYPE_ALL,
|
||||
OC2_TYPE_1,
|
||||
COLSHAPE_CYLINDER,
|
||||
},
|
||||
{
|
||||
ELEMTYPE_UNK1,
|
||||
{ 0x00000000, 0x00, 0x00 },
|
||||
{ 0xF7CFFFFF, 0x00, 0x00 },
|
||||
TOUCH_NONE | TOUCH_SFX_NORMAL,
|
||||
BUMP_ON,
|
||||
OCELEM_ON,
|
||||
},
|
||||
{ 18, 64, 0, { 0, 0, 0 } },
|
||||
};
|
||||
|
||||
// sColChkInfoInit
|
||||
static CollisionCheckInfoInit2 D_809CBF2C = { 0, 0, 0, 0, MASS_IMMOVABLE };
|
||||
static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE };
|
||||
|
||||
// static DamageTable sDamageTable = {
|
||||
static DamageTable D_809CBF38 = {
|
||||
/* Deku Nut */ DMG_ENTRY(0, 0x0),
|
||||
/* Deku Stick */ DMG_ENTRY(0, 0x0),
|
||||
/* Horse trample */ DMG_ENTRY(0, 0x0),
|
||||
/* Explosives */ DMG_ENTRY(0, 0x0),
|
||||
/* Zora boomerang */ DMG_ENTRY(0, 0x0),
|
||||
/* Normal arrow */ DMG_ENTRY(0, 0x0),
|
||||
/* UNK_DMG_0x06 */ DMG_ENTRY(0, 0x0),
|
||||
/* Hookshot */ DMG_ENTRY(0, 0x0),
|
||||
/* Goron punch */ DMG_ENTRY(0, 0x0),
|
||||
/* Sword */ DMG_ENTRY(0, 0x0),
|
||||
/* Goron pound */ DMG_ENTRY(0, 0x0),
|
||||
/* Fire arrow */ DMG_ENTRY(0, 0x0),
|
||||
/* Ice arrow */ DMG_ENTRY(0, 0x0),
|
||||
/* Light arrow */ DMG_ENTRY(0, 0x0),
|
||||
/* Goron spikes */ DMG_ENTRY(0, 0x0),
|
||||
/* Deku spin */ DMG_ENTRY(0, 0x0),
|
||||
/* Deku bubble */ DMG_ENTRY(0, 0x0),
|
||||
/* Deku launch */ DMG_ENTRY(0, 0x0),
|
||||
/* UNK_DMG_0x12 */ DMG_ENTRY(0, 0x0),
|
||||
/* Zora barrier */ DMG_ENTRY(0, 0x0),
|
||||
/* Normal shield */ DMG_ENTRY(0, 0x0),
|
||||
/* Light ray */ DMG_ENTRY(0, 0x0),
|
||||
/* Thrown object */ DMG_ENTRY(0, 0x0),
|
||||
/* Zora punch */ DMG_ENTRY(0, 0x0),
|
||||
/* Spin attack */ DMG_ENTRY(0, 0x0),
|
||||
/* Sword beam */ DMG_ENTRY(0, 0x0),
|
||||
/* Normal Roll */ DMG_ENTRY(0, 0x0),
|
||||
/* UNK_DMG_0x1B */ DMG_ENTRY(0, 0x0),
|
||||
/* UNK_DMG_0x1C */ DMG_ENTRY(0, 0x0),
|
||||
/* Unblockable */ DMG_ENTRY(0, 0x0),
|
||||
/* UNK_DMG_0x1E */ DMG_ENTRY(0, 0x0),
|
||||
/* Powder Keg */ DMG_ENTRY(0, 0x0),
|
||||
static DamageTable sDamageTable = {
|
||||
/* Deku Nut */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* Deku Stick */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* Horse trample */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* Explosives */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* Zora boomerang */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* Normal arrow */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* UNK_DMG_0x06 */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* Hookshot */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* Goron punch */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* Sword */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* Goron pound */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* Fire arrow */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* Ice arrow */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* Light arrow */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* Goron spikes */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* Deku spin */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* Deku bubble */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* Deku launch */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* UNK_DMG_0x12 */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* Zora barrier */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* Normal shield */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* Light ray */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* Thrown object */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* Zora punch */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* Spin attack */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* Sword beam */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* Normal Roll */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* UNK_DMG_0x1B */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* UNK_DMG_0x1C */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* Unblockable */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* UNK_DMG_0x1E */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
/* Powder Keg */ DMG_ENTRY(0, CNE01_DMG_EFF_NONE),
|
||||
};
|
||||
|
||||
#endif
|
||||
static u16 D_809CBF58[] = { 4000, 4, 1, 3, 6000, 4, 1, 6, 4000, 4, 1, 3, 6000, 4, 1, 6 };
|
||||
|
||||
extern ColliderCylinderInit D_809CBF00;
|
||||
extern CollisionCheckInfoInit2 D_809CBF2C;
|
||||
extern DamageTable D_809CBF38;
|
||||
void EnCne01_UpdateModel(EnCne01* this, GlobalContext* globalCtx) {
|
||||
Player* player = GET_PLAYER(globalCtx);
|
||||
Vec3f focus;
|
||||
|
||||
extern UNK_TYPE D_060000F0;
|
||||
extern UNK_TYPE D_06001300;
|
||||
EnHy_UpdateSkelAnime(&this->enHy, globalCtx);
|
||||
if (func_8013D5E8(this->enHy.actor.shape.rot.y, 0x36B0, this->enHy.actor.yawTowardsPlayer)) {
|
||||
focus.x = player->actor.world.pos.x;
|
||||
focus.y = player->bodyPartsPos[7].y + 3.0f;
|
||||
focus.z = player->actor.world.pos.z;
|
||||
func_8013D2E0(&focus, &this->enHy.actor.focus.pos, &this->enHy.actor.shape.rot, &this->enHy.focusTarget,
|
||||
&this->enHy.headRot, &this->enHy.torsoRot, D_809CBF58);
|
||||
} else {
|
||||
Math_SmoothStepToS(&this->enHy.focusTarget.x, 0, 4, 0x3E8, 1);
|
||||
Math_SmoothStepToS(&this->enHy.focusTarget.y, 0, 4, 0x3E8, 1);
|
||||
Math_SmoothStepToS(&this->enHy.headRot.x, 0, 4, 0x3E8, 1);
|
||||
Math_SmoothStepToS(&this->enHy.headRot.y, 0, 4, 0x3E8, 1);
|
||||
Math_SmoothStepToS(&this->enHy.torsoRot.x, 0, 4, 0x3E8, 1);
|
||||
Math_SmoothStepToS(&this->enHy.torsoRot.y, 0, 4, 0x3E8, 1);
|
||||
}
|
||||
func_8013D9C8(globalCtx, this->enHy.limbRotTableY, this->enHy.limbRotTableZ, ARRAY_COUNT(this->enHy.limbRotTableY));
|
||||
EnHy_UpdateCollider(&this->enHy, globalCtx);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Cne_01/func_809CB290.s")
|
||||
s32 EnCne01_TestIsTalking(EnCne01* this, GlobalContext* globalCtx) {
|
||||
s32 isTalking = false;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Cne_01/func_809CB404.s")
|
||||
if (Actor_ProcessTalkRequest(&this->enHy.actor, &globalCtx->state)) {
|
||||
isTalking = true;
|
||||
this->enHy.textId = 0x10B9;
|
||||
this->enHy.tmpFocusTarget = this->enHy.focusTarget;
|
||||
this->enHy.tmpHeadRot = this->enHy.headRot;
|
||||
this->enHy.tmpTorsoRot = this->enHy.torsoRot;
|
||||
this->enHy.tmpActionFunc = this->enHy.actionFunc;
|
||||
this->enHy.actionFunc = EnCne01_Talk;
|
||||
}
|
||||
return isTalking;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Cne_01/func_809CB4A0.s")
|
||||
s32 func_809CB4A0(EnCne01* this, GlobalContext* globalCtx) {
|
||||
s16 x;
|
||||
s16 y;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Cne_01/func_809CB520.s")
|
||||
Actor_GetScreenPos(globalCtx, &this->enHy.actor, &x, &y);
|
||||
//! @bug: Both x and y conditionals are always true, || should be an &&
|
||||
if (!this->enHy.waitingOnInit && ((x >= 0) || (x < SCREEN_WIDTH)) && ((y >= 0) || (y < SCREEN_HEIGHT))) {
|
||||
func_800B85E0(&this->enHy.actor, globalCtx, 30.0f, EXCH_ITEM_2E);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Cne_01/func_809CB5A0.s")
|
||||
void EnCne01_FinishInit(EnHy* this, GlobalContext* globalCtx) {
|
||||
if (EnHy_Init(this, globalCtx, &gCneSkel, ENHY_ANIMATION_OS_ANIME_11)) {
|
||||
this->actor.flags |= ACTOR_FLAG_1;
|
||||
this->actor.draw = EnCne01_Draw;
|
||||
this->waitingOnInit = false;
|
||||
if (ENCNE01_GET_PATH(&this->actor) == ENCNE01_NO_PATH) {
|
||||
this->actionFunc = EnCne01_FaceForward;
|
||||
} else {
|
||||
this->actionFunc = EnCne01_Walk;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Cne_01/func_809CB5D8.s")
|
||||
void EnCne01_Walk(EnHy* this, GlobalContext* globalCtx) {
|
||||
if (EnHy_MoveForwards(this, 1.0f)) {
|
||||
this->curPoint = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Cne_01/func_809CB5FC.s")
|
||||
void EnCne01_FaceForward(EnHy* this, GlobalContext* globalCtx) {
|
||||
this->actor.shape.rot = this->actor.world.rot;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Cne_01/EnCne01_Init.s")
|
||||
void EnCne01_Talk(EnHy* this, GlobalContext* globalCtx) {
|
||||
s16 yaw;
|
||||
u8 talkstate;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Cne_01/EnCne01_Destroy.s")
|
||||
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 4, 0xFA0, 1);
|
||||
talkstate = Message_GetState(&globalCtx->msgCtx);
|
||||
this->inMsgState3 = (talkstate == 3) ? true : false;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Cne_01/EnCne01_Update.s")
|
||||
switch (talkstate) {
|
||||
case 0:
|
||||
yaw = ABS_ALT(this->actor.shape.rot.y - this->actor.yawTowardsPlayer);
|
||||
if (yaw < 0x64) {
|
||||
func_801518B0(globalCtx, this->textId, NULL);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
this->actor.textId = 0;
|
||||
this->focusTarget = this->tmpFocusTarget;
|
||||
this->headRot = this->tmpHeadRot;
|
||||
this->torsoRot = this->tmpTorsoRot;
|
||||
this->actor.shape.rot.y = this->actor.world.rot.y;
|
||||
this->actionFunc = this->tmpActionFunc;
|
||||
this->tmpActionFunc = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Cne_01/func_809CB920.s")
|
||||
void EnCne01_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
EnCne01* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Cne_01/func_809CBBC8.s")
|
||||
this->enHy.animObjIndex = func_8013D924(OBJECT_OS_ANIME, globalCtx);
|
||||
this->enHy.headObjIndex = func_8013D924(OBJECT_CNE, globalCtx);
|
||||
this->enHy.skelUpperObjIndex = func_8013D924(OBJECT_CNE, globalCtx);
|
||||
this->enHy.skelLowerObjIndex = func_8013D924(OBJECT_CNE, globalCtx);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Cne_01/func_809CBCA0.s")
|
||||
if ((this->enHy.animObjIndex < 0) || (this->enHy.headObjIndex < 0) || (this->enHy.skelUpperObjIndex < 0) ||
|
||||
(this->enHy.skelLowerObjIndex < 0)) {
|
||||
Actor_MarkForDeath(&this->enHy.actor);
|
||||
}
|
||||
this->enHy.actor.draw = NULL;
|
||||
Collider_InitCylinder(globalCtx, &this->enHy.collider);
|
||||
Collider_SetCylinder(globalCtx, &this->enHy.collider, &this->enHy.actor, &sCylinderInit);
|
||||
CollisionCheck_SetInfo2(&this->enHy.actor.colChkInfo, &sDamageTable, &sColChkInfoInit);
|
||||
this->enHy.actor.flags &= ~ACTOR_FLAG_1;
|
||||
this->enHy.path = func_8013D648(globalCtx, ENCNE01_GET_PATH(&this->enHy.actor), ENCNE01_NO_PATH);
|
||||
this->enHy.waitingOnInit = true;
|
||||
Actor_SetScale(&this->enHy.actor, 0.01f);
|
||||
this->enHy.actionFunc = EnCne01_FinishInit;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Cne_01/EnCne01_Draw.s")
|
||||
void EnCne01_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnCne01* this = THIS;
|
||||
|
||||
Collider_DestroyCylinder(globalCtx, &this->enHy.collider);
|
||||
}
|
||||
|
||||
void EnCne01_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnCne01* this = THIS;
|
||||
|
||||
EnCne01_TestIsTalking(this, globalCtx);
|
||||
this->enHy.actionFunc(&this->enHy, globalCtx);
|
||||
Actor_UpdateBgCheckInfo(globalCtx, &this->enHy.actor, 0.0f, 0.0f, 0.0f, 4);
|
||||
EnCne01_UpdateModel(this, globalCtx);
|
||||
func_809CB4A0(this, globalCtx);
|
||||
}
|
||||
|
||||
s32 EnCne01_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot,
|
||||
Actor* thisx) {
|
||||
EnCne01* this = THIS;
|
||||
s8 bodyPart;
|
||||
Vec3f zeroVec = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
bodyPart = gEnHyBodyParts[limbIndex];
|
||||
if (bodyPart >= 0) {
|
||||
Matrix_MultiplyVector3fByState(&zeroVec, &this->enHy.bodyPartsPos[bodyPart]);
|
||||
}
|
||||
|
||||
if (limbIndex == CNE_LIMB_HEAD) {
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->enHy.headObjIndex].segment);
|
||||
gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->enHy.headObjIndex].segment);
|
||||
*dList = gCneHeadBrownHairDL;
|
||||
gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->enHy.skelLowerObjIndex].segment);
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx);
|
||||
}
|
||||
if (limbIndex == CNE_LIMB_HEAD) {
|
||||
Matrix_InsertTranslation(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
|
||||
Matrix_InsertXRotation_s(this->enHy.headRot.y, MTXMODE_APPLY);
|
||||
Matrix_InsertZRotation_s(-this->enHy.headRot.x, MTXMODE_APPLY);
|
||||
Matrix_InsertTranslation(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY);
|
||||
}
|
||||
|
||||
if (limbIndex == CNE_LIMB_TORSO) {
|
||||
Matrix_InsertXRotation_s(-this->enHy.torsoRot.y, MTXMODE_APPLY);
|
||||
Matrix_InsertZRotation_s(-this->enHy.torsoRot.x, MTXMODE_APPLY);
|
||||
}
|
||||
|
||||
if ((limbIndex == CNE_LIMB_HEAD) && this->enHy.inMsgState3 && ((globalCtx->state.frames % 2) == 0)) {
|
||||
Matrix_InsertTranslation(40.0f, 0.0f, 0.0f, MTXMODE_APPLY);
|
||||
}
|
||||
|
||||
if ((limbIndex == CNE_LIMB_TORSO) || (limbIndex == CNE_LIMB_LEFT_UPPER_ARM) ||
|
||||
(limbIndex == CNE_LIMB_RIGHT_UPPER_ARM)) {
|
||||
rot->y += (s16)(Math_SinS(this->enHy.limbRotTableY[limbIndex]) * 200.0f);
|
||||
rot->z += (s16)(Math_CosS(this->enHy.limbRotTableZ[limbIndex]) * 200.0f);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void EnCne01_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
|
||||
EnCne01* this = THIS;
|
||||
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
|
||||
Vec3f zeroVec = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
if (limbIndex == CNE_LIMB_RIGHT_FOOT) {
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x06, globalCtx->objectCtx.status[this->enHy.skelUpperObjIndex].segment);
|
||||
gSegments[0x06] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->enHy.skelUpperObjIndex].segment);
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx);
|
||||
}
|
||||
|
||||
if (limbIndex == CNE_LIMB_HEAD) {
|
||||
Matrix_MultiplyVector3fByState(&zeroVec, &this->enHy.actor.focus.pos);
|
||||
}
|
||||
}
|
||||
|
||||
void EnCne01_TransformLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) {
|
||||
}
|
||||
|
||||
void EnCne01_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnCne01* this = THIS;
|
||||
s32 i;
|
||||
u8* shadowTex = GRAPH_ALLOC(globalCtx->state.gfxCtx, sizeof(u8[64][64]));
|
||||
u8* shadowTexIter;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx);
|
||||
|
||||
func_8012C28C(globalCtx->state.gfxCtx);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_EnvColor(globalCtx->state.gfxCtx, 160, 180, 255, 0));
|
||||
gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_EnvColor(globalCtx->state.gfxCtx, 160, 180, 255, 0));
|
||||
gSPSegment(POLY_OPA_DISP++, 0x0A, Gfx_EnvColor(globalCtx->state.gfxCtx, 160, 180, 255, 0));
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
SkelAnime_DrawTransformFlexOpa(globalCtx, this->enHy.skelAnime.skeleton, this->enHy.skelAnime.jointTable,
|
||||
this->enHy.skelAnime.dListCount, EnCne01_OverrideLimbDraw, EnCne01_PostLimbDraw,
|
||||
EnCne01_TransformLimbDraw, &this->enHy.actor);
|
||||
Matrix_InsertXRotation_s(0, MTXMODE_NEW);
|
||||
|
||||
for (i = 0, shadowTexIter = shadowTex; i < (s32)sizeof(u8[64][64]); 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);
|
||||
}
|
||||
func_8013CF04(&this->enHy.actor, &globalCtx->state.gfxCtx, shadowTex);
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx);
|
||||
}
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
#ifndef Z_EN_CNE_01_H
|
||||
#define Z_EN_CNE_01_H
|
||||
|
||||
#include "global.h"
|
||||
#include "z_en_hy.h"
|
||||
|
||||
struct EnCne01;
|
||||
|
||||
typedef void (*EnCne01ActionFunc)(struct EnCne01*, GlobalContext*);
|
||||
|
||||
#define ENCNE01_GET_PATH(thisx) (((thisx)->params & 0x7E00) >> 9)
|
||||
#define ENCNE01_NO_PATH 0x3F
|
||||
|
||||
typedef struct EnCne01 {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x0144 */ EnCne01ActionFunc actionFunc;
|
||||
/* 0x0148 */ char unk_148[0x4D4];
|
||||
/* 0x000 */ EnHy enHy;
|
||||
/* 0x3EC */ UNK_TYPE1 unk_3EC[0x230];
|
||||
} EnCne01; // size = 0x61C
|
||||
|
||||
extern const ActorInit En_Cne_01_InitVars;
|
||||
|
||||
Reference in New Issue
Block a user