mirror of https://github.com/zeldaret/mm.git
EnSi OK (#1174)
* [decomp,actor] Decompile Init,Destroy & unnamed functions (func_8098CA20 is WIP) * [ovl_En_Si] Match func_8098CA20 function * [0vl_En_Si] Comment data in spec * [ovl_En_Si] Start documentation & cleanup * [ovl_En_Si] Clang format * [spec] Update ovl_En_Si reloc target * Style fixes & adjust fanfare parameter * Remove goto & styling fixes * Styling fixes * Remove unnecessary function declarations & dead code * Styling fixes & doc (MR suggestions) * Move GET_CHEST_FLAG macro to header file * Rename colliderSphere variable to collider * Rename func_8098CA20 to EnSi_UpdateCollision * Rename func_8098CBDC to EnSi_DraggedByHookshot * Rename func_8098CAD0 to EnSi_GiveToken * Rename func_8098CB70 to EnSi_Wait * Styling adjustment * Update tools/disasm/function.txt with new function names --------- Co-authored-by: Francis <francis.jeanneau@sparkmicro.com>
This commit is contained in:
parent
c70ccf14d9
commit
263fca77c3
3
spec
3
spec
|
|
@ -1974,8 +1974,7 @@ beginseg
|
|||
name "ovl_En_Si"
|
||||
compress
|
||||
include "build/src/overlays/actors/ovl_En_Si/z_en_si.o"
|
||||
include "build/data/ovl_En_Si/ovl_En_Si.data.o"
|
||||
include "build/data/ovl_En_Si/ovl_En_Si.reloc.o"
|
||||
include "build/src/overlays/actors/ovl_En_Si/ovl_En_Si_reloc.o"
|
||||
endseg
|
||||
|
||||
beginseg
|
||||
|
|
|
|||
|
|
@ -15,10 +15,8 @@ void EnSi_Destroy(Actor* thisx, PlayState* play);
|
|||
void EnSi_Update(Actor* thisx, PlayState* play);
|
||||
void EnSi_Draw(Actor* thisx, PlayState* play);
|
||||
|
||||
void func_8098CB70(EnSi* this, PlayState* play);
|
||||
void func_8098CBDC(EnSi* this, PlayState* play);
|
||||
void EnSi_DraggedByHookshot(EnSi* this, PlayState* play);
|
||||
|
||||
#if 0
|
||||
ActorInit En_Si_InitVars = {
|
||||
ACTOR_EN_SI,
|
||||
ACTORCAT_ITEMACTION,
|
||||
|
|
@ -31,18 +29,29 @@ ActorInit En_Si_InitVars = {
|
|||
(ActorFunc)EnSi_Draw,
|
||||
};
|
||||
|
||||
// static ColliderSphereInit sSphereInit = {
|
||||
static ColliderSphereInit D_8098CD80 = {
|
||||
{ COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_NO_PUSH | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_SPHERE, },
|
||||
{ ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_ON | BUMP_HOOKABLE, OCELEM_ON, },
|
||||
static ColliderSphereInit sSphereInit = {
|
||||
{
|
||||
COLTYPE_NONE,
|
||||
AT_NONE,
|
||||
AC_ON | AC_TYPE_PLAYER,
|
||||
OC1_ON | OC1_NO_PUSH | OC1_TYPE_ALL,
|
||||
OC2_TYPE_1,
|
||||
COLSHAPE_SPHERE,
|
||||
},
|
||||
{
|
||||
ELEMTYPE_UNK0,
|
||||
{ 0xF7CFFFFF, 0x00, 0x00 },
|
||||
{ 0xF7CFFFFF, 0x00, 0x00 },
|
||||
TOUCH_ON | TOUCH_SFX_NORMAL,
|
||||
BUMP_ON | BUMP_HOOKABLE,
|
||||
OCELEM_ON,
|
||||
},
|
||||
{ 0, { { 0, 0, 0 }, 10 }, 100 },
|
||||
};
|
||||
|
||||
// sColChkInfoInit
|
||||
static CollisionCheckInfoInit2 D_8098CDAC = { 1, 0, 0, 0, MASS_IMMOVABLE };
|
||||
static CollisionCheckInfoInit2 sColChkInfoInit = { 1, 0, 0, 0, MASS_IMMOVABLE };
|
||||
|
||||
// static DamageTable sDamageTable = {
|
||||
static DamageTable D_8098CDB8 = {
|
||||
static DamageTable sDamageTable = {
|
||||
/* Deku Nut */ DMG_ENTRY(1, 0x0),
|
||||
/* Deku Stick */ DMG_ENTRY(1, 0x0),
|
||||
/* Horse trample */ DMG_ENTRY(1, 0x0),
|
||||
|
|
@ -77,24 +86,79 @@ static DamageTable D_8098CDB8 = {
|
|||
/* Powder Keg */ DMG_ENTRY(1, 0x0),
|
||||
};
|
||||
|
||||
#endif
|
||||
void EnSi_UpdateCollision(EnSi* this, PlayState* play) {
|
||||
this->collider.dim.worldSphere.center.x = this->actor.world.pos.x;
|
||||
this->collider.dim.worldSphere.center.y = this->actor.world.pos.y;
|
||||
this->collider.dim.worldSphere.center.z = this->actor.world.pos.z;
|
||||
this->collider.dim.worldSphere.radius = this->collider.dim.modelSphere.radius * this->collider.dim.scale;
|
||||
if (this->actor.colChkInfo.health > 0) {
|
||||
CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base);
|
||||
}
|
||||
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
|
||||
}
|
||||
|
||||
extern ColliderSphereInit D_8098CD80;
|
||||
extern CollisionCheckInfoInit2 D_8098CDAC;
|
||||
extern DamageTable D_8098CDB8;
|
||||
void EnSi_GiveToken(EnSi* this, PlayState* play) {
|
||||
s32 chestFlag = ENSI_GET_CHEST_FLAG(&this->actor);
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Si/func_8098CA20.s")
|
||||
if ((chestFlag < 0x20) && (chestFlag >= 0)) {
|
||||
Flags_SetTreasure(play, chestFlag);
|
||||
}
|
||||
Item_Give(play, ITEM_SKULL_TOKEN);
|
||||
if (Inventory_GetSkullTokenCount(play->sceneId) >= 30) {
|
||||
Message_StartTextbox(play, 0xFC, NULL);
|
||||
Audio_PlayFanfare(NA_BGM_GET_ITEM | 0x900);
|
||||
} else {
|
||||
Message_StartTextbox(play, 0x52, NULL);
|
||||
Audio_PlayFanfare(NA_BGM_GET_SMALL_ITEM);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Si/func_8098CAD0.s")
|
||||
void EnSi_Wait(EnSi* this, PlayState* play) {
|
||||
if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_2000)) {
|
||||
this->actionFunc = EnSi_DraggedByHookshot;
|
||||
} else if (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) {
|
||||
EnSi_GiveToken(this, play);
|
||||
Actor_Kill(&this->actor);
|
||||
return;
|
||||
}
|
||||
this->actor.shape.rot.y += 0x38E;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Si/func_8098CB70.s")
|
||||
void EnSi_DraggedByHookshot(EnSi* this, PlayState* play) {
|
||||
if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_2000)) {
|
||||
EnSi_GiveToken(this, play);
|
||||
Actor_Kill(&this->actor);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Si/func_8098CBDC.s")
|
||||
void EnSi_Init(Actor* thisx, PlayState* play) {
|
||||
EnSi* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Si/EnSi_Init.s")
|
||||
Collider_InitSphere(play, &this->collider);
|
||||
Collider_SetSphere(play, &this->collider, &this->actor, &sSphereInit);
|
||||
CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit);
|
||||
Actor_SetScale(&this->actor, 0.25f);
|
||||
this->actionFunc = EnSi_Wait;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Si/EnSi_Destroy.s")
|
||||
void EnSi_Destroy(Actor* thisx, PlayState* play) {
|
||||
EnSi* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Si/EnSi_Update.s")
|
||||
Collider_DestroySphere(play, &this->collider);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Si/EnSi_Draw.s")
|
||||
void EnSi_Update(Actor* thisx, PlayState* play) {
|
||||
EnSi* this = THIS;
|
||||
|
||||
this->actionFunc(this, play);
|
||||
EnSi_UpdateCollision(this, play);
|
||||
Actor_SetFocus(&this->actor, 0.0f);
|
||||
}
|
||||
|
||||
void EnSi_Draw(Actor* thisx, PlayState* play) {
|
||||
EnSi* this = THIS;
|
||||
|
||||
func_800B8118(&this->actor, play, 0);
|
||||
func_800B8050(&this->actor, play, 0);
|
||||
GetItem_Draw(play, GID_SKULL_TOKEN_2);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include "global.h"
|
||||
|
||||
#define ENSI_GET_CHEST_FLAG(thisx) (((thisx)->params & 0xFC) >> 2)
|
||||
|
||||
struct EnSi;
|
||||
|
||||
typedef void (*EnSiActionFunc)(struct EnSi*, PlayState*);
|
||||
|
|
@ -10,7 +12,7 @@ typedef void (*EnSiActionFunc)(struct EnSi*, PlayState*);
|
|||
typedef struct EnSi {
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x144 */ EnSiActionFunc actionFunc;
|
||||
/* 0x148 */ char unk_148[0x58];
|
||||
/* 0x148 */ ColliderSphere collider;
|
||||
} EnSi; // size = 0x1A0
|
||||
|
||||
#endif // Z_EN_SI_H
|
||||
|
|
|
|||
|
|
@ -8354,10 +8354,10 @@
|
|||
0x8098BFB8:("EnDg_OverrideLimbDraw",),
|
||||
0x8098BFD4:("EnDg_PostLimbDraw",),
|
||||
0x8098C06C:("EnDg_Draw",),
|
||||
0x8098CA20:("func_8098CA20",),
|
||||
0x8098CAD0:("func_8098CAD0",),
|
||||
0x8098CB70:("func_8098CB70",),
|
||||
0x8098CBDC:("func_8098CBDC",),
|
||||
0x8098CA20:("EnSi_UpdateCollision",),
|
||||
0x8098CAD0:("EnSi_GiveToken",),
|
||||
0x8098CB70:("EnSi_Wait",),
|
||||
0x8098CBDC:("EnSi_DraggedByHookshot",),
|
||||
0x8098CC18:("EnSi_Init",),
|
||||
0x8098CC98:("EnSi_Destroy",),
|
||||
0x8098CCC4:("EnSi_Update",),
|
||||
|
|
|
|||
|
|
@ -9189,9 +9189,9 @@
|
|||
0x8098C498:("D_8098C498","f32","",0x4),
|
||||
0x8098C49C:("jtbl_8098C49C","UNK_PTR","",0x4),
|
||||
0x8098CD60:("En_Si_InitVars","UNK_TYPE1","",0x1),
|
||||
0x8098CD80:("D_8098CD80","UNK_TYPE1","",0x1),
|
||||
0x8098CDAC:("D_8098CDAC","UNK_PTR","",0x4),
|
||||
0x8098CDB8:("D_8098CDB8","UNK_TYPE1","",0x1),
|
||||
0x8098CD80:("sSphereInit","UNK_TYPE1","",0x1),
|
||||
0x8098CDAC:("sColChkInfoInit","UNK_PTR","",0x4),
|
||||
0x8098CDB8:("sDamageTable","UNK_TYPE1","",0x1),
|
||||
0x8098E420:("Obj_Comb_InitVars","UNK_TYPE1","",0x1),
|
||||
0x8098E440:("D_8098E440","UNK_TYPE1","",0x1),
|
||||
0x8098E464:("D_8098E464","UNK_TYPE1","",0x1),
|
||||
|
|
|
|||
Loading…
Reference in New Issue