* Obj_Toge

* Wat

* One more thing

* PR

* PR

* a

Co-authored-by: EllipticEllipsis <elliptic.ellipsis@gmail.com>
This commit is contained in:
Maide 2022-06-19 03:45:09 +01:00 committed by GitHub
parent af0123de1e
commit 56c517dc07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 277 additions and 36 deletions

View File

@ -563,7 +563,7 @@ void EffectSsKakera_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity,
// void EffectSsIcePiece_Spawn(UNK_TYPE4 uParm1, Vec3f* pzParm2, UNK_TYPE4 uParm3, Vec3f* pzParm4, Vec3f* param_5, UNK_TYPE4 param_6);
// void EffectSsIcePiece_SpawnBurst(void);
// void EffectSsEnIce_SpawnFlyingVec3f(UNK_TYPE4 uParm1, Actor* pzParm2, Vec3f* pzParm3, Color_RGBA8* pzParm4, Color_RGBA8* param_5, UNK_TYPE4 param_6);
// void func_800B2B44(void);
void func_800B2B44(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, f32 arg3);
// void func_800B2B7C(void);
void EffectSsEnIce_Spawn(GlobalContext* globalCtx, Vec3f* pos, f32 scale, Vec3f* velocity, Vec3f* accel, Color_RGBA8* primColor, Color_RGBA8* envColor, s32 life);
// void EffectSsFireTail_Spawn(UNK_TYPE4 uParm1, UNK_TYPE4 uParm2, Vec3f* pzParm3, UNK_TYPE4 uParm4, Vec3f* param_5, UNK_TYPE2 param_6, Color_RGBA8* param_7, Color_RGBA8* param_8, UNK_TYPE2 param_9, UNK_TYPE2 param_10, UNK_TYPE4 param_11);

3
spec
View File

@ -2213,8 +2213,7 @@ beginseg
name "ovl_Obj_Toge"
compress
include "build/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.o"
include "build/data/ovl_Obj_Toge/ovl_Obj_Toge.data.o"
include "build/data/ovl_Obj_Toge/ovl_Obj_Toge.reloc.o"
include "build/src/overlays/actors/ovl_Obj_Toge/ovl_Obj_Toge_reloc.o"
endseg
beginseg

View File

