mirror of https://github.com/zeldaret/mm.git
Z_obj_bell Matching (#167)
* ringing in the bell * another matching func * stuck on func_80A357A8, needs a z_actor func... * no luck on a fix, but got further... * matched func_80A357A8, one left * might be on the right track? saving progress... * getting closer * pushing up matching, it has warnign regarding Vecs * all functions matching * obj_bell OK, time for bed * prepping for PR * fixing suggestions
This commit is contained in:
parent
631225a626
commit
2bf68a5263
|
@ -822,7 +822,7 @@ void func_800B8C50(Actor* actor, GlobalContext* globalCtx);
|
|||
// void func_800B8CEC(void);
|
||||
// void func_800B8D10(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7);
|
||||
// void func_800B8D50(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
|
||||
// void func_800B8D98(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5);
|
||||
void func_800B8D98(GlobalContext* globalCtx, Actor* actor, f32 param_3, s16 param_4, f32 param_5);
|
||||
// void func_800B8DD4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
|
||||
// void func_800B8E1C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5);
|
||||
// void func_800B8E58(void);
|
||||
|
|
|
@ -4478,9 +4478,9 @@ SECTIONS
|
|||
ovl_Obj_Bell : AT(RomLocation)
|
||||
{
|
||||
build/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.o(.text)
|
||||
build/asm/overlays/ovl_Obj_Bell_data.o(.data)
|
||||
build/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.o(.data)
|
||||
build/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.o(.rodata)
|
||||
build/asm/overlays/ovl_Obj_Bell_rodata.o(.rodata)
|
||||
build/src/overlays/actors/ovl_Obj_Bell/z_obj_bell_overlay.o(.ovl)
|
||||
}
|
||||
SegmentEnd = .;
|
||||
SegmentSize = SegmentEnd - SegmentStart;
|
||||
|
|
|
@ -284,6 +284,15 @@ D_060004B0 = 0x060004B0;
|
|||
/* z_en_jc_mato */
|
||||
D_06000390 = 0x06000390;
|
||||
|
||||
/* obj_bell */
|
||||
D_06001BA8 = 0x06001BA8;
|
||||
D_06000840 = 0x06000840;
|
||||
D_06000570 = 0x06000570;
|
||||
D_06000698 = 0x06000698;
|
||||
D_060008D0 = 0x060008D0;
|
||||
D_06000960 = 0x06000960;
|
||||
D_060007A8 = 0x060007A8;
|
||||
|
||||
/* z_en_fg */
|
||||
D_06001534 = 0x06001534;
|
||||
D_060011C0 = 0x060011C0;
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
/*
|
||||
* File: z_ovl_obj_bell.c
|
||||
* Overlay: ovl_Obj_Bell
|
||||
* Description: Stock Pot Inn Bell
|
||||
*/
|
||||
|
||||
#include "z_obj_bell.h"
|
||||
|
||||
#define FLAGS 0x00000030
|
||||
|
@ -9,7 +15,9 @@ void ObjBell_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
|||
void ObjBell_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void ObjBell_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
/*
|
||||
s32 func_80A356D8(ObjBell* this);
|
||||
s32 func_80A357A8(ObjBell* this, GlobalContext* globalCtx);
|
||||
|
||||
const ActorInit Obj_Bell_InitVars = {
|
||||
ACTOR_OBJ_BELL,
|
||||
ACTORCAT_PROP,
|
||||
|
@ -21,26 +29,250 @@ const ActorInit Obj_Bell_InitVars = {
|
|||
(ActorFunc)ObjBell_Update,
|
||||
(ActorFunc)ObjBell_Draw,
|
||||
};
|
||||
*/
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Bell_0x80A35510/func_80A35510.asm")
|
||||
// Bell Post?
|
||||
static ColliderSphereInit sCylinderInit1 = {
|
||||
{
|
||||
COLTYPE_METAL,
|
||||
AT_ON | AT_TYPE_ENEMY,
|
||||
AC_NONE,
|
||||
OC1_ON | OC1_TYPE_ALL,
|
||||
OC2_TYPE_1,
|
||||
COLSHAPE_SPHERE,
|
||||
},
|
||||
{
|
||||
ELEMTYPE_UNK2,
|
||||
{ 0x20000000, 0x00, 0x04 },
|
||||
{ 0x00000000, 0x00, 0x00 },
|
||||
TOUCH_ON | TOUCH_SFX_NORMAL,
|
||||
BUMP_NONE,
|
||||
OCELEM_ON,
|
||||
},
|
||||
{ 0, { { 0, 960, 0 }, 70 }, 100 },
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Bell_0x80A35510/func_80A356D8.asm")
|
||||
// Bell
|
||||
static ColliderSphereInit sCylinderInit2 = {
|
||||
{
|
||||
COLTYPE_METAL,
|
||||
AT_NONE,
|
||||
AC_ON | AC_TYPE_PLAYER,
|
||||
OC1_NONE,
|
||||
OC2_TYPE_1,
|
||||
COLSHAPE_SPHERE,
|
||||
},
|
||||
{
|
||||
ELEMTYPE_UNK2,
|
||||
{ 0x00000000, 0x00, 0x00 },
|
||||
{ 0xF7CFFFFF, 0x00, 0x00 },
|
||||
TOUCH_NONE | TOUCH_SFX_NORMAL,
|
||||
BUMP_ON,
|
||||
OCELEM_NONE,
|
||||
},
|
||||
{ 0, { { 0, 1100, 0 }, 74 }, 100 },
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Bell_0x80A35510/func_80A357A8.asm")
|
||||
static CollisionCheckInfoInit2 sColChkInfoInit2 = {
|
||||
0, 0, 0, 0, MASS_IMMOVABLE,
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Bell_0x80A35510/func_80A358FC.asm")
|
||||
static DamageTable sDamageTable = {
|
||||
0x01, 0x01, 0x01, 0xE1, 0x01, 0x01, 0x01, 0x01, 0xF1, 0x01, 0x01, 0x01, 0x01, 0x01, 0xF1, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0xE1,
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Bell_0x80A35510/func_80A359B4.asm")
|
||||
extern CollisionHeader D_06001BA8;
|
||||
extern Gfx D_06000570[]; // Bell post
|
||||
extern Gfx D_06000698[]; // Bell
|
||||
extern Gfx D_060007A8[]; // Bell Base
|
||||
extern Gfx D_06000840[]; // Bell Shadow
|
||||
extern Gfx D_060008D0[]; // Bell Hook
|
||||
extern Gfx D_06000960[]; // Bell Designs
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Bell_0x80A35510/func_80A35B18.asm")
|
||||
s32 func_80A35510(ObjBell* this, s32 arg1) {
|
||||
Vec3f bumperPos;
|
||||
Vec3f worldPos;
|
||||
s32 phi_a3 = false;
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Bell_0x80A35510/func_80A35BD4.asm")
|
||||
if (((arg1 == 0) && (this->unk_21C < 1000.0f)) || ((arg1 == 1) && (this->unk_21C < 4000.0f)) || (arg1 == 2)) {
|
||||
phi_a3 = true;
|
||||
} else {
|
||||
phi_a3 = phi_a3;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Bell_0x80A35510/ObjBell_Init.asm")
|
||||
switch (arg1) {
|
||||
case 0:
|
||||
this->unk_21C += this->unk_21C > 1000.0f ? 250.0f : 1000.0f;
|
||||
break;
|
||||
case 1:
|
||||
this->unk_21C += this->unk_21C > 3000.0f ? 750.0f : 3000.0f;
|
||||
break;
|
||||
case 2:
|
||||
if (1) {}
|
||||
this->unk_21C += 9000.0f;
|
||||
break;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Bell_0x80A35510/ObjBell_Destroy.asm")
|
||||
this->unk_21C = CLAMP(this->unk_21C, 0.0f, 18000.0f);
|
||||
if (phi_a3 == true) {
|
||||
Math_Vec3s_ToVec3f(&bumperPos, &this->collider2.info.bumper.hitPos);
|
||||
Math_Vec3f_Copy(&worldPos, &this->dyna.actor.world.pos);
|
||||
this->dyna.actor.world.rot.y = Math_Vec3f_Yaw(&bumperPos, &worldPos);
|
||||
if (this->unk_20C <= 0x4000 && this->unk_20C >= -0x4000) {
|
||||
this->unk_20C -= 0x4000;
|
||||
} else {
|
||||
this->unk_20C += 0x4000;
|
||||
}
|
||||
}
|
||||
return phi_a3;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Bell_0x80A35510/ObjBell_Update.asm")
|
||||
s32 func_80A356D8(ObjBell* this) {
|
||||
f32 scaleProjection;
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Bell_0x80A35510/ObjBell_Draw.asm")
|
||||
this->unk_212 = this->dyna.actor.world.rot.y;
|
||||
if (this->unk_20C >= 0x4000 || this->unk_20C <= -0x4000) {
|
||||
this->unk_212 -= 0x8000;
|
||||
}
|
||||
scaleProjection = Math_SinS(this->unk_20C) * this->unk_21C;
|
||||
this->dyna.actor.world.rot.x = this->dyna.actor.home.rot.x;
|
||||
this->unk_220 = scaleProjection;
|
||||
this->dyna.actor.world.rot.x += (s16)scaleProjection;
|
||||
Math_ApproachF(&this->unk_21C, 0.0f, 0.03f, 70.0f);
|
||||
if (this->unk_21C > 0.0f) {
|
||||
this->unk_20C -= 0x800;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
s32 func_80A357A8(ObjBell* this, GlobalContext* globalCtx) {
|
||||
f32 temp_f0;
|
||||
s16 temp_v1;
|
||||
|
||||
if (this->collider1.base.ocFlags1 & 2) {
|
||||
this->collider1.base.ocFlags1 &= ~2;
|
||||
temp_v1 = this->dyna.actor.yawTowardsPlayer - this->unk_212;
|
||||
temp_f0 = this->unk_21C / 18000.0f;
|
||||
if (ABS_ALT(temp_v1) < 0x3FFC) {
|
||||
if (this->unk_214 == 0) {
|
||||
if (temp_f0 > 0.18f) {
|
||||
func_800B8D98(globalCtx, &this->dyna.actor, 8.0f * temp_f0, this->dyna.actor.yawTowardsPlayer,
|
||||
11.0f * temp_f0);
|
||||
this->unk_214 = 30;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this->collider2.base.acFlags & 2) {
|
||||
this->collider2.base.acFlags &= ~2;
|
||||
this->unk_20E = 10;
|
||||
switch (this->dyna.actor.colChkInfo.damageEffect) {
|
||||
case 15:
|
||||
Audio_PlayActorSound2(this, 0x28F3);
|
||||
func_80A35510(this, 1);
|
||||
break;
|
||||
case 14:
|
||||
Audio_PlayActorSound2(this, 0x28F3);
|
||||
func_80A35510(this, 2);
|
||||
break;
|
||||
default:
|
||||
func_80A35510(this, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void func_80A358FC(ObjBell* this, GlobalContext* globalCtx) {
|
||||
this->collider1.dim.worldSphere.radius = (this->collider1.dim.modelSphere.radius * this->collider1.dim.scale);
|
||||
this->collider2.dim.worldSphere.radius = (this->collider2.dim.modelSphere.radius * this->collider2.dim.scale);
|
||||
if (DECR(this->unk_20E) == 0) {
|
||||
CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider2.base);
|
||||
}
|
||||
CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider1.base);
|
||||
}
|
||||
|
||||
void func_80A359B4(Actor* thisx, GlobalContext* globalCtx) {
|
||||
SysMatrix_InsertTranslation(thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, MTXMODE_NEW);
|
||||
Matrix_Scale(thisx->scale.x, thisx->scale.y, thisx->scale.z, MTXMODE_APPLY);
|
||||
SysMatrix_InsertTranslation(0.0f, 2600.0f, 0.0f, MTXMODE_APPLY);
|
||||
Matrix_RotateY(thisx->world.rot.y, MTXMODE_APPLY);
|
||||
SysMatrix_InsertXRotation_s(thisx->world.rot.x, MTXMODE_APPLY);
|
||||
Matrix_RotateY(-thisx->world.rot.y, MTXMODE_APPLY);
|
||||
SysMatrix_InsertTranslation(0.0f, -2600.0f, 0.0f, MTXMODE_APPLY);
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx);
|
||||
func_8012C28C(globalCtx->state.gfxCtx);
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_OPA_DISP++, D_06000698);
|
||||
gSPDisplayList(POLY_OPA_DISP++, D_060008D0);
|
||||
gSPDisplayList(POLY_OPA_DISP++, D_06000960);
|
||||
gSPDisplayList(POLY_OPA_DISP++, D_060007A8);
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx);
|
||||
}
|
||||
|
||||
void func_80A35B18(Actor* thisx, GlobalContext* globalCtx) {
|
||||
SysMatrix_InsertTranslation(thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, MTXMODE_NEW);
|
||||
Matrix_Scale(thisx->scale.x, thisx->scale.y, thisx->scale.z, MTXMODE_APPLY);
|
||||
Matrix_RotateY(thisx->shape.rot.y, MTXMODE_APPLY);
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx);
|
||||
func_8012C28C(globalCtx->state.gfxCtx);
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_OPA_DISP++, D_06000570);
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx);
|
||||
}
|
||||
|
||||
void func_80A35BD4(Actor* thisx, GlobalContext* globalCtx) {
|
||||
SysMatrix_InsertTranslation(thisx->world.pos.x, thisx->world.pos.y - 4.0f, thisx->world.pos.z, MTXMODE_NEW);
|
||||
Matrix_Scale(thisx->scale.x, thisx->scale.y, thisx->scale.z, MTXMODE_APPLY);
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx);
|
||||
func_8012C2DC(globalCtx->state.gfxCtx);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_XLU_DISP++, D_06000840);
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx);
|
||||
}
|
||||
|
||||
void ObjBell_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ObjBell* this = THIS;
|
||||
|
||||
BcCheck3_BgActorInit(&this->dyna, 0);
|
||||
BgCheck3_LoadMesh(globalCtx, &this->dyna, &D_06001BA8);
|
||||
Actor_SetScale(&this->dyna.actor, 0.08f);
|
||||
Collider_InitAndSetSphere(globalCtx, &this->collider1, &this->dyna.actor, &sCylinderInit1);
|
||||
Collider_InitAndSetSphere(globalCtx, &this->collider2, &this->dyna.actor, &sCylinderInit2);
|
||||
CollisionCheck_SetInfo2(&this->dyna.actor.colChkInfo, &sDamageTable, &sColChkInfoInit2);
|
||||
}
|
||||
|
||||
void ObjBell_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ObjBell* this = THIS;
|
||||
|
||||
BgCheck_RemoveActorMesh(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||
Collider_DestroySphere(globalCtx, &this->collider1);
|
||||
Collider_DestroySphere(globalCtx, &this->collider2);
|
||||
}
|
||||
|
||||
void ObjBell_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ObjBell* this = THIS;
|
||||
|
||||
if (this->unk_214 != 0) {
|
||||
this->unk_214--;
|
||||
}
|
||||
func_80A357A8(this, globalCtx);
|
||||
func_80A356D8(this);
|
||||
func_80A358FC(this, globalCtx);
|
||||
}
|
||||
|
||||
void ObjBell_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ObjBell* this = THIS;
|
||||
Vec3f sp30;
|
||||
Vec3f sp24;
|
||||
|
||||
func_80A35B18(thisx, globalCtx);
|
||||
func_80A35BD4(thisx, globalCtx);
|
||||
func_80A359B4(thisx, globalCtx);
|
||||
Math_Vec3s_ToVec3f(&sp30, &this->collider1.dim.modelSphere.center);
|
||||
SysMatrix_MultiplyVector3fByState(&sp30, &sp24);
|
||||
Math_Vec3f_ToVec3s(&this->collider1.dim.worldSphere.center, &sp24);
|
||||
Math_Vec3s_ToVec3f(&sp30, &this->collider2.dim.modelSphere.center);
|
||||
SysMatrix_MultiplyVector3fByState(&sp30, &sp24);
|
||||
Math_Vec3f_ToVec3s(&this->collider2.dim.worldSphere.center, &sp24);
|
||||
}
|
||||
|
|
|
@ -6,8 +6,18 @@
|
|||
struct ObjBell;
|
||||
|
||||
typedef struct ObjBell {
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x144 */ char unk_144[0xE4];
|
||||
/* 0x000 */ DynaPolyActor dyna;
|
||||
/* 0x15C */ ColliderSphere collider1;
|
||||
/* 0x1B4 */ ColliderSphere collider2;
|
||||
/* 0x20C */ s16 unk_20C; // bell rotation angle?
|
||||
/* 0x20E */ s16 unk_20E;
|
||||
/* 0x20E */ s16 unk_20F;
|
||||
/* 0x212 */ s16 unk_212;
|
||||
/* 0x214 */ s16 unk_214;
|
||||
/* 0x216 */ char unk_216[0x06];
|
||||
/* 0x21C */ f32 unk_21C; // bell speed?
|
||||
/* 0x220 */ f32 unk_220;
|
||||
/* 0x224 */ char unk_224[0x04];
|
||||
} ObjBell; // size = 0x228
|
||||
|
||||
extern const ActorInit Obj_Bell_InitVars;
|
||||
|
|
Loading…
Reference in New Issue