mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-07 06:40:15 +00:00
En_Skjneedle OK (#162)
* En_Skjneedle OK * fix * file deletions * file deletions 2 * fix extern * fix * cleanup
This commit is contained in:
parent
1bb3e006cd
commit
3175f5c988
11 changed files with 78 additions and 248 deletions
|
@ -15,7 +15,10 @@ 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[];
|
||||
|
||||
const ActorInit En_Skjneedle_InitVars = {
|
||||
ACTOR_EN_SKJNEEDLE,
|
||||
ACTORTYPE_ENEMY,
|
||||
|
@ -27,13 +30,72 @@ const ActorInit En_Skjneedle_InitVars = {
|
|||
(ActorFunc)EnSkjneedle_Update,
|
||||
(ActorFunc)EnSkjneedle_Draw,
|
||||
};
|
||||
*/
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skjneedle/EnSkjneedle_Init.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skjneedle/EnSkjneedle_Destroy.s")
|
||||
static ColliderCylinderInit_Set3 sCylinderInit = {
|
||||
{ COLTYPE_UNK1, 0x11, 0x09, 0x00, COLSHAPE_CYLINDER },
|
||||
{ 0x00, { 0xFFCFFFFF, 0x00, 0x08 }, { 0xFFCFFFFF, 0x00, 0x00 }, 0x01, 0x01, 0x01 },
|
||||
{ 10, 4, -2, { 0, 0, 0 } },
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skjneedle/func_80B01F6C.s")
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_U8(unk_1F, 2, ICHAIN_CONTINUE),
|
||||
ICHAIN_F32(unk_4C, 30, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skjneedle/EnSkjneedle_Update.s")
|
||||
void EnSkjneedle_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnSkjneedle* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Skjneedle/EnSkjneedle_Draw.s")
|
||||
Actor_ProcessInitChain(&this->actor, sInitChain);
|
||||
Collider_InitCylinder(globalCtx, &this->collider);
|
||||
Collider_SetCylinder_Set3(globalCtx, &this->collider, &this->actor, &sCylinderInit);
|
||||
ActorShape_Init(&this->actor.shape, 0, ActorShadow_DrawFunc_Circle, 20.0f);
|
||||
thisx->flags &= ~0x1;
|
||||
Actor_SetScale(&this->actor, 0.01f);
|
||||
}
|
||||
|
||||
void EnSkjneedle_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnSkjneedle* this = THIS;
|
||||
|
||||
Collider_DestroyCylinder(globalCtx, &this->collider);
|
||||
}
|
||||
|
||||
s32 func_80B01F6C(EnSkjneedle* this) {
|
||||
if (this->collider.base.atFlags & 2) {
|
||||
this->collider.base.acFlags &= ~2;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void EnSkjneedle_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnSkjneedle* this = THIS;
|
||||
GlobalContext* preserve = globalCtx; // workaround to store globalCtx in $s1 and not on the stack
|
||||
|
||||
this->unk_1E0++;
|
||||
if (this->unk_1E2 != 0) {
|
||||
this->unk_1E2--;
|
||||
}
|
||||
if (func_80B01F6C(this) || this->unk_1E2 == 0) {
|
||||
Actor_Kill(&this->actor);
|
||||
} else {
|
||||
globalCtx = preserve; // workaround
|
||||
Actor_SetScale(&this->actor, 0.01f);
|
||||
Collider_CylinderUpdate(&this->actor, &this->collider);
|
||||
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
Actor_MoveForward(&this->actor);
|
||||
func_8002E4B4(globalCtx, &this->actor, 20.0f, 20.0f, 20.0f, 7);
|
||||
}
|
||||
}
|
||||
|
||||
void EnSkjneedle_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
|
||||
Gfx* dispRefs[5];
|
||||
|
||||
Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_skj_needle.c", 200);
|
||||
func_80093D18(globalCtx->state.gfxCtx);
|
||||
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_skj_needle.c", 205),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(gfxCtx->polyOpa.p++, &D_06000EB0);
|
||||
Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_en_skj_needle.c", 210);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,11 @@ struct EnSkjneedle;
|
|||
|
||||
typedef struct EnSkjneedle {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ char unk_14C[0x9C];
|
||||
/* 0x014C */ char unk_14C[0x48];
|
||||
/* 0x0194 */ ColliderCylinder collider;
|
||||
/* 0x01E0 */ s16 unk_1E0;
|
||||
/* 0x01E2 */ s16 unk_1E2;
|
||||
/* 0x01E4 */ char unk_1E4[4];
|
||||
} EnSkjneedle; // size = 0x01E8
|
||||
|
||||
extern const ActorInit En_Skjneedle_InitVars;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue