1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-13 19:35:28 +00:00

Decompile and mostly document EnSkj, EnSkjNeedle, and OBJECT_SKJ. One NON_MATCHING (#750)

* match a few

* delete ASM

* Almost done

* One reg swap left

* GlobalCtx2 YEP

* Start object SKJ

* Start some documentation

* Big doc pass

* Name the first batch of functions

* Done

* fix some issues real quick

* lets try this again

* remove left over doc tools and add 3 textures

* Finish object_skj docs

* PR fixes

* PR fixes

* Delete BuildInfo.ha

* PR fixes (Roman)

* PR fixes (Roman)
This commit is contained in:
louist103 2021-04-10 11:39:25 -04:00 committed by GitHub
parent ed78d18a25
commit 25dd8e54dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
106 changed files with 1816 additions and 3763 deletions

File diff suppressed because it is too large Load diff

View file

@ -6,9 +6,35 @@
struct EnSkj;
typedef void (*EnSkjActionFunc)(struct EnSkj*, GlobalContext*);
typedef struct EnSkj {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x1B4];
/* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ Vec3s jointTable[19];
/* 0x0202 */ Vec3s morphTable[19];
/* 0x0274 */ EnSkjActionFunc actionFunc;
/* 0x0278 */ ColliderCylinder collider;
/* 0x02C4 */ u16 textId;
/* 0x02C6 */ s16 timer;
/* 0x02C8 */ s16 unk_2C8;
/* 0x02CA */ s16 multiuseTimer;
/* 0x02CC */ s16 needleShootTimer;
/* 0x02CE */ s16 dodgeResetTimer;
/* 0x02D0 */ u8 animIndex;
/* 0x02D1 */ u8 action;
/* 0x02D2 */ u8 backfilpFlag;
/* 0x02D3 */ u8 unk_2D3; // Is set to zero when walking to trade for skull mask and set to 1 when dying
/* 0x02D4 */ u8 needlesToShoot;
/* 0x02D5 */ u8 hitsUntilDodge; // Upon reaching zero will always backflip to avoid stun lock
/* 0x02D6 */ u8 unk_2D6;
/* 0x02D7 */ u8 playerInRange;
/* 0x02D8 */ u8 minigameState; // Upon reaching zero stops and does another action
/* 0x02DC */ u32 alpha;
/* 0x02E0 */ Vec3f center;
/* 0x02EC */ f32 unk_2EC;
/* 0x02F0 */ f32 unk_2F0;
/* 0x02F4 */ Vec3f posCopy;
} EnSkj; // size = 0x0300
extern const ActorInit En_Skj_InitVars;

View file

@ -5,6 +5,7 @@
*/
#include "z_en_skjneedle.h"
#include "objects/object_skj/object_skj.h"
#define FLAGS 0x00000205
@ -15,9 +16,7 @@ void EnSkjneedle_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnSkjneedle_Update(Actor* thisx, GlobalContext* globalCtx);
void EnSkjneedle_Draw(Actor* thisx, GlobalContext* globalCtx);
s32 func_80B01F6C(EnSkjneedle* this);
extern Gfx D_06000EB0[];
s32 EnSkjNeedle_CollisionCheck(EnSkjneedle* this);
const ActorInit En_Skjneedle_InitVars = {
ACTOR_EN_SKJNEEDLE,
@ -39,7 +38,14 @@ static ColliderCylinderInitType1 sCylinderInit = {
OC1_NONE,
COLSHAPE_CYLINDER,
},
{ 0x00, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, 0x01, 0x01, 0x01 },
{
ELEMTYPE_UNK0,
{ 0xFFCFFFFF, 0x00, 0x08 },
{ 0xFFCFFFFF, 0x00, 0x00 },
TOUCH_ON | TOUCH_SFX_NORMAL,
BUMP_ON,
OCELEM_ON,
},
{ 10, 4, -2, { 0, 0, 0 } },
};
@ -65,7 +71,7 @@ void EnSkjneedle_Destroy(Actor* thisx, GlobalContext* globalCtx) {
Collider_DestroyCylinder(globalCtx, &this->collider);
}
s32 func_80B01F6C(EnSkjneedle* this) {
s32 EnSkjNeedle_CollisionCheck(EnSkjneedle* this) {
if (this->collider.base.atFlags & AT_HIT) {
this->collider.base.acFlags &= ~AC_HIT;
return 1;
@ -73,18 +79,17 @@ s32 func_80B01F6C(EnSkjneedle* this) {
return 0;
}
void EnSkjneedle_Update(Actor* thisx, GlobalContext* globalCtx) {
void EnSkjneedle_Update(Actor* thisx, GlobalContext* globalCtx2) {
EnSkjneedle* this = THIS;
GlobalContext* preserve = globalCtx; // workaround to store globalCtx in $s1 and not on the stack
GlobalContext* globalCtx = globalCtx2;
this->unk_1E0++;
if (this->unk_1E2 != 0) {
this->unk_1E2--;
this->unusedTimer1++;
if (this->killTimer != 0) {
this->killTimer--;
}
if (func_80B01F6C(this) || this->unk_1E2 == 0) {
if (EnSkjNeedle_CollisionCheck(this) || this->killTimer == 0) {
Actor_Kill(&this->actor);
} else {
globalCtx = preserve; // workaround
Actor_SetScale(&this->actor, 0.01f);
Collider_UpdateCylinder(&this->actor, &this->collider);
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
@ -102,7 +107,7 @@ void EnSkjneedle_Draw(Actor* thisx, GlobalContext* globalCtx) {
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_skj_needle.c", 205),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, &D_06000EB0);
gSPDisplayList(POLY_OPA_DISP++, gSKJNeedleDL);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_skj_needle.c", 210);
}

View file

@ -10,8 +10,8 @@ typedef struct EnSkjneedle {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x48];
/* 0x0194 */ ColliderCylinder collider;
/* 0x01E0 */ s16 unk_1E0;
/* 0x01E2 */ s16 unk_1E2;
/* 0x01E0 */ s16 unusedTimer1;
/* 0x01E2 */ s16 killTimer;
/* 0x01E4 */ char unk_1E4[4];
} EnSkjneedle; // size = 0x01E8