ovl_Mir_Ray2 OK (#981)

* `ovl_Mir_Ray2` decompiled

* Suggested changes
This commit is contained in:
Lucas 2022-08-09 20:26:35 -04:00 committed by GitHub
parent 75aad26df1
commit 1afeaaf734
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 96 additions and 20 deletions

3
spec
View File

@ -3556,8 +3556,7 @@ beginseg
name "ovl_Mir_Ray2"
compress
include "build/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.o"
include "build/data/ovl_Mir_Ray2/ovl_Mir_Ray2.data.o"
include "build/data/ovl_Mir_Ray2/ovl_Mir_Ray2.reloc.o"
include "build/src/overlays/actors/ovl_Mir_Ray2/ovl_Mir_Ray2_reloc.o"
endseg
beginseg

View File

@ -15,7 +15,6 @@ void MirRay2_Destroy(Actor* thisx, PlayState* play);
void MirRay2_Update(Actor* thisx, PlayState* play);
void MirRay2_Draw(Actor* thisx, PlayState* play);
#if 0
const ActorInit Mir_Ray2_InitVars = {
ACTOR_MIR_RAY2,
ACTORCAT_ITEMACTION,
@ -28,33 +27,102 @@ const ActorInit Mir_Ray2_InitVars = {
(ActorFunc)MirRay2_Draw,
};
// static ColliderJntSphElementInit sJntSphElementsInit[1] = {
static ColliderJntSphElementInit D_80AF4350[1] = {
static ColliderJntSphElementInit sJntSphElementsInit[1] = {
{
{ ELEMTYPE_UNK0, { 0x00200000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, TOUCH_ON | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_NONE, },
{
ELEMTYPE_UNK0,
{ 0x00200000, 0x00, 0x00 },
{ 0x00000000, 0x00, 0x00 },
TOUCH_ON | TOUCH_SFX_NORMAL,
BUMP_NONE,
OCELEM_NONE,
},
{ 0, { { 0, 0, 0 }, 50 }, 100 },
},
};
// static ColliderJntSphInit sJntSphInit = {
static ColliderJntSphInit D_80AF4374 = {
{ COLTYPE_NONE, AT_ON | AT_TYPE_OTHER, AC_NONE, OC1_NONE, OC2_NONE, COLSHAPE_JNTSPH, },
ARRAY_COUNT(sJntSphElementsInit), D_80AF4350, // sJntSphElementsInit,
static ColliderJntSphInit sJntSphInit = {
{
COLTYPE_NONE,
AT_ON | AT_TYPE_OTHER,
AC_NONE,
OC1_NONE,
OC2_NONE,
COLSHAPE_JNTSPH,
},
ARRAY_COUNT(sJntSphElementsInit),
sJntSphElementsInit,
};
#endif
void func_80AF3F70(MirRay2* this) {
this->collider.elements->dim.worldSphere.center.x = this->actor.world.pos.x;
this->collider.elements->dim.worldSphere.center.y = this->actor.world.pos.y;
this->collider.elements->dim.worldSphere.center.z = this->actor.world.pos.z;
this->collider.elements->dim.worldSphere.radius = this->range * this->collider.elements->dim.scale;
}
extern ColliderJntSphElementInit D_80AF4350[1];
extern ColliderJntSphInit D_80AF4374;
void func_80AF3FE0(MirRay2* this, PlayState* play) {
if (this->actor.xzDistToPlayer < this->range) {
Math_StepToS(&this->radius, 150, 50);
} else {
Math_StepToS(&this->radius, 0, 50);
}
Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, this->actor.world.pos.y + 100.0f,
this->actor.world.pos.z, 255, 255, 255, this->radius);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Mir_Ray2/func_80AF3F70.s")
void MirRay2_Init(Actor* thisx, PlayState* play) {
s32 pad;
MirRay2* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Mir_Ray2/func_80AF3FE0.s")
if (this->actor.home.rot.x <= 0) {
this->range = 100.0f;
} else {
this->range = this->actor.home.rot.x * 4.0f;
}
Actor_SetScale(&this->actor, 1.0f);
if (MIRRAY2_GET_F(&this->actor) != 1) {
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawWhiteCircle, this->range * 0.02f);
}
func_80AF3FE0(this, play);
this->light = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo);
Collider_InitJntSph(play, &this->collider);
Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, &this->elements);
func_80AF3F70(this);
this->actor.shape.rot.x = 0;
this->actor.world.rot.x = this->actor.shape.rot.x;
if (MIRRAY2_GET_F(thisx) != 1) {
if ((MIRRAY2_GET_SWITCH_FLAGS(thisx) != 0x7F) && !Flags_GetSwitch(play, MIRRAY2_GET_SWITCH_FLAGS(thisx))) {
this->unk1A4 |= 1;
}
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Mir_Ray2/MirRay2_Init.s")
void MirRay2_Destroy(Actor* thisx, PlayState* play) {
MirRay2* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Mir_Ray2/MirRay2_Destroy.s")
LightContext_RemoveLight(play, &play->lightCtx, this->light);
Collider_DestroyJntSph(play, &this->collider);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Mir_Ray2/MirRay2_Update.s")
void MirRay2_Update(Actor* thisx, PlayState* play) {
MirRay2* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Mir_Ray2/MirRay2_Draw.s")
if (this->unk1A4 & 1) {
if (Flags_GetSwitch(play, MIRRAY2_GET_SWITCH_FLAGS(thisx))) {
this->unk1A4 &= ~1;
}
} else {
func_80AF3FE0(this, play);
if (MIRRAY2_GET_F(thisx) != 1) {
Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 10.0f, 4);
this->actor.shape.shadowAlpha = 0x50;
} else {
func_80AF3F70(this);
}
CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base);
}
}
void MirRay2_Draw(Actor* thisx, PlayState* play) {
}

View File

@ -5,9 +5,18 @@
struct MirRay2;
#define MIRRAY2_GET_F(thisx) ((thisx)->params & 0xF)
#define MIRRAY2_GET_SWITCH_FLAGS(thisx) (((thisx)->params & 0xFE00) >> 9)
typedef struct MirRay2 {
/* 0x000 */ Actor actor;
/* 0x144 */ char unk_144[0x7C];
/* 0x144 */ ColliderJntSph collider;
/* 0x164 */ ColliderJntSphElement elements;
/* 0x1A4 */ u16 unk1A4;
/* 0x1A6 */ s16 radius;
/* 0x1A8 */ f32 range;
/* 0x1AC */ LightNode* light;
/* 0x1B0 */ LightInfo lightInfo;
} MirRay2; // size = 0x1C0
extern const ActorInit Mir_Ray2_InitVars;