summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas <60241136+ordlucas@users.noreply.github.com>2022-08-09 20:26:35 -0400
committerGitHub <noreply@github.com>2022-08-09 20:26:35 -0400
commit1afeaaf73466142faac02433fb71b60bbd559048 (patch)
tree022689296f830d3a07b4f129a769c25c9df83b98
parent75aad26df1a483ca91fba13bcbccd3c51f2720a9 (diff)
ovl_Mir_Ray2 OK (#981)
* `ovl_Mir_Ray2` decompiled * Suggested changes
-rw-r--r--spec3
-rw-r--r--src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.c102
-rw-r--r--src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.h11
3 files changed, 96 insertions, 20 deletions
diff --git a/spec b/spec
index 4d94ff7a4..e4a958742 100644
--- a/spec
+++ b/spec
@@ -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
diff --git a/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.c b/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.c
index 6acbc2689..215b63776 100644
--- a/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.c
+++ b/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.c
@@ -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;
+}
+
+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);
+}
-extern ColliderJntSphElementInit D_80AF4350[1];
-extern ColliderJntSphInit D_80AF4374;
+void MirRay2_Init(Actor* thisx, PlayState* play) {
+ s32 pad;
+ MirRay2* this = THIS;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Mir_Ray2/func_80AF3F70.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/func_80AF3FE0.s")
+void MirRay2_Destroy(Actor* thisx, PlayState* play) {
+ MirRay2* this = THIS;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Mir_Ray2/MirRay2_Init.s")
+ LightContext_RemoveLight(play, &play->lightCtx, this->light);
+ Collider_DestroyJntSph(play, &this->collider);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Mir_Ray2/MirRay2_Destroy.s")
+void MirRay2_Update(Actor* thisx, PlayState* play) {
+ MirRay2* this = THIS;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Mir_Ray2/MirRay2_Update.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);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Mir_Ray2/MirRay2_Draw.s")
+void MirRay2_Draw(Actor* thisx, PlayState* play) {
+}
diff --git a/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.h b/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.h
index 26f478ea3..ac5202bdb 100644
--- a/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.h
+++ b/src/overlays/actors/ovl_Mir_Ray2/z_mir_ray2.h
@@ -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;