1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-03 06:24:30 +00:00

EnZf OK and partially documented (#988)

* Match Destroy

* Matched Init

* 3 more matched

* 15 functions matched, data imported

* 16 matched

* 17 matched

* 18 matched

* formatting

* 19 matched

* Fix unk_404

* Draw matched, 20 in total

* 21 matched

* 22 matched

* 23 matched

* 24 matched

* 25 matched

* 26 matched

* 27 matched

* 28 matched

* 29 matched

* 30 matched

* 31 matched

* 33 matched

* 34 matched

* 35 matched

* 36 matched

* 17 left

* 16 left

* 15 left

* 14 left

* 13 left

* 12 left

* 11 left

* 10 left

* spec

* bss

* 9 left

* 8 left

* 7 left

* 6 left

* 5 left

* 4 left

* 1 up to regalloc, 3 left

* 2 left (+ 1 regalloc)

* More naming

* 1 + regalloc left

* Some naming

* matches but for 2 words of stack in func_80B45748

* Delete some padding in header

* Merge remote-tracking branch 'upstream/master' into Zf

* func_8003426C rename

* more failed matching attempts

* Update to new function names

* OK at last

* Actually OK this time, removed pragmas, spec

* Begin documentation

* Few more names

* Some more naming, added description to z_en_geldb.c

* Confirm platform categories

* (Badly) named floor check functions

* Make fighter actors playSpeed animation frame checks consistent (up to names)

* Action enum, lot of work on the skeleton stuff in the object

* Lot of function and animation naming

* More naming, last of the hardcoded symbols

* Some name cleanup

* Remove asm

* Format

* Bit more cleanup

* Dragorn review I

* undefined syms

* Correct limb names

* Non-control flow review suggestions

* Easy review stuff

* Some more review
This commit is contained in:
EllipticEllipsis 2021-11-06 03:47:04 +00:00 committed by GitHub
parent aa7ff4e795
commit 823a3c0754
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
67 changed files with 2603 additions and 7372 deletions

View file

@ -1,3 +1,9 @@
/*
* File: z_en_geldb.c
* Overlay: ovl_En_GeldB
* Description: Gerudo fighter
*/
#include "z_en_geldb.h"
#include "objects/object_geldb/object_geldb.h"
@ -478,12 +484,9 @@ void EnGeldB_SetupAdvance(EnGeldB* this, GlobalContext* globalCtx) {
void EnGeldB_Advance(EnGeldB* this, GlobalContext* globalCtx) {
s32 thisKeyFrame;
s32 prevKeyFrame;
s32 pad3C;
s32 playSpeed;
s16 facingAngletoLink;
Player* player = GET_PLAYER(globalCtx);
s32 pad30;
s32 pad2C;
f32 playSpeed;
if (!EnGeldB_DodgeRanged(globalCtx, this)) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x2EE, 0);
@ -507,9 +510,8 @@ void EnGeldB_Advance(EnGeldB* this, GlobalContext* globalCtx) {
}
thisKeyFrame = (s32)this->skelAnime.curFrame;
SkelAnime_Update(&this->skelAnime);
playSpeed = ABS(this->skelAnime.playSpeed);
prevKeyFrame = (s32)(this->skelAnime.curFrame - playSpeed);
playSpeed = ABS(this->skelAnime.playSpeed); // yes it does this twice.
prevKeyFrame = this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed);
playSpeed = (f32)ABS(this->skelAnime.playSpeed);
if (!Actor_IsFacingPlayer(&this->actor, 0x11C7)) {
if (Rand_ZeroOne() > 0.5f) {
EnGeldB_SetupCircle(this);
@ -543,10 +545,12 @@ void EnGeldB_Advance(EnGeldB* this, GlobalContext* globalCtx) {
if ((globalCtx->gameplayFrames & 0x5F) == 0) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_GERUDOFT_BREATH);
}
if ((thisKeyFrame != (s32)this->skelAnime.curFrame) &&
((prevKeyFrame < 0 && (s32)playSpeed + thisKeyFrame > 0) ||
(prevKeyFrame < 4 && (s32)playSpeed + thisKeyFrame > 4))) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_MUSI_LAND);
if (thisKeyFrame != (s32)this->skelAnime.curFrame) {
s32 temp = playSpeed + thisKeyFrame;
if (((prevKeyFrame < 0) && (temp > 0)) || ((prevKeyFrame < 4) && (temp > 4))) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_MUSI_LAND);
}
}
}
}

View file

@ -573,9 +573,8 @@ void EnTest_WalkAndBlock(EnTest* this, GlobalContext* globalCtx) {
s32 temp_f16;
f32 playSpeed;
Player* player = GET_PLAYER(globalCtx);
f32 absPlaySpeed;
s32 absPlaySpeed;
s16 yawDiff;
s32 temp_v0_2;
if (!EnTest_ReactToProjectile(globalCtx, this)) {
this->timer++;
@ -643,10 +642,10 @@ void EnTest_WalkAndBlock(EnTest* this, GlobalContext* globalCtx) {
SkelAnime_Update(&this->skelAnime);
temp_f16 = this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed);
absPlaySpeed = ABS(this->skelAnime.playSpeed);
absPlaySpeed = (f32)ABS(this->skelAnime.playSpeed);
if ((s32)this->skelAnime.curFrame != prevFrame) {
temp_v0_2 = (s32)absPlaySpeed + prevFrame;
s32 temp_v0_2 = absPlaySpeed + prevFrame;
if (((temp_v0_2 > 1) && (temp_f16 <= 0)) || ((temp_f16 < 7) && (temp_v0_2 >= 8))) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_STAL_WALK);
@ -724,7 +723,7 @@ void func_80860C24(EnTest* this, GlobalContext* globalCtx) {
s32 prevFrame;
s32 temp1;
s32 temp2;
f32 absPlaySpeed;
s32 absPlaySpeed;
if (!EnTest_ReactToProjectile(globalCtx, this)) {
yawDiff = this->actor.yawTowardsPlayer;
@ -751,16 +750,12 @@ void func_80860C24(EnTest* this, GlobalContext* globalCtx) {
}
prevFrame = this->skelAnime.curFrame;
SkelAnime_Update(&this->skelAnime);
temp1 = this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed);
absPlaySpeed = ABS(this->skelAnime.playSpeed);
if (1) {}
absPlaySpeed = (f32)ABS(this->skelAnime.playSpeed);
if ((s32)this->skelAnime.curFrame != prevFrame) {
temp2 = (s32)absPlaySpeed + prevFrame;
temp2 = absPlaySpeed + prevFrame;
if (((temp2 > 2) && (temp1 <= 0)) || ((temp1 < 7) && (temp2 >= 9))) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_STAL_WALK);
@ -802,8 +797,7 @@ void func_80860F84(EnTest* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
f32 checkDist = 0.0f;
s16 newYaw;
f32 absPlaySpeed;
s32 temp_v0_2;
s32 absPlaySpeed;
if (!EnTest_ReactToProjectile(globalCtx, this)) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1);
@ -869,14 +863,14 @@ void func_80860F84(EnTest* this, GlobalContext* globalCtx) {
}
this->skelAnime.playSpeed = this->actor.speedXZ * 0.5f;
prevFrame = this->skelAnime.curFrame;
SkelAnime_Update(&this->skelAnime);
temp_f16 = this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed);
absPlaySpeed = ABS(this->skelAnime.playSpeed);
absPlaySpeed = (f32)ABS(this->skelAnime.playSpeed);
if ((s32)this->skelAnime.curFrame != prevFrame) {
temp_v0_2 = (s32)absPlaySpeed + prevFrame;
s32 temp_v0_2 = absPlaySpeed + prevFrame;
if (((temp_v0_2 > 1) && (temp_f16 <= 0)) || ((temp_f16 < 7) && (temp_v0_2 >= 8))) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_STAL_WALK);
@ -1374,7 +1368,6 @@ void func_808628C8(EnTest* this, GlobalContext* globalCtx) {
f32 checkDist = 0.0f;
s16 newYaw;
f32 absPlaySpeed;
s32 temp_v0_2;
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1);
@ -1453,7 +1446,7 @@ void func_808628C8(EnTest* this, GlobalContext* globalCtx) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_STAL_WARAU);
}
if ((s32)this->skelAnime.curFrame != prevFrame) {
temp_v0_2 = (s32)absPlaySpeed + prevFrame;
s32 temp_v0_2 = (s32)absPlaySpeed + prevFrame;
if (((temp_v0_2 > 1) && (temp_f16 <= 0)) || ((temp_f16 < 7) && (temp_v0_2 >= 8))) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_STAL_WALK);

View file

