Obj_Chikuwa (#893)

* Obj_Chikuwa

* PR
This commit is contained in:
Maide 2022-07-12 03:25:54 +01:00 committed by GitHub
parent 122e4f3982
commit 9969b204bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 216 additions and 23 deletions

3
spec
View File

@ -2281,8 +2281,7 @@ beginseg
name "ovl_Obj_Chikuwa"
compress
include "build/src/overlays/actors/ovl_Obj_Chikuwa/z_obj_chikuwa.o"
include "build/data/ovl_Obj_Chikuwa/ovl_Obj_Chikuwa.data.o"
include "build/data/ovl_Obj_Chikuwa/ovl_Obj_Chikuwa.reloc.o"
include "build/src/overlays/actors/ovl_Obj_Chikuwa/ovl_Obj_Chikuwa_reloc.o"
endseg
beginseg

View File

@ -5,6 +5,7 @@
*/
#include "z_obj_chikuwa.h"
#include "objects/object_d_lift/object_d_lift.h"
#define FLAGS (ACTOR_FLAG_10)
@ -15,7 +16,6 @@ void ObjChikuwa_Destroy(Actor* thisx, PlayState* play);
void ObjChikuwa_Update(Actor* thisx, PlayState* play);
void ObjChikuwa_Draw(Actor* thisx, PlayState* play);
#if 0
const ActorInit Obj_Chikuwa_InitVars = {
ACTOR_OBJ_CHIKUWA,
ACTORCAT_BG,
@ -28,31 +28,206 @@ const ActorInit Obj_Chikuwa_InitVars = {
(ActorFunc)ObjChikuwa_Draw,
};
// static InitChainEntry sInitChain[] = {
static InitChainEntry D_809B1FC0[] = {
static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneScale, 1500, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneDownward, 1500, ICHAIN_CONTINUE),
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
};
#endif
Vec3f D_809B1FD0 = { 0.0f, -0.3f, 0.0f };
Vec3f D_809B1FDC = { 0.0f, 0.7f, 0.0f };
extern InitChainEntry D_809B1FC0[];
void func_809B1550(Actor* thisx, PlayState* play) {
ObjChikuwa* this = THIS;
f32 sp18;
extern UNK_TYPE D_06000D10;
extern UNK_TYPE D_06000F00;
if (this->unk_2A0 < this->unk_29C) {
thisx->scale.z = (this->unk_29C - this->unk_2A0) * 0.05f;
sp18 = (((this->unk_29C + this->unk_2A0) * 60) - 60) * 0.5f;
thisx->world.pos.x = (Math_SinS(thisx->shape.rot.y) * sp18) + thisx->home.pos.x;
thisx->world.pos.z = (Math_CosS(thisx->shape.rot.y) * sp18) + thisx->home.pos.z;
} else {
func_800C62BC(play, &play->colCtx.dyna, this->dyna.bgId);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Chikuwa/func_809B1550.s")
void ObjChikuwa_Init(Actor* thisx, PlayState* play) {
ObjChikuwa* this = THIS;
s32 i;
s32 val;
ObjChikuwaStruct* temp;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Chikuwa/ObjChikuwa_Init.s")
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Chikuwa/ObjChikuwa_Destroy.s")
this->dyna.actor.scale.x = 0.15f;
this->dyna.actor.scale.y = 0.2f;
this->dyna.actor.scale.z = 0.05f;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Chikuwa/func_809B17D0.s")
DynaPolyActor_Init(&this->dyna, 0);
DynaPolyActor_LoadMesh(play, &this->dyna, &object_d_lift_Colheader_000F00);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Chikuwa/func_809B1AA0.s")
this->dyna.actor.home.rot.y += 0x2000;
this->dyna.actor.home.rot.y &= 0xC000;
this->unk_29C = 20;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Chikuwa/ObjChikuwa_Update.s")
this->dyna.actor.shape.rot.y = this->dyna.actor.home.rot.y;
this->dyna.actor.world.rot.y = this->dyna.actor.home.rot.y;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Obj_Chikuwa/ObjChikuwa_Draw.s")
for (val = 0, i = 0; i < this->unk_29C; i++, val += 7) {
temp = &this->unk_15C[i];
temp->unk_00.x = thisx->home.pos.x + (Math_SinS(thisx->shape.rot.y) * (i * 60));
temp->unk_00.y = thisx->home.pos.y;
temp->unk_00.z = thisx->home.pos.z + (Math_CosS(thisx->shape.rot.y) * (i * 60));
temp->unk_0C = val + 100;
}
func_809B1550(thisx, play);
}
void ObjChikuwa_Destroy(Actor* thisx, PlayState* play) {
ObjChikuwa* this = THIS;
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
}
void func_809B17D0(PlayState* play, ObjChikuwa* this, Vec3f* arg2) {
ObjChikuwaStruct2* temp_s0;
f32 var_fs2;
f32 temp;
s32 i;
for (i = 0, var_fs2 = -78.75f; i < 8; var_fs2 += 22.5f) {
temp_s0 = &this->unk_2A4[this->unk_9A4];
temp_s0->unk_00.x = (Rand_ZeroOne() * 0.05f) + 0.01f;
temp_s0->unk_00.y = (Rand_ZeroOne() * 0.16f) + 0.04f;
temp_s0->unk_00.z = (Rand_ZeroOne() * 0.05f) + 0.01f;
temp_s0->unk_0C.x = (Math_CosS(this->dyna.actor.shape.rot.y) * var_fs2) + arg2->x;
temp_s0->unk_0C.y = arg2->y;
temp_s0->unk_0C.z = (Math_SinS(this->dyna.actor.shape.rot.y) * var_fs2) + arg2->z;
temp_s0->unk_18 = (2.0f * Rand_ZeroOne()) - 1.0f;
temp_s0->unk_1C = (Rand_ZeroOne() * 4.0f) - 1.0f;
temp_s0->unk_20 = (2.0f * Rand_ZeroOne()) - 1.0f;
temp = Math3D_Vec3fMagnitude(&temp_s0->unk_00);
temp_s0->unk_24 = (-Rand_ZeroOne() * 0.5f) - temp * 25.0f;
temp_s0->unk_28.x = this->dyna.actor.shape.rot.x;
temp_s0->unk_28.y = this->dyna.actor.shape.rot.y;
temp_s0->unk_28.z = this->dyna.actor.shape.rot.z;
temp_s0->unk_2E.x = (Rand_ZeroOne() - 0.5f) * 5000.0f;
temp_s0->unk_2E.y = (Rand_ZeroOne() - 0.5f) * 5000.0f;
temp_s0->unk_2E.z = (Rand_ZeroOne() - 0.5f) * 5000.0f;
temp_s0->unk_34 = 80;
func_800B1210(play, &temp_s0->unk_0C, &D_809B1FDC, &D_809B1FD0, (Rand_ZeroOne() * 60.0f) + 80.0f,
(Rand_ZeroOne() * 30.0f) + 60.0f);
this->unk_9A4 = (this->unk_9A4 + 1) & 0x1F;
i++;
}
}
void func_809B1AA0(ObjChikuwa* this) {
ObjChikuwaStruct2* temp_v0;
s32 i;
this->unk_9A6 = 0;
for (i = 0; i < ARRAY_COUNT(this->unk_2A4); i++) {
temp_v0 = &this->unk_2A4[i];
if (temp_v0->unk_34 > 0) {
temp_v0->unk_34--;
this->unk_9A6 = 1;
temp_v0->unk_1C += temp_v0->unk_24;
temp_v0->unk_0C.x += temp_v0->unk_18;
temp_v0->unk_0C.y += temp_v0->unk_1C;
temp_v0->unk_0C.z += temp_v0->unk_20;
temp_v0->unk_28.x += temp_v0->unk_2E.x;
temp_v0->unk_28.y += temp_v0->unk_2E.y;
temp_v0->unk_28.z += temp_v0->unk_2E.z;
}
}
}
void ObjChikuwa_Update(Actor* thisx, PlayState* play) {
ObjChikuwa* this = THIS;
ObjChikuwaStruct* temp;
f32 temp_fs0;
s16 var_s2;
s32 i;
s32 quake;
this->unk_29E++;
for (i = 0; i < this->unk_29C; i++) {
temp = &this->unk_15C[i];
if ((this->unk_29E >= temp->unk_0C) && !(temp->unk_0E & 1)) {
temp->unk_0E |= 1;
this->unk_2A0++;
func_809B1550(&this->dyna.actor, play);
func_809B17D0(play, this, &temp->unk_00);
temp_fs0 = Math3D_Vec3fDistSq(&temp->unk_00, &GET_PLAYER(play)->actor.world.pos);
if (temp_fs0 < SQ(240.0f)) {
quake = Quake_Add(GET_ACTIVE_CAM(play), 3);
if (temp_fs0 < SQ(120.0f)) {
var_s2 = 4;
} else {
var_s2 = 3;
}
Quake_SetSpeed(quake, 0x4350);
Quake_SetQuakeValues(quake, var_s2, 0, 0, 0);
Quake_SetCountdown(quake, 7);
}
}
}
func_809B1AA0(this);
}
void ObjChikuwa_Draw(Actor* thisx, PlayState* play) {
ObjChikuwa* this = THIS;
ObjChikuwaStruct* temp;
ObjChikuwaStruct2* temp2;
s32 i;
OPEN_DISPS(play->state.gfxCtx);
func_8012C28C(play->state.gfxCtx);
if (this->unk_2A0 < this->unk_29C) {
for (i = 0; i < this->unk_29C; i++) {
temp = &this->unk_15C[i];
if (!(temp->unk_0E & 1)) {
Matrix_SetTranslateRotateYXZ(temp->unk_00.x, temp->unk_00.y, temp->unk_00.z,
&this->dyna.actor.shape.rot);
Matrix_Scale(0.15f, 0.2f, 0.05f, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, object_d_lift_DL_000D10);
}
}
}
if (this->unk_9A6 != 0) {
for (i = 0; i < ARRAY_COUNT(this->unk_2A4); i++) {
temp2 = &this->unk_2A4[i];
if (temp2->unk_34 > 0) {
Matrix_SetTranslateRotateYXZ(temp2->unk_0C.x, temp2->unk_0C.y, temp2->unk_0C.z, &temp2->unk_28);
Matrix_Scale(temp2->unk_00.x, temp2->unk_00.y, temp2->unk_00.z, MTXMODE_APPLY);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, object_d_lift_DL_000D10);
}
}
}
CLOSE_DISPS(play->state.gfxCtx);
}

View File

@ -5,9 +5,33 @@
struct ObjChikuwa;
typedef struct {
/* 0x00 */ Vec3f unk_00;
/* 0x0C */ s16 unk_0C;
/* 0x0E */ u8 unk_0E;
} ObjChikuwaStruct; // size = 0x10
typedef struct {
/* 0x00 */ Vec3f unk_00;
/* 0x0C */ Vec3f unk_0C;
/* 0x18 */ f32 unk_18;
/* 0x1C */ f32 unk_1C;
/* 0x20 */ f32 unk_20;
/* 0x24 */ f32 unk_24;
/* 0x28 */ Vec3s unk_28;
/* 0x2E */ Vec3s unk_2E;
/* 0x34 */ s16 unk_34;
} ObjChikuwaStruct2; // size = 0x38
typedef struct ObjChikuwa {
/* 0x000 */ Actor actor;
/* 0x144 */ char unk_144[0x864];
/* 0x000 */ DynaPolyActor dyna;
/* 0x15C */ ObjChikuwaStruct unk_15C[20];
/* 0x29C */ s16 unk_29C;
/* 0x29E */ s16 unk_29E;
/* 0x2A0 */ s16 unk_2A0;
/* 0x2A4 */ ObjChikuwaStruct2 unk_2A4[32];
/* 0x9A4 */ s16 unk_9A4;
/* 0x9A6 */ u8 unk_9A6;
} ObjChikuwa; // size = 0x9A8
extern const ActorInit Obj_Chikuwa_InitVars;

View File

@ -1484,11 +1484,6 @@ D_06000168 = 0x06000168;
D_060003F8 = 0x060003F8;
D_060004B0 = 0x060004B0;
// ovl_Obj_Chikuwa
D_06000D10 = 0x06000D10;
D_06000F00 = 0x06000F00;
// ovl_Obj_Danpeilift
D_06000180 = 0x06000180;