mirror of
https://github.com/zeldaret/mm.git
synced 2024-11-27 06:40:36 +00:00
ovl_Bg_Ikninside OK (#848)
* ovl_Bg_Ikninside decompiled * PR review fixes * pr review fixes * pr review fixes Co-authored-by: SonicDcer <noreply@github.com>
This commit is contained in:
parent
8d6b4d68ad
commit
2c10d51022
3
spec
3
spec
@ -4936,8 +4936,7 @@ beginseg
|
||||
name "ovl_Bg_Ikninside"
|
||||
compress
|
||||
include "build/src/overlays/actors/ovl_Bg_Ikninside/z_bg_ikninside.o"
|
||||
include "build/data/ovl_Bg_Ikninside/ovl_Bg_Ikninside.data.o"
|
||||
include "build/data/ovl_Bg_Ikninside/ovl_Bg_Ikninside.reloc.o"
|
||||
include "build/src/overlays/actors/ovl_Bg_Ikninside/ovl_Bg_Ikninside_reloc.o"
|
||||
endseg
|
||||
|
||||
beginseg
|
||||
|
@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "z_bg_ikninside.h"
|
||||
#include "objects/object_ikninside_obj/object_ikninside_obj.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_10)
|
||||
|
||||
@ -15,7 +16,8 @@ void BgIkninside_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
void BgIkninside_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void BgIkninside_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
#if 0
|
||||
void func_80C072D0(BgIkninside* this, GlobalContext* globalCtx);
|
||||
|
||||
const ActorInit Bg_Ikninside_InitVars = {
|
||||
ACTOR_BG_IKNINSIDE,
|
||||
ACTORCAT_BG,
|
||||
@ -28,30 +30,128 @@ const ActorInit Bg_Ikninside_InitVars = {
|
||||
(ActorFunc)BgIkninside_Draw,
|
||||
};
|
||||
|
||||
// static ColliderCylinderInit sCylinderInit = {
|
||||
static ColliderCylinderInit D_80C076A8 = {
|
||||
{ COLTYPE_NONE, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_PLAYER, OC2_TYPE_1, COLSHAPE_CYLINDER, },
|
||||
{ ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x80000008, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_NONE, },
|
||||
static Gfx* D_80C076A0[] = { object_ikninside_obj_DL_00A748, object_ikninside_obj_DL_00A5A8 };
|
||||
|
||||
static ColliderCylinderInit sCylinderInit = {
|
||||
{
|
||||
COLTYPE_NONE,
|
||||
AT_NONE,
|
||||
AC_ON | AC_TYPE_PLAYER,
|
||||
OC1_ON | OC1_TYPE_PLAYER,
|
||||
OC2_TYPE_1,
|
||||
COLSHAPE_CYLINDER,
|
||||
},
|
||||
{
|
||||
ELEMTYPE_UNK0,
|
||||
{ 0x00000000, 0x00, 0x00 },
|
||||
{ 0x80000008, 0x00, 0x00 },
|
||||
TOUCH_NONE | TOUCH_SFX_NORMAL,
|
||||
BUMP_ON,
|
||||
OCELEM_NONE,
|
||||
},
|
||||
{ 32, 32, 0, { 0, 0, 0 } },
|
||||
};
|
||||
|
||||
#endif
|
||||
void BgIkninside_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgIkninside* this = THIS;
|
||||
CollisionHeader* colHeader = NULL;
|
||||
s32 pad;
|
||||
|
||||
extern ColliderCylinderInit D_80C076A8;
|
||||
Actor_SetScale(&this->dyna.actor, 0.1f);
|
||||
this->actionFunc = func_80C072D0;
|
||||
DynaPolyActor_Init(&this->dyna, 0);
|
||||
CollisionHeader_GetVirtual(&object_ikninside_obj_Colheader_00DE48, &colHeader);
|
||||
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
|
||||
Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit);
|
||||
Collider_UpdateCylinder(&this->dyna.actor, &this->collider);
|
||||
if (Flags_GetSwitch(globalCtx, DMIKNINSIDE_GET_SWITCH(thisx))) {
|
||||
Actor_MarkForDeath(&this->dyna.actor);
|
||||
}
|
||||
}
|
||||
|
||||
extern UNK_TYPE D_0600CC78;
|
||||
extern UNK_TYPE D_0600DE48;
|
||||
void BgIkninside_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgIkninside* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Ikninside/BgIkninside_Init.s")
|
||||
Collider_DestroyCylinder(globalCtx, &this->collider);
|
||||
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Ikninside/BgIkninside_Destroy.s")
|
||||
void func_80C07220(BgIkninside* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Ikninside/func_80C07220.s")
|
||||
void func_80C07230(BgIkninside* this, GlobalContext* globalCtx) {
|
||||
if (this->dyna.actor.cutscene == -1) {
|
||||
this->actionFunc = func_80C07220;
|
||||
} else if (ActorCutscene_GetCurrentIndex() == 0x7C) {
|
||||
ActorCutscene_Stop(0x7C);
|
||||
ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene);
|
||||
} else if (ActorCutscene_GetCanPlayNext(this->dyna.actor.cutscene)) {
|
||||
ActorCutscene_StartAndSetUnkLinkFields(this->dyna.actor.cutscene, &this->dyna.actor);
|
||||
this->actionFunc = func_80C07220;
|
||||
} else {
|
||||
ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Ikninside/func_80C07230.s")
|
||||
static Vec3f D_80C076D4 = { 0.0f, -1.0f, 0.0f };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Ikninside/func_80C072D0.s")
|
||||
void func_80C072D0(BgIkninside* this, GlobalContext* globalCtx) {
|
||||
s16 altitude;
|
||||
s16 azimuth;
|
||||
Vec3f pos;
|
||||
Vec3f velocity;
|
||||
f32 speed;
|
||||
s32 i;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Ikninside/BgIkninside_Update.s")
|
||||
if (this->collider.base.acFlags & AC_HIT) {
|
||||
if ((this->collider.info.acHitInfo != NULL) && (this->collider.info.acHitInfo->toucher.dmgFlags & 0x80000000)) {
|
||||
for (i = 0; i < 20; i++) {
|
||||
altitude = Rand_S16Offset(0x1800, 0x2800);
|
||||
azimuth = (u32)Rand_Next() >> 0x10;
|
||||
speed = Rand_ZeroFloat(3.0f) + 8.0f;
|
||||
velocity.x = speed * Math_CosS(altitude) * Math_SinS(azimuth);
|
||||
velocity.y = speed * Math_SinS(altitude) + Rand_ZeroFloat(5.0f);
|
||||
velocity.z = speed * Math_CosS(altitude) * Math_CosS(azimuth);
|
||||
pos.x = Rand_ZeroFloat(10.0f) * velocity.x + this->dyna.actor.world.pos.x;
|
||||
pos.y = Rand_ZeroFloat(1.0f) * velocity.y + this->dyna.actor.world.pos.y;
|
||||
pos.z = Rand_ZeroFloat(10.0f) * velocity.z + this->dyna.actor.world.pos.z;
|
||||
EffectSsHahen_Spawn(globalCtx, &pos, &velocity, &D_80C076D4, 0, 30, OBJECT_IKNINSIDE_OBJ, 25,
|
||||
D_80C076A0[i & 1]);
|
||||
}
|
||||
Flags_SetSwitch(globalCtx, DMIKNINSIDE_GET_SWITCH(&this->dyna.actor));
|
||||
this->actionFunc = func_80C07230;
|
||||
this->dyna.actor.draw = NULL;
|
||||
func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||
} else {
|
||||
this->timer = 20;
|
||||
}
|
||||
}
|
||||
if (this->timer > 0) {
|
||||
if ((this->timer % 2) != 0) {
|
||||
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - 1.0f;
|
||||
} else {
|
||||
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y;
|
||||
}
|
||||
this->timer--;
|
||||
} else {
|
||||
this->timer = 0;
|
||||
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y;
|
||||
}
|
||||
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Ikninside/BgIkninside_Draw.s")
|
||||
void BgIkninside_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgIkninside* this = THIS;
|
||||
|
||||
this->actionFunc(this, globalCtx);
|
||||
}
|
||||
|
||||
void BgIkninside_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
func_8012C28C(globalCtx->state.gfxCtx);
|
||||
gSPDisplayList(POLY_OPA_DISP++, object_ikninside_obj_DL_00CC78);
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx);
|
||||
}
|
||||
|
@ -5,14 +5,16 @@
|
||||
|
||||
struct BgIkninside;
|
||||
|
||||
#define DMIKNINSIDE_GET_SWITCH(thisx) (((thisx)->params & 0xFE00) >> 9)
|
||||
|
||||
typedef void (*BgIkninsideActionFunc)(struct BgIkninside*, GlobalContext*);
|
||||
|
||||
typedef struct BgIkninside {
|
||||
/* 0x0000 */ Actor actor;
|
||||
/* 0x0144 */ char unk_144[0x68];
|
||||
/* 0x01AC */ BgIkninsideActionFunc actionFunc;
|
||||
/* 0x000 */ DynaPolyActor dyna;
|
||||
/* 0x15C */ ColliderCylinder collider;
|
||||
/* 0x1A8 */ UNK_TYPE1 pad_1A8[2];
|
||||
/* 0x1AA */ s16 timer;
|
||||
/* 0x1AC */ BgIkninsideActionFunc actionFunc;
|
||||
} BgIkninside; // size = 0x1B0
|
||||
|
||||
extern const ActorInit Bg_Ikninside_InitVars;
|
||||
|
||||
#endif // Z_BG_IKNINSIDE_H
|
||||
|
@ -626,11 +626,6 @@ D_06001AD8 = 0x06001AD8;
|
||||
D_06001E18 = 0x06001E18;
|
||||
D_06002358 = 0x06002358;
|
||||
|
||||
// ovl_Bg_Ikninside
|
||||
|
||||
D_0600CC78 = 0x0600CC78;
|
||||
D_0600DE48 = 0x0600DE48;
|
||||
|
||||
// ovl_Bg_Iknv_Doukutu
|
||||
|
||||
D_0600DB60 = 0x0600DB60;
|
||||
|
Loading…
Reference in New Issue
Block a user