@ -1433,7 +1433,8 @@ void EnWf_Draw(Actor* thisx, GlobalContext* globalCtx) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_wf.c", 2157);
// This conditional will always evaluate to true, since unk_300 is false whenever action is WOLFOS_ACTION_WAIT_TO_APPEAR.
// This conditional will always evaluate to true, since unk_300 is false whenever action is
// WOLFOS_ACTION_WAIT_TO_APPEAR.
if ((this->action != WOLFOS_ACTION_WAIT_TO_APPEAR) || !this->unk_300) {
func_80093D18(globalCtx->state.gfxCtx);

File diff suppressed because it is too large Load diff

View file

@ -6,9 +6,119 @@
struct EnZf;
typedef void (*EnZfActionFunc)(struct EnZf*, GlobalContext*);
typedef enum {
/* -2 */ ENZF_TYPE_DINOLFOS = -2,
/* -1 */ ENZF_TYPE_LIZALFOS_LONE, // Not a miniboss, e.g. Spirit Temple
/* 0 */ ENZF_TYPE_LIZALFOS_MINIBOSS_A, // Pair with B
/* 1 */ ENZF_TYPE_LIZALFOS_MINIBOSS_B // Pair with A
} EnZfType;
typedef enum {
/* 0 */ ENZF_ACTION_DROP_IN,
/* 3 */ ENZF_ACTION_3 = 3, // stop and choose action?
/* 5 */ ENZF_ACTION_APPROACH_PLAYER = 5,
/* 6 */ ENZF_ACTION_6,
/* 7 */ ENZF_ACTION_7, // more sidestepping?
/* 8 */ ENZF_ACTION_RECOIL_FROM_BLOCKED_SLASH,
/* 9 */ ENZF_ACTION_SLASH,
/* 11 */ ENZF_ACTION_JUMP_BACK = 11,
/* 12 */ ENZF_ACTION_CIRCLE_AROUND_PLAYER,
/* 13 */ ENZF_ACTION_JUMP_FORWARD,
/* 14 */ ENZF_ACTION_STUNNED,
/* 15 */ ENZF_ACTION_DIE,
/* 16 */ ENZF_ACTION_DAMAGED,
/* 18 */ ENZF_ACTION_SHEATHE_SWORD = 18,
/* 19 */ ENZF_ACTION_HOP_AWAY,
/* 20 */ ENZF_ACTION_HOP_AND_TAUNT,
/* 21 */ ENZF_ACTION_DRAW_SWORD,
/* 22 */ ENZF_ACTION_JUMP_UP
} EnZfAction;
typedef enum {
/*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D_ROOT,
/* 0x21 */ ENZF_LIMB_SCABBARD,
/* 0x22 */ ENZF_LIMB_RIGHT_LEG_ROOT,
/* 0x23 */ ENZF_LIMB_RIGHT_THIGH_ROOT,
/* 0x24 */ ENZF_LIMB_RIGHT_SHIN_ROOT,
/* 0x25 */ ENZF_LIMB_RIGHT_FOOT_ROOT,
/* 0x26 */ ENZF_LIMB_RIGHT_FOOT,
/* 0x27 */ ENZF_LIMB_RIGHT_SHIN,
/* 0x28 */ ENZF_LIMB_RIGHT_THIGH,
/* 0x29 */ ENZF_LIMB_LEFT_LEG_ROOT,
/* 0x2A */ ENZF_LIMB_LEFT_THIGH_ROOT,
/* 0x2B */ ENZF_LIMB_LEFT_SHIN_ROOT,
/* 0x2C */ ENZF_LIMB_LEFT_FOOT_ROOT,
/* 0x2D */ ENZF_LIMB_LEFT_FOOT,
/* 0x2E */ ENZF_LIMB_LEFT_SHIN,
/* 0x2F */ ENZF_LIMB_LEFT_THIGH,
/* 0x30 */ ENZF_LIMB_TRUNK,
/* 0x31 */ ENZF_LIMB_MAX
} EnZfLimb; // used for both Lizalfos and Dinalfos
typedef struct EnZf {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x41C];
/* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ Vec3s jointTable[ENZF_LIMB_MAX];
/* 0x02B6 */ Vec3s morphTable[ENZF_LIMB_MAX];
/* 0x03DC */ s32 action;
/* 0x03E0 */ s32 unk_3E0; // Set but unused
/* 0x03E4 */ s32 hopAnimIndex;
/* 0x03E8 */ EnZfActionFunc actionFunc;
/* 0x03EC */ s16 headRot;
/* 0x03EE */ s16 headRotTemp;
/* 0x03F0 */ s32 unk_3F0; // attack timer?
/* 0x03F4 */ s16 unk_3F4; // tag timer?
/* 0x03F6 */ s16 iceTimer;
/* 0x03F8 */ s16 unk_3F8; // boolean, to do with movement
/* 0x03FA */ s16 swordSheathed; // boolean
/* 0x03FC */ s16 clearFlag;
/* 0x03FE */ s16 curPlatform;
/* 0x0400 */ s16 homePlatform; // Platform to return to, changed by some functions?
/* 0x0402 */ s16 nextPlatform;
/* 0x0404 */ u8 alpha;
/* 0x0408 */ f32 unk_408; // related to XZ speeds
/* 0x040C */ f32 unk_40C; // related to y velocity
/* 0x0410 */ u8 damageEffect;
/* 0x0414 */ s32 blureIndex;
/* 0x0418 */ ColliderCylinder bodyCollider;
/* 0x0464 */ ColliderQuad swordCollider;
/* 0x04E4 */ Vec3f rightFootPos;
/* 0x04F0 */ Vec3f leftFootPos;
/* 0x04FC */ Vec3f bodyPartsPos[9];
} EnZf; // size = 0x0568
#endif