@ -5,6 +5,7 @@
*/
#include "z_obj_toge.h"
#include "objects/object_trap/object_trap.h"
#define FLAGS (ACTOR_FLAG_10)
@ -15,11 +16,13 @@ void ObjToge_Destroy(Actor* thisx, GlobalContext* globalCtx);
void ObjToge_Update(Actor* thisx, GlobalContext* globalCtx);
void ObjToge_Draw(Actor* thisx, GlobalContext* globalCtx);
void func_809A4744(ObjToge* this);
void func_809A477C(ObjToge* this, GlobalContext* globalCtx);
void func_809A4804(ObjToge* this);
void func_809A481C(ObjToge* this, GlobalContext* globalCtx);
void func_809A488C(ObjToge* this);
void func_809A48AC(ObjToge* this, GlobalContext* globalCtx);
#if 0
const ActorInit Obj_Toge_InitVars = {
ACTOR_OBJ_TOGE,
ACTORCAT_PROP,
@ -32,52 +35,280 @@ const ActorInit Obj_Toge_InitVars = {
(ActorFunc)ObjToge_Draw,
};
// static ColliderCylinderInit sCylinderInit = {
static ColliderCylinderInit D_809A4CB0 = {
{ COLTYPE_METAL, AT_NONE, AC_ON | AC_HARD | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_2, COLSHAPE_CYLINDER, },
{ ELEMTYPE_UNK0, { 0x00000000, 0x00, 0x00 }, { 0x01C37BB6, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, },
static ColliderCylinderInit sCylinderInit = {
{
COLTYPE_METAL,
AT_NONE,
AC_ON | AC_HARD | AC_TYPE_PLAYER,
OC1_ON | OC1_TYPE_ALL,
OC2_TYPE_2,
COLSHAPE_CYLINDER,
},
{
ELEMTYPE_UNK0,
{ 0x00000000, 0x00, 0x00 },
{ 0x01C37BB6, 0x00, 0x00 },
TOUCH_NONE | TOUCH_SFX_NORMAL,
BUMP_ON,
OCELEM_ON,
},
{ 30, 20, 0, { 0, 0, 0 } },
};
// static InitChainEntry sInitChain[] = {
static InitChainEntry D_809A4D14[] = {
f32 D_809A4CDC[] = { 2.0f, 4.0f, 6.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f };
s16 D_809A4CFC[] = { 0, 10, 20, 30, 40, 50, 60, 70 };
f32 D_809A4D0C[] = { 1.0f, 2.0f };
static InitChainEntry sInitChain[] = {
ICHAIN_F32_DIV1000(terminalVelocity, 0, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneScale, 150, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneDownward, 150, ICHAIN_STOP),
};
#endif
void func_809A41C0(ObjToge* this, GlobalContext* globalCtx) {
Vec3f sp1C = this->actor.world.pos;
extern ColliderCylinderInit D_809A4CB0;
extern InitChainEntry D_809A4D14[];
sp1C.y += 10.0f;
sp1C.z += 10.0f;
func_800B2B44(globalCtx, &this->actor, &sp1C, 1.8f);
extern UNK_TYPE D_06001400;
sp1C.x += 10.0f;
sp1C.z -= 20.0f;
func_800B2B44(globalCtx, &this->actor, &sp1C, 1.8f);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Toge/func_809A41C0.s")
sp1C.x -= 20.0f;
func_800B2B44(globalCtx, &this->actor, &sp1C, 1.8f);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Toge/func_809A42A0.s")
void func_809A42A0(ObjToge* this, GlobalContext* globalCtx) {
Vec3f sp54;
s32 i;
s16 phi_s0;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Toge/func_809A43A8.s")
sp54.y = this->actor.world.pos.y + 15.0f;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Toge/func_809A43EC.s")
for (i = 0, phi_s0 = 0; i < 5; i++, phi_s0 += 0x3333) {
sp54.x = (Math_SinS(phi_s0) * 15.0f) + this->actor.world.pos.x;
sp54.z = (Math_CosS(phi_s0) * 15.0f) + this->actor.world.pos.z;
func_800B2B44(globalCtx, &this->actor, &sp54, (Rand_ZeroOne() * 0.6f) + 2.8f);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Toge/ObjToge_Init.s")
void func_809A43A8(ObjToge* this, GlobalContext* globalCtx) {
if (!OBJTOGE_GET_4000(&this->actor)) {
func_809A41C0(this, globalCtx);
} else {
func_809A42A0(this, globalCtx);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Toge/ObjToge_Destroy.s")
s32 func_809A43EC(ObjToge* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
f32 temp_fv1 = player->actor.world.pos.x - this->unk_1B8;
f32 temp_fa0 = player->actor.world.pos.z - this->unk_1BC;
f32 temp = -(this->unk_1CC * temp_fa0) + (temp_fv1 * this->unk_1C8);
f32 temp2 = (this->unk_1CC * temp_fv1) + (temp_fa0 * this->unk_1C8);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Toge/func_809A4744.s")
return fabsf(temp) <= this->unk_1C0 && fabsf(temp2) <= this->unk_1C4;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Toge/func_809A477C.s")
void ObjToge_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
ObjToge* this = THIS;
Path* path;
Vec3s* sp40;
s16 sp3E;
s32 sp38 = OBJTOGE_GET_4000(thisx);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Toge/func_809A4804.s")
Actor_ProcessInitChain(thisx, sInitChain);
Actor_SetScale(thisx, D_809A4D0C[sp38] * 0.1f);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Toge/func_809A481C.s")
sp3E = thisx->home.rot.z;
thisx->home.rot.z = thisx->world.rot.z = thisx->shape.rot.z = 0;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Toge/func_809A488C.s")
Collider_InitCylinder(globalCtx, &this->collider);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Toge/func_809A48AC.s")
if (OBJTOGE_GET_PATH(thisx) == 0xFF) {
Actor_MarkForDeath(thisx);
return;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Toge/ObjToge_Update.s")
path = &globalCtx->setupPathList[OBJTOGE_GET_PATH(thisx)];
if (path->count != 2) {
Actor_MarkForDeath(thisx);
return;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Toge/ObjToge_Draw.s")
sp40 = Lib_SegmentedToVirtual(path->points);
Math_Vec3s_ToVec3f(&this->unk_198[0], &sp40[0]);
Math_Vec3s_ToVec3f(&this->unk_198[1], &sp40[1]);
Math_Vec3f_Copy(&thisx->world.pos, &this->unk_198[0]);
thisx->world.rot.y = Math_Vec3f_Yaw(&this->unk_198[0], &this->unk_198[1]);
this->unk_194 = 0;
thisx->speedXZ = 0.0f;
if (sp3E > 0) {
s16 sp36;
this->unk_1B4 = true;
this->unk_1B8 = (this->unk_198[0].x + this->unk_198[1].x) * 0.5f;
this->unk_1BC = (this->unk_198[0].z + this->unk_198[1].z) * 0.5f;
sp36 = Math_Vec3f_Yaw(&this->unk_198[0], &this->unk_198[1]);
this->unk_1C8 = Math_CosS(sp36);
this->unk_1CC = Math_SinS(sp36);
this->unk_1C0 = sp3E * 7.5f;
this->unk_1C4 = Math3D_Distance(&this->unk_198[0], &this->unk_198[1]) * 0.5f;
} else {
this->unk_1B4 = false;
}
Collider_SetCylinder(globalCtx, &this->collider, thisx, &sCylinderInit);
Collider_UpdateCylinder(thisx, &this->collider);
thisx->colChkInfo.mass = MASS_IMMOVABLE;
if (sp38 == 1) {
this->collider.dim.radius = 60;
this->collider.dim.height = 40;
}
if (this->unk_1B4) {
func_809A4804(this);
} else {
func_809A4744(this);
}
}
void ObjToge_Destroy(Actor* thisx, GlobalContext* globalCtx2) {
GlobalContext* globalCtx = globalCtx2;
ObjToge* this = THIS;
Collider_DestroyCylinder(globalCtx, &this->collider);
}
void func_809A4744(ObjToge* this) {
this->actionFunc = func_809A477C;
this->unk_1B0 = 0;
this->unk_1B2 = D_809A4CFC[OBJTOGE_GET_3800(&this->actor)];
}
void func_809A477C(ObjToge* this, GlobalContext* globalCtx) {
if (this->unk_1B2 > 0) {
this->unk_1B2--;
}
if (this->unk_1B0 >= 0x1770) {
this->unk_1B0 = 0x1770;
func_809A488C(this);
} else if ((this->unk_1B0 > 0) || (this->unk_1B2 <= 0)) {
this->unk_1B0 += 200;
}
if (!this->unk_1B4) {
this->actor.shape.rot.y += this->unk_1B0;
}
}
void func_809A4804(ObjToge* this) {
this->actionFunc = func_809A481C;
this->unk_1B0 = 0;
}
void func_809A481C(ObjToge* this, GlobalContext* globalCtx) {
if (this->unk_1B0 >= 0x1770) {
this->unk_1B0 = 0x1770;
func_809A488C(this);
} else if ((this->unk_1B0 > 0) || func_809A43EC(this, globalCtx)) {
this->unk_1B0 += 200;
}
this->actor.shape.rot.y += this->unk_1B0;
}
void func_809A488C(ObjToge* this) {
this->actor.speedXZ = 1.0f;
this->actionFunc = func_809A48AC;
}
void func_809A48AC(ObjToge* this, GlobalContext* globalCtx) {
s32 pad;
s32 sp30 = this->unk_194 ^ 1;
if (this->unk_1B4 && (this->unk_194 == 1)) {
Math_StepToF(&this->actor.speedXZ, 2.0f, 0.4f);
} else {
Math_StepToF(&this->actor.speedXZ, D_809A4CDC[OBJTOGE_GET_700(&this->actor)], 1.5f);
this->actor.shape.rot.y += 0x1770;
}
Actor_MoveWithGravity(&this->actor);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 10.0f, D_809A4D0C[OBJTOGE_GET_4000(&this->actor)] * 30.0f, 0.0f,
0x81);
if (this->actor.bgCheckFlags & 8) {
this->actor.world.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_198[this->unk_194]);
this->unk_194 = sp30;
if (this->unk_1B4 && (this->unk_194 == 0)) {
func_809A4804(this);
} else {
func_809A4744(this);
}
Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SPINE_TRAP_MOVE);
} else {
s16 yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_198[sp30]) - this->actor.world.rot.y;
yaw = ABS_ALT(yaw);
if ((yaw > 0x4000) || (yaw == -0x8000)) {
this->actor.world.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_198[this->unk_194]);
this->unk_194 = sp30;
if (this->unk_1B4 && (this->unk_194 == 0)) {
func_809A4804(this);
} else {
func_809A4744(this);
}
Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_SPINE_TRAP_MOVE);
}
}
}
void ObjToge_Update(Actor* thisx, GlobalContext* globalCtx) {
ObjToge* this = THIS;
ColliderCylinder* collider = &this->collider;
if (this->collider.base.acFlags & AC_HIT) {
if (this->collider.info.acHitInfo->toucher.dmgFlags & 0x1000) {
func_809A43A8(this, globalCtx);
Actor_SetColorFilter(&this->actor, 0, 250, 0, 250);
}
collider->base.acFlags &= ~AC_HIT;
}
if (this->actor.colorFilterTimer == 0) {
if (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) {
func_800B8DD4(globalCtx, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f, 4);
}
this->actionFunc(this, globalCtx);
Collider_UpdateCylinder(&this->actor, &this->collider);
if (this->actor.xzDistToPlayer < 1000.0f) {
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
}
if ((this->actor.flags & ACTOR_FLAG_40) || (this->actor.xzDistToPlayer < 300.0f)) {
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &collider->base);
} else {
this->collider.base.ocFlags1 &= ~OC1_HIT;
this->collider.base.ocFlags2 &= ~OC2_HIT_PLAYER;
}
}
void ObjToge_Draw(Actor* thisx, GlobalContext* globalCtx) {
ObjToge* this = THIS;
func_800B8050(&this->actor, globalCtx, 1);
Gfx_DrawDListOpa(globalCtx, object_trap_DL_001400);
}

View File

@ -7,11 +7,26 @@ struct ObjToge;
typedef void (*ObjTogeActionFunc)(struct ObjToge*, GlobalContext*);
#define OBJTOGE_GET_PATH(thisx) ((thisx)->params & 0xFF)
#define OBJTOGE_GET_700(thisx) (((thisx)->params >> 8) & 7)
#define OBJTOGE_GET_3800(thisx) (((thisx)->params >> 0xB) & 7)
#define OBJTOGE_GET_4000(thisx) (((thisx)->params >> 0xE) & 1)
typedef struct ObjToge {
/* 0x0000 */ Actor actor;
/* 0x0144 */ char unk_144[0x4C];
/* 0x0190 */ ObjTogeActionFunc actionFunc;
/* 0x0194 */ char unk_194[0x3C];
/* 0x000 */ Actor actor;
/* 0x144 */ ColliderCylinder collider;
/* 0x190 */ ObjTogeActionFunc actionFunc;
/* 0x194 */ s32 unk_194;
/* 0x198 */ Vec3f unk_198[2];
/* 0x1B0 */ s16 unk_1B0;
/* 0x1B2 */ s16 unk_1B2;
/* 0x1B4 */ u8 unk_1B4;
/* 0x1B8 */ f32 unk_1B8;
/* 0x1BC */ f32 unk_1BC;
/* 0x1C0 */ f32 unk_1C0;
/* 0x1C4 */ f32 unk_1C4;
/* 0x1C8 */ f32 unk_1C8;
/* 0x1CC */ f32 unk_1CC;
} ObjToge; // size = 0x1D0
extern const ActorInit Obj_Toge_InitVars;

View File

@ -1618,10 +1618,6 @@ D_06001100 = 0x06001100;
D_06001140 = 0x06001140;
D_06001CB0 = 0x06001CB0;
// ovl_Obj_Toge
D_06001400 = 0x06001400;
// ovl_Obj_Toudai
D_060023B0 = 0x060023B